Beispiel #1
0
        public async Task StatusAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

            await Context.Channel.TriggerTypingAsync();

            TimeSpan last       = Cooldowns.GetStatusLast();
            TimeSpan current    = DateTime.Now.TimeOfDay;
            double   difference = current.TotalSeconds - last.TotalSeconds;

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                ServerStatus status = new ServerStatus();
                status.PingServers();

                await status.DisplayStatusAsync(channel, user);

                await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Status command was used by " + user + "."));

                Cooldowns.SetStatusLast(current);
                Statistics.AddOutgoingMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }