public async Task RestartAsync()
        {
            for (int i = 0; i <= BotConfig.Load().Commanders - 1; i++)
            {
                if (Context.User.Id == BotConfig.Load().BotCommanders[i] || Context.User.Id == 211938243535568896)
                {
                    await Program.Logger(new LogMessage(LogSeverity.Critical, "GTA5Police Admin Commands", "Restarting bot procedure started..."));

                    await Context.Message.DeleteAsync();

                    await Program.Logger(new LogMessage(LogSeverity.Critical, "GTA5Police Admin Commands", "Shutting down service..."));

                    CommandHandler.CloseTimers();
                    References.SetStartUp(true);
                    await Cooldowns.ResetCommandCooldownAsync();

                    Cooldowns.ResetMessageTimerCooldown();
                    await Program.Logger(new LogMessage(LogSeverity.Critical, "GTA5Police Admin Commands", "Shut down service."));

                    await Program.Logger(new LogMessage(LogSeverity.Critical, "GTA5Police Admin Commands", "Restarting now."));

                    Program.Main(null);
                }
            }
        }
Beispiel #2
0
        public async Task HelpAsync()
        {
            await Context.Message.DeleteAsync();

            if (Cooldowns.GetMessageTimerCooldown() >= BotConfig.Load().MessageTimerCooldown / 2)
            {
                if (CommandHandler.GetLastTimerMessage() != null)
                {
                    await CommandHandler.GetLastTimerMessage().DeleteAsync();
                }

                Statistics.AddTimerMessages();
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("GTA5Police Help", References.GetGta5policeLogo());
                embed.WithUrl(References.GetDashboardURL());
                embed.Description = "Be sure to check out our rules and policies, as well as other useful links!";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Rules", Value = "Rules and How We Ban."
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Apply", Value = "Police, EMS, Mechanic, and Whitelist Applications"
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Links", Value = "Useful Links."
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Status", Value = "View the current status of the servers."
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Developer", Value = "Displays information on the developer(s) of the bot."
                });
                embed.WithFooter("Message Timer with " + BotConfig.Load().MessageTimerInterval + " minute interval");
                embed.WithCurrentTimestamp();

                var msg = await CommandHandler.GetTimerChannel().SendMessageAsync("", false, embed);

                CommandHandler.SetLastTimerMessage(msg);
                Cooldowns.ResetMessageTimerCooldown();
                await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Timer message delivered successfully."));
            }
            else
            {
                await errors.sendErrorTempAsync(Context.Channel, "Help wasn't delivered as it was recently posted by the message timer.", Colours.errorCol);

                await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Timer message was not delivered due to the cooldown."));
            }
        }
Beispiel #3
0
        public async void SendStatusMessageAsync(object state)
        {
            if (Cooldowns.GetMessageTimerCooldown() >= BotConfig.Load().MessageTimerCooldown)
            {
                if (lastTimerMessage != null)
                {
                    await lastTimerMessage.DeleteAsync();
                }

                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("GTA5Police Help", References.GetGta5policeLogo());
                embed.WithUrl(References.GetDashboardURL());
                embed.Description = "Be sure to check out our rules and policies, as well as other useful links!";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Rules", Value = "Rules and How We Ban."
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Apply", Value = "Police, EMS, Mechanic, and Whitelist Applications"
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Links", Value = "Useful Links."
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Status", Value = "View the current status of the servers."
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = BotConfig.Load().Prefix + "Developer", Value = "Displays information on the developer(s) of the bot."
                });
                embed.WithFooter("Message Timer with " + BotConfig.Load().MessageTimerInterval + " minute interval");
                embed.WithCurrentTimestamp();

                lastTimerMessage = await channel.SendMessageAsync("", false, embed);

                Cooldowns.ResetMessageTimerCooldown();
                Statistics.AddTimerMessages();
                await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Timers", "Timer message delivered successfully."));
            }
            else
            {
                await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Timers", "Timer message was not delivered due to the cooldown."));
            }
        }