示例#1
0
        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);
                }
            }
        }