예제 #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);
            }
        }
예제 #2
0
        public async Task MetaAsync(IUser metarerar)
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

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

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var message = await Context.Channel.SendMessageAsync(metarerar.Mention + " **#META**\n_'Metagaming is any strategy, action or method used in a game which transcends a prescribed ruleset, uses external factors to affect the game, or goes beyond the supposed limits or environment set by the game. Another definition refers to the game universe outside of the game itself.'_ Walkingking, 2k18");

                Statistics.AddOutgoingMessages();
                Statistics.AddMetaMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }
예제 #3
0
        public async Task RulesAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

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

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("GTA5Police Rules", References.GetGta5policeLogo());
                embed.Title       = "Click to view all GTA5Police rules.";
                embed.Description = "**Teamspeak IP: gta5police.com**";
                embed.WithUrl(References.GetRulesURL());
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.WithImageUrl(References.GetHowBanURL());
                embed.WithFooter("Requested by " + Context.User);
                embed.WithCurrentTimestamp();

                var message = await Context.Channel.SendMessageAsync("", false, embed);

                await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());

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

                Cooldowns.SetRulesLast(current);
                Statistics.AddOutgoingMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }
예제 #4
0
        public async Task ClearCachAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

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

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("How to clear your cache 101", References.GetGta5policeLogo());
                embed.WithUrl(References.GetClearcacheURL());
                embed.Title       = "Click here to learn how!";
                embed.Description = "Clearing your FiveM cache will help with many errors. This includes resources not loading, graphical issues and fps issues.";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.WithFooter("Requested by " + Context.User);
                embed.WithCurrentTimestamp();

                var message = await Context.Channel.SendMessageAsync("", false, embed);

                //await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());

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

                Cooldowns.SetClearcacheLast(current);
                Statistics.AddOutgoingMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }
예제 #5
0
        /** Display the status of the servers in the text channel. **/
        public async Task DisplayStatusAsync(IMessageChannel channel, IUser user)
        {
            if (mainStatus)
            {
                String newyork, losangeles, newyorkWhitelist, losangelesWhitelist;
                if (isNyLive)
                {
                    newyork = "Online using Port: " + nyPort;
                }
                else
                {
                    newyork = "Offline";
                }
                if (isLaLive)
                {
                    losangeles = "Online using Port: " + laPort;
                }
                else
                {
                    losangeles = "Offline";
                }
                if (isNyWlLive)
                {
                    newyorkWhitelist = "Online using Port: " + nyWlPort;
                }
                else
                {
                    newyorkWhitelist = "Offline";
                }
                if (isLaWlLive)
                {
                    losangelesWhitelist = "Online using Port: " + laWlPort;
                }
                else
                {
                    losangelesWhitelist = "Offline";
                }



                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("Current Server Status", References.GetGta5policeLogo());
                embed.WithDescription("IP: " + g5pIP + ":PORT");
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.WithUrl("https://gta5police.com/panel/index.php");
                var nyField = new EmbedFieldBuilder()
                {
                    Name = "New York", Value = newyork
                };
                var laField = new EmbedFieldBuilder()
                {
                    Name = "Los Angeles", Value = losangeles
                };
                var nyWlField = new EmbedFieldBuilder()
                {
                    Name = "New York Whitelist", Value = newyorkWhitelist
                };
                var laWlField = new EmbedFieldBuilder()
                {
                    Name = "Los Angeles Whitelist", Value = losangelesWhitelist
                };
                embed.AddField(nyField);
                embed.AddField(laField);
                embed.AddField(nyWlField);
                embed.AddField(laWlField);
                embed.WithFooter(new EmbedFooterBuilder()
                {
                    Text = "Requested by " + user
                });
                embed.WithCurrentTimestamp();

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

                await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());
            }
            else
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.errorCol
                };
                embed.WithAuthor("Current Server Status", References.GetGta5policeLogo());
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.WithUrl("https://gta5police.com/panel/index.php");
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "OFFLINE", Value = "GTA5Police servers are currently down, check back later for an update!"
                });
                embed.WithFooter(new EmbedFooterBuilder()
                {
                    Text = "Requested by " + user
                });
                embed.WithCurrentTimestamp();
                var message = await channel.SendMessageAsync("", false, embed);

                await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());
            }
        }
예제 #6
0
        public async Task UptimeAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

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

            TimeSpan uptimeTime = DateTime.Now.TimeOfDay - Cooldowns.GetStartupTime();
            int      startHours = uptimeTime.Hours;

            if (startHours < 0)
            {
                startHours = startHours + 24;
            }
            int startMinutes = uptimeTime.Minutes;
            int startSeconds = uptimeTime.Seconds;

            int startDays = DateTime.Now.Date.Day - Cooldowns.GetStartupDate().Day;

            if (startDays < 0)
            {
                startDays = ((startDays - startDays) - startDays);
                int startMonth     = Cooldowns.GetStartupDate().Month;
                int startYear      = Cooldowns.GetStartupDate().Year;
                int maxDaysInMonth = DateTime.DaysInMonth(startYear, startMonth);
                int extraDays      = maxDaysInMonth - Cooldowns.GetStartupDate().Day;
                startDays = startDays + extraDays;
            }

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                var blankField = new EmbedFieldBuilder()
                {
                    Name = "\u200b", Value = "\u200b"
                };
                embed.WithAuthor("Bot Uptime and Statistics", References.GetGta5policeLogo());
                embed.WithDescription("Here are all the statistics since last startup.\n**Teamspeak IP: gta5police.com**");
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.WithUrl("http://www.blurrdev.com/gta5police.html");
                //embed.AddField(new EmbedFieldBuilder() { Name = "Bot Uptime", Value = DateTime.Now.TimeOfDay - Cooldowns.GetStartupTime() });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Bot Uptime", Value = "Days: " + startDays + " | Hours: " + startHours + " | Minutes: " + startMinutes + " | Seconds: " + startSeconds
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Incoming Messages", Value = Statistics.GetIncomingMessages(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Outgoing Messages", Value = Statistics.GetOutgoingMessages(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Command Requests", Value = Statistics.GetCommandRequests(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Admen Requests", Value = Statistics.GetAdmenRequests(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Oofers", Value = Statistics.GetOofMessages(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Meta Messages", Value = Statistics.GetMetaMessages(), IsInline = true
                });
                embed.AddField(blankField);
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Profanity Detected", Value = Statistics.GetProfanityDetected(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Errors Detected", Value = Statistics.GetErrorsDetected(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Timer Messages", Value = Statistics.GetTimerMessages(), IsInline = true
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Status Changes", Value = Statistics.GetStatusChanges(), IsInline = true
                });
                embed.WithFooter("Requested by " + Context.User);
                embed.WithCurrentTimestamp();

                var message = await Context.Channel.SendMessageAsync("", false, embed);

                await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());

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

                Cooldowns.SetUptimeLast(current);
                Statistics.AddOutgoingMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }
예제 #7
0
        public async Task ApplyAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

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

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("GTA5Police Applications", References.GetGta5policeLogo());
                embed.WithUrl(References.GetApplicationsURL());
                embed.Description = "Whitelist jobs and server applications.\n**Teamspeak IP: gta5police.com**";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Whitelist Servers", Value = References.GetWhitelistURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Police", Value = References.GetPoliceURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "EMS", Value = References.GetEmsURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Mechanic", Value = References.GetMechanicURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Taxi", Value = References.GetTaxiURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Stream Verification", Value = References.GetStreamURL()
                });
                embed.WithFooter("Requested by " + Context.User);
                embed.WithCurrentTimestamp();

                var message = await Context.Channel.SendMessageAsync("", false, embed);

                await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());

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

                Cooldowns.SetApplyLast(current);
                Statistics.AddOutgoingMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }
예제 #8
0
        public async Task LinksAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

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

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("GTA5Police Links", References.GetGta5policeLogo());
                embed.Description = "Useful GTA5Police links for you.\n**Teamspeak IP: gta5police.com**";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Website", Value = References.GetWebsiteURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Dashboard", Value = References.GetDashboardURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Forums", Value = References.GetForumsURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Support", Value = References.GetSupportURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Suggestions", Value = References.GetSuggestionsURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Donations", Value = References.GetDonateURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Vacbanned - For Steam Hex", Value = References.GetVacbannedURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Greggs", Value = "https://www.greggs.co.uk/"
                });
                embed.WithFooter("Requested by " + Context.User);
                embed.WithCurrentTimestamp();

                var message = await Context.Channel.SendMessageAsync("", false, embed);

                await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());

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

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