Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public async void SendStatusAsync(object state)
 {
     status.PingServers();
     if (ny != status.getNyStatus())
     {
         Statistics.AddStatusChanges();
         if (References.IsStartUp() == true)
         {
             //if (status.getNyStatus()) await channel.SendMessageAsync("New York City, is now online!") /*success.sendSuccessTempAsync(channel, "Server Status Change", "New York City, is now online!", Colours.generalCol, References.GetDashboardURL(), 5)*/;
             //if (!status.getNyStatus()) await channel.SendMessageAsync("New York City has gone offline...") /*success.sendSuccessTempAsync(channel, "Server Status Change", "New York City has gone offline...", Colours.generalCol, References.GetDashboardURL(), 5)*/;
         }
         else
         {
             //if (status.getNyStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "New York City, is now online!", Colours.generalCol, References.GetDashboardURL());
             //if (!status.getNyStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "New York City has gone offline...", Colours.generalCol, References.GetDashboardURL());
         }
         ny = status.getNyStatus();
     }
     if (la != status.getLaStatus())
     {
         Statistics.AddStatusChanges();
         if (References.IsStartUp() == true)
         {
             //if (status.getLaStatus()) await channel.SendMessageAsync("Los Angeles, is now online!") /*success.sendSuccessTempAsync(channel, "Server Status Change", "Los Angeles, is now online!", Colours.generalCol, References.GetDashboardURL(), 5)*/;
             //if (!status.getLaStatus()) await channel.SendMessageAsync("Los Angelas has gone offline...") /*success.sendSuccessTempAsync(channel, "Server Status Change", "Los Angeles has gone offline...", Colours.generalCol, References.GetDashboardURL(), 5)*/;
         }
         else
         {
             //if (status.getLaStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "Los Angeles, is now online!", Colours.generalCol, References.GetDashboardURL());
             //if (!status.getLaStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "Los Angeles has gone offline...", Colours.generalCol, References.GetDashboardURL());
         }
         la = status.getLaStatus();
     }
     if (nywl != status.getNyWlStatus())
     {
         Statistics.AddStatusChanges();
         if (References.IsStartUp() == true)
         {
             //if (status.getNyWlStatus()) await channel.SendMessageAsync("New York City Whitelist, is now online!") /*success.sendSuccessTempAsync(channel, "Server Status Change", "New York City Whitelist, is now online!", Colours.generalCol, References.GetDashboardURL(), 5)*/;
             //if (!status.getNyWlStatus()) await channel.SendMessageAsync("New York City Whitelist has gone offline...") /*success.sendSuccessTempAsync(channel, "Server Status Change", "New York City Whitelist has gone offline...", Colours.generalCol, References.GetDashboardURL(), 5)*/;
         }
         else
         {
             //if (status.getNyWlStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "New York City Whitelist, is now online!", Colours.generalCol, References.GetDashboardURL());
             //if (!status.getNyWlStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "New York City Whitelist has gone offline...", Colours.generalCol, References.GetDashboardURL());
         }
         nywl = status.getNyWlStatus();
     }
     if (lawl != status.getLaWlStatus())
     {
         Statistics.AddStatusChanges();
         if (References.IsStartUp() == true)
         {
             //if (status.getLaWlStatus()) await channel.SendMessageAsync("Los Angeles Whitelist, is now online!") /*success.sendSuccessTempAsync(channel, "Server Status Change", "Los Angeles Whitelist, is now online!", Colours.generalCol, References.GetDashboardURL(), 5)*/;
             //if (!status.getLaWlStatus()) await channel.SendMessageAsync("Los Angeles Whitelist has gone offline...") /*success.sendSuccessTempAsync(channel, "Server Status Change", "Los Angeles Whitelist has gone offline...", Colours.generalCol, References.GetDashboardURL(), 5)*/;
         }
         else
         {
             //if (status.getLaWlStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "Los Angeles Whitelist, is now online!", Colours.generalCol, References.GetDashboardURL());
             //if (!status.getLaWlStatus()) await success.sendSuccessAsync(channel, "Server Status Change", "Los Angeles Whitelist has gone offline...", Colours.generalCol, References.GetDashboardURL());
         }
         lawl = status.getLaWlStatus();
     }
     if (References.IsStartUp() == true)
     {
         References.SetStartUp(false);
     }
 }