예제 #1
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."));
            }
        }
예제 #2
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."));
            }
        }