public async Task SetSensitivityAsync(CommandContext ctx,
                                                      [Description("Sensitivity (messages per 5s to trigger action).")] short sensitivity)
                {
                    if (sensitivity < 4 || sensitivity > 10)
                    {
                        throw new CommandFailedException("The sensitivity is not in the valid range ([4, 10]).");
                    }

                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    gcfg.RatelimitSettings.Sensitivity = sensitivity;

                    await this.Database.UpdateGuildSettingsAsync(ctx.Guild.Id, gcfg);

                    DiscordChannel logchn = this.Shared.GetLogChannelForGuild((DiscordClientImpl)ctx.Client, ctx.Guild);

                    if (logchn != null)
                    {
                        var emb = new DiscordEmbedBuilder()
                        {
                            Title = "Guild config changed",
                            Color = this.ModuleColor
                        };
                        emb.AddField("User responsible", ctx.User.Mention, inline: true);
                        emb.AddField("Invoked in", ctx.Channel.Mention, inline: true);
                        emb.AddField("Ratelimit sensitivity changed to", $"Max {gcfg.RatelimitSettings.Sensitivity} msgs per 5s");
                        await logchn.SendMessageAsync(embed : emb.Build());
                    }

                    await this.InformAsync(ctx, $"Ratelimit sensitivity for this guild has been changed to {Formatter.Bold(gcfg.RatelimitSettings.Sensitivity.ToString())} msgs per 5s", important : false);
                }
示例#2
0
                public async Task ExecuteGroupAsync(CommandContext ctx,
                                                    [Description("Enable?")] bool enable,
                                                    [Description("Log channel.")] DiscordChannel channel = null)
                {
                    channel = channel ?? ctx.Channel;

                    if (channel.Type != ChannelType.Text)
                    {
                        throw new CommandFailedException("Action logging channel must be a text channel.");
                    }

                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    gcfg.LogChannelId = enable ? channel.Id : 0;

                    await this.Database.UpdateGuildSettingsAsync(ctx.Guild.Id, gcfg);

                    DiscordChannel logchn = this.Shared.GetLogChannelForGuild((DiscordClientImpl)ctx.Client, ctx.Guild);

                    if (logchn != null)
                    {
                        var emb = new DiscordEmbedBuilder()
                        {
                            Title = "Guild config changed",
                            Color = this.ModuleColor
                        };
                        emb.AddField("User responsible", ctx.User.Mention, inline: true);
                        emb.AddField("Invoked in", ctx.Channel.Mention, inline: true);
                        emb.AddField("Logging channel set to", gcfg.LogChannelId.ToString(), inline: true);
                        await logchn.SendMessageAsync(embed : emb.Build());
                    }

                    await this.InformAsync(ctx, $"{Formatter.Bold(gcfg.LoggingEnabled ? "Enabled" : "Disabled")} action logs.", important : false);
                }
                public async Task SetActionAsync(CommandContext ctx,
                                                 [Description("Action type.")] PunishmentActionType action)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    gcfg.RatelimitSettings.Action = action;

                    await this.Database.UpdateGuildSettingsAsync(ctx.Guild.Id, gcfg);

                    DiscordChannel logchn = this.Shared.GetLogChannelForGuild((DiscordClientImpl)ctx.Client, ctx.Guild);

                    if (logchn != null)
                    {
                        var emb = new DiscordEmbedBuilder()
                        {
                            Title = "Guild config changed",
                            Color = this.ModuleColor
                        };
                        emb.AddField("User responsible", ctx.User.Mention, inline: true);
                        emb.AddField("Invoked in", ctx.Channel.Mention, inline: true);
                        emb.AddField("Ratelimit action changed to", gcfg.RatelimitSettings.Action.ToTypeString());
                        await logchn.SendMessageAsync(embed : emb.Build());
                    }

                    await this.InformAsync(ctx, $"Ratelimit action for this guild has been changed to {Formatter.Bold(gcfg.RatelimitSettings.Action.ToTypeString())}", important : false);
                }
示例#4
0
            public async Task ExecuteGroupAsync(CommandContext ctx,
                                                [Description("desc-chicken-upgrade-ids")] params int[] ids)
            {
                if (ids is null || !ids.Any())
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-upg-ids-none");
                }

                if (ctx.Services.GetRequiredService <ChannelEventService>().IsEventRunningInChannel(ctx.Channel.Id, out ChickenWar _))
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-war");
                }

                Chicken?chicken = await ctx.Services.GetRequiredService <ChickenService>().GetCompleteAsync(ctx.Guild.Id, ctx.User.Id);

                if (chicken is null)
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-none");
                }
                chicken.Owner = ctx.User;

                if (chicken.Stats.Upgrades?.Any(u => ids.Contains(u.Id)) ?? false)
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-upg-dup");
                }

                IReadOnlyList <ChickenUpgrade> upgrades = await this.Service.GetAsync();

                var toBuy = upgrades.Where(u => ids.Contains(u.Id)).ToList();

                CachedGuildConfig gcfg = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id);
                long   totalCost       = toBuy.Sum(u => u.Cost);
                string upgradeNames    = toBuy.Select(u => u.Name).JoinWith(", ");

                if (!await ctx.WaitForBoolReplyAsync("q-chicken-upg", args: new object[] { ctx.User.Mention, totalCost, gcfg.Currency, upgradeNames }))
                {
                    return;
                }

                if (!await ctx.Services.GetRequiredService <BankAccountService>().TryDecreaseBankAccountAsync(ctx.Guild.Id, ctx.User.Id, totalCost))
                {
                    throw new CommandFailedException(ctx, "cmd-err-funds", gcfg.Currency, totalCost);
                }

                await ctx.Services.GetRequiredService <ChickenBoughtUpgradeService>().AddAsync(
                    toBuy.Select(u => new ChickenBoughtUpgrade {
                    Id      = u.Id,
                    GuildId = chicken.GuildId,
                    UserId  = chicken.UserId
                })
                    );

                int addedStr = toBuy.Where(u => u.UpgradesStat == ChickenStatUpgrade.Str).Sum(u => u.Modifier);
                int addedVit = toBuy.Where(u => u.UpgradesStat == ChickenStatUpgrade.MaxVit).Sum(u => u.Modifier);
                await ctx.ImpInfoAsync(this.ModuleColor, Emojis.Chicken, "fmt-chicken-upg", ctx.User.Mention, chicken.Name, toBuy.Count, addedStr, addedVit);
            }
            public Task ListAsync(CommandContext ctx)
            {
                CachedGuildConfig gcfg = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id);

                return(ctx.RespondWithLocalizedEmbedAsync(emb => {
                    emb.WithLocalizedTitle("str-chicken-types");
                    emb.WithColor(this.ModuleColor);
                    foreach (((ChickenType type, ChickenStats stats), int i) in Chicken.StartingStats.Select((kvp, i) => (kvp, i)))
                    {
                        emb.AddLocalizedTitleField($"str-chicken-type-{i}", stats, titleArgs: new object[] { Chicken.Price(type), gcfg.Currency });
                    }
                }));
            }
示例#6
0
                public async Task BootersAsync(CommandContext ctx,
                                               [Description("Enable?")] bool enable)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    gcfg.LinkfilterSettings.BlockBooterWebsites = enable;

                    await this.Database.UpdateGuildSettingsAsync(ctx.Guild.Id, gcfg);

                    await this.InformAsync(ctx, $"{(enable ? "Enabled" : "Disabled")} DDoS/Booter website filtering!", important : false);

                    await this.LogConfigChangeAsync(ctx, "DDoS/Booter websites filtering", gcfg.LinkfilterSettings.BlockBooterWebsites);
                }
示例#7
0
                public async Task ExecuteGroupAsync(CommandContext ctx,
                                                    [Description("Enable?")] bool enable)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    gcfg.LinkfilterSettings.Enabled = enable;

                    await this.Database.UpdateGuildSettingsAsync(ctx.Guild.Id, gcfg);

                    await this.InformAsync(ctx, $"{(enable ? "Enabled" : "Disabled")} link filtering!", important : false);

                    await this.LogConfigChangeAsync(ctx, "Linkfilter", gcfg.LinkfilterSettings.Enabled);
                }
        public static async Task MessageFilterEventHandlerAsync(TheGodfatherShard shard, MessageCreateEventArgs e)
        {
            if (e.Author.IsBot || e.Channel.IsPrivate || string.IsNullOrWhiteSpace(e.Message?.Content))
            {
                return;
            }

            if (shard.SharedData.BlockedChannels.Contains(e.Channel.Id))
            {
                return;
            }

            CachedGuildConfig gcfg = shard.SharedData.GetGuildConfig(e.Guild.Id);

            if (gcfg.LinkfilterSettings.Enabled)
            {
                if (await shard.CNext.Services.GetService <LinkfilterService>().HandleNewMessageAsync(e, gcfg.LinkfilterSettings))
                {
                    return;
                }
            }

            if (!shard.SharedData.MessageContainsFilter(e.Guild.Id, e.Message.Content))
            {
                return;
            }

            if (!e.Channel.PermissionsFor(e.Guild.CurrentMember).HasFlag(Permissions.ManageMessages))
            {
                return;
            }

            await e.Message.DeleteAsync("_gf: Filter hit");

            DiscordChannel logchn = shard.SharedData.GetLogChannelForGuild(shard.Client, e.Guild);

            if (logchn == null)
            {
                return;
            }

            DiscordEmbedBuilder emb = FormEmbedBuilder(EventOrigin.Message, $"Filter triggered");

            emb.AddField("User responsible", e.Message.Author.Mention);
            emb.AddField("Channel", e.Channel.Mention);
            emb.AddField("Content", Formatter.BlockCode(Formatter.Sanitize(e.Message.Content.Truncate(1020))));

            await logchn.SendMessageAsync(embed : emb.Build());
        }
示例#9
0
        public static Task UpdateGuildSettingsAsync(this DBService db, ulong gid, CachedGuildConfig cfg)
        {
            return(db.ExecuteCommandAsync(cmd => {
                cmd.CommandText = "UPDATE gf.guild_cfg SET " +
                                  "(prefix, silent_respond, suggestions_enabled, log_cid, linkfilter_enabled, " +
                                  "linkfilter_invites, linkfilter_booters, linkfilter_disturbing, linkfilter_iploggers, " +
                                  "linkfilter_shorteners, currency, ratelimit_enabled, ratelimit_action, ratelimit_sens) = " +
                                  "(@prefix, @silent_respond, @suggestions_enabled, @log_cid, @linkfilter_enabled, " +
                                  "@linkfilter_invites, @linkfilter_booters, @linkfilter_disturbing, @linkfilter_iploggers, " +
                                  "@linkfilter_shorteners, @currency, @ratelimit_enabled, @ratelimit_action, @ratelimit_sens) " +
                                  "WHERE gid = @gid;";
                cmd.Parameters.Add(new NpgsqlParameter <long>("gid", (long)gid));
                if (string.IsNullOrWhiteSpace(cfg.Prefix))
                {
                    cmd.Parameters.AddWithValue("prefix", NpgsqlDbType.Varchar, DBNull.Value);
                }
                else
                {
                    cmd.Parameters.Add(new NpgsqlParameter <string>("prefix", cfg.Prefix));
                }
                cmd.Parameters.Add(new NpgsqlParameter <long>("log_cid", (long)cfg.LogChannelId));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("silent_respond", cfg.ReactionResponse));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("suggestions_enabled", cfg.SuggestionsEnabled));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("linkfilter_enabled", cfg.LinkfilterSettings.Enabled));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("linkfilter_invites", cfg.LinkfilterSettings.BlockDiscordInvites));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("linkfilter_booters", cfg.LinkfilterSettings.BlockBooterWebsites));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("linkfilter_disturbing", cfg.LinkfilterSettings.BlockDisturbingWebsites));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("linkfilter_iploggers", cfg.LinkfilterSettings.BlockIpLoggingWebsites));
                cmd.Parameters.Add(new NpgsqlParameter <bool>("linkfilter_shorteners", cfg.LinkfilterSettings.BlockUrlShorteners));
                if (string.IsNullOrWhiteSpace(cfg.Currency))
                {
                    cmd.Parameters.AddWithValue("currency", NpgsqlDbType.Varchar, DBNull.Value);
                }
                else
                {
                    cmd.Parameters.Add(new NpgsqlParameter <string>("currency", cfg.Currency));
                }
                cmd.Parameters.Add(new NpgsqlParameter <bool>("ratelimit_enabled", cfg.RatelimitSettings.Enabled));
                cmd.Parameters.Add(new NpgsqlParameter <short>("ratelimit_action", (short)cfg.RatelimitSettings.Action));
                cmd.Parameters.Add(new NpgsqlParameter <short>("ratelimit_sens", cfg.RatelimitSettings.Sensitivity));

                return cmd.ExecuteNonQueryAsync();
            }));
        }
            private async Task TryBuyInternalAsync(CommandContext ctx, ChickenType type, string name)
            {
                if (string.IsNullOrWhiteSpace(name))
                {
                    throw new InvalidCommandUsageException(ctx, "cmd-err-missing-name");
                }

                if (name.Length > Chicken.NameLimit)
                {
                    throw new InvalidCommandUsageException(ctx, "cmd-err-name", Chicken.NameLimit);
                }

                if (!name.All(c => char.IsLetterOrDigit(c) || char.IsWhiteSpace(c)))
                {
                    throw new InvalidCommandUsageException(ctx, "cmd-err-name-alnum");
                }

                if (await this.Service.ContainsAsync(ctx.Guild.Id, ctx.User.Id))
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-dup");
                }

                CachedGuildConfig gcfg = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id);

                long price = Chicken.Price(type);

                if (!await ctx.WaitForBoolReplyAsync("q-chicken-buy", args: new object[] { ctx.User.Mention, price, gcfg.Currency }))
                {
                    return;
                }

                if (!await ctx.Services.GetRequiredService <BankAccountService>().TryDecreaseBankAccountAsync(ctx.Guild.Id, ctx.User.Id, price))
                {
                    throw new CommandFailedException(ctx, "cmd-err-funds", gcfg.Currency, price);
                }

                await this.Service.AddAsync(new Chicken(type) {
                    GuildId = ctx.Guild.Id,
                    Name    = name,
                    UserId  = ctx.User.Id,
                });

                await ctx.ImpInfoAsync(this.ModuleColor, Emojis.Chicken, "fmt-chicken-buy", ctx.User.Mention, type.Humanize(LetterCasing.LowerCase), name);
            }
        public static async Task <DatabaseGuildConfig> ModifyGuildConfigAsync(this TheGodfatherModule module, ulong gid, Action <DatabaseGuildConfig> action)
        {
            DatabaseGuildConfig gcfg = null;

            using (DatabaseContext db = module.Database.CreateContext()) {
                gcfg = await db.GuildConfig.FindAsync((long)gid) ?? new DatabaseGuildConfig();

                action(gcfg);
                db.GuildConfig.Update(gcfg);
                await db.SaveChangesAsync();
            }

            CachedGuildConfig cgcfg = module.Shared.GetGuildConfig(gid);

            cgcfg = gcfg.CachedConfig;
            module.Shared.UpdateGuildConfig(gid, _ => cgcfg);

            return(gcfg);
        }
        public static async Task MessageCreateProtectionHandlerAsync(TheGodfatherShard shard, MessageCreateEventArgs e)
        {
            if (e.Author.IsBot || e.Channel.IsPrivate || string.IsNullOrWhiteSpace(e.Message?.Content))
            {
                return;
            }

            if (shard.SharedData.BlockedChannels.Contains(e.Channel.Id))
            {
                return;
            }

            CachedGuildConfig gcfg = shard.SharedData.GetGuildConfig(e.Guild.Id);

            if (gcfg.RatelimitSettings.Enabled)
            {
                await shard.CNext.Services.GetService <RatelimitService>().HandleNewMessageAsync(e, gcfg.RatelimitSettings);
            }
        }
示例#13
0
                public async Task ExecuteGroupAsync(CommandContext ctx)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    if (gcfg.LoggingEnabled)
                    {
                        IReadOnlyList <ExemptedEntity> exempted = await this.Database.GetAllExemptsAsync(ctx.Guild.Id);

                        var sb = new StringBuilder();
                        foreach (ExemptedEntity exempt in exempted.OrderBy(e => e.Type))
                        {
                            sb.AppendLine($"{exempt.Type.ToUserFriendlyString()} exempted: {exempt.Id}");
                        }

                        await this.InformAsync(ctx, $"Action logging for this guild is {Formatter.Bold("enabled")} at {ctx.Guild.GetChannel(gcfg.LogChannelId)?.Mention ?? "(unknown)"}!\n{sb.ToString()}");
                    }
                    else
                    {
                        await this.InformAsync(ctx, $"Action logging for this guild is {Formatter.Bold("disabled")}!");
                    }
                }
                public async Task ExecuteGroupAsync(CommandContext ctx,
                                                    [Description("Enable?")] bool enable,
                                                    [Description("Sensitivity (messages per 5s to trigger action).")] short sensitivity,
                                                    [Description("Action type.")] PunishmentActionType action = PunishmentActionType.Mute)
                {
                    if (sensitivity < 4 || sensitivity > 10)
                    {
                        throw new CommandFailedException("The sensitivity is not in the valid range ([4, 10]).");
                    }

                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    gcfg.RatelimitSettings.Enabled     = enable;
                    gcfg.RatelimitSettings.Action      = action;
                    gcfg.RatelimitSettings.Sensitivity = sensitivity;

                    await this.Database.UpdateGuildSettingsAsync(ctx.Guild.Id, gcfg);

                    DiscordChannel logchn = this.Shared.GetLogChannelForGuild((DiscordClientImpl)ctx.Client, ctx.Guild);

                    if (logchn != null)
                    {
                        var emb = new DiscordEmbedBuilder()
                        {
                            Title       = "Guild config changed",
                            Description = $"Ratelimit {(enable ? "enabled" : "disabled")}",
                            Color       = this.ModuleColor
                        };
                        emb.AddField("User responsible", ctx.User.Mention, inline: true);
                        emb.AddField("Invoked in", ctx.Channel.Mention, inline: true);
                        if (enable)
                        {
                            emb.AddField("Ratelimit sensitivity", gcfg.RatelimitSettings.Sensitivity.ToString(), inline: true);
                            emb.AddField("Ratelimit action", gcfg.RatelimitSettings.Action.ToTypeString(), inline: true);
                        }
                        await logchn.SendMessageAsync(embed : emb.Build());
                    }

                    await this.InformAsync(ctx, $"{Formatter.Bold(gcfg.RatelimitSettings.Enabled ? "Enabled" : "Disabled")} ratelimit actions.", important : false);
                }
示例#15
0
                public async Task ExecuteGroupAsync(CommandContext ctx)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    if (gcfg.RatelimitSettings.Enabled)
                    {
                        var sb = new StringBuilder();
                        sb.Append("Sensitivity: ").AppendLine(gcfg.RatelimitSettings.Sensitivity.ToString());
                        sb.Append("Action: ").AppendLine(gcfg.RatelimitSettings.Action.ToString());

                        sb.AppendLine().Append(Formatter.Bold("Exempts:"));

                        List <DatabaseExemptRatelimit> exempted;
                        using (DatabaseContext db = this.Database.CreateContext()) {
                            exempted = await db.RatelimitExempts
                                       .Where(ee => ee.GuildId == ctx.Guild.Id)
                                       .OrderBy(ee => ee.Type)
                                       .ToListAsync();
                        }

                        if (exempted.Any())
                        {
                            sb.AppendLine();
                            foreach (DatabaseExemptedEntity ee in exempted)
                            {
                                sb.AppendLine($"{ee.Type.ToUserFriendlyString()}: {ee.Id}");
                            }
                        }
                        else
                        {
                            sb.Append(" None");
                        }

                        await this.InformAsync(ctx, $"Ratelimit watch for this guild is {Formatter.Bold("enabled")}\n{sb.ToString()}");
                    }
                    else
                    {
                        await this.InformAsync(ctx, $"Ratelimit watch for this guild is {Formatter.Bold("disabled")}");
                    }
                }
            private async Task <Chicken?> PreTrainCheckAsync(CommandContext ctx, string stat)
            {
                if (ctx.Services.GetRequiredService <ChannelEventService>().IsEventRunningInChannel(ctx.Channel.Id, out ChickenWar _))
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-war");
                }

                Chicken?chicken = await this.Service.GetCompleteAsync(ctx.Guild.Id, ctx.User.Id);

                if (chicken is null)
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-none");
                }
                chicken.Owner = ctx.User;

                if (chicken.Stats.TotalVitality < Chicken.MinVitalityToFight)
                {
                    throw new CommandFailedException(ctx, "cmd-err-chicken-weak", ctx.User.Mention);
                }

                CachedGuildConfig gcfg = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id);
                long price             = stat switch {
                    "STR" => chicken.TrainStrengthPrice,
                    "VIT" => chicken.TrainVitalityPrice,
                    _ => throw new CommandFailedException(ctx),
                };

                if (!await ctx.WaitForBoolReplyAsync("q-chicken-train", args: new object[] { ctx.User.Mention, stat, price, gcfg.Currency }))
                {
                    return(null);
                }

                if (!await ctx.Services.GetRequiredService <BankAccountService>().TryDecreaseBankAccountAsync(ctx.Guild.Id, ctx.User.Id, price))
                {
                    throw new CommandFailedException(ctx, "cmd-err-funds", gcfg.Currency, price);
                }

                return(chicken);
            }
示例#17
0
        public static async Task MessageFilterEventHandlerAsync(KioskAppShard shard, MessageCreateEventArgs e)
        {
            if (e.Author.IsBot || e.Channel.IsPrivate || string.IsNullOrWhiteSpace(e.Message?.Content))
            {
                return;
            }

            if (shard.SharedData.BlockedChannels.Contains(e.Channel.Id))
            {
                return;
            }

            CachedGuildConfig gcfg = shard.SharedData.GetGuildConfig(e.Guild.Id);

            if (gcfg.LinkfilterSettings.Enabled)
            {
                if (await shard.CNext.Services.GetService <LinkfilterService>().HandleNewMessageAsync(e, gcfg.LinkfilterSettings))
                {
                    return;
                }
            }

            if (!shard.SharedData.MessageContainsFilter(e.Guild.Id, e.Message.Content))
            {
                return;
            }

            if (!e.Channel.PermissionsFor(e.Guild.CurrentMember).HasFlag(Permissions.ManageMessages))
            {
                return;
            }

            await e.Message.DeleteAsync("_gf: Filter hit");

            await e.Channel.SendMessageAsync($"{e.Author.Mention} said: {FormatterExtensions.Spoiler(Formatter.BlockCode(Formatter.Strip(e.Message.Content)))}");
        }
            public Task InvitesAsync(CommandContext ctx)
            {
                CachedGuildConfig gcfg = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id);

                return(ctx.InfoAsync(this.ModuleColor, "fmt-lf-invite", gcfg.LinkfilterSettings.BlockDiscordInvites));
            }
            public Task ShortenersAsync(CommandContext ctx)
            {
                CachedGuildConfig gcfg = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id);

                return(ctx.InfoAsync(this.ModuleColor, "fmt-lf-urlshort", gcfg.LinkfilterSettings.BlockUrlShorteners));
            }
                public Task BootersAsync(CommandContext ctx)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    return(this.InformAsync(ctx, $"DDoS/Booter website filtering for this guild is: {Formatter.Bold(gcfg.LinkfilterSettings.BlockBooterWebsites ? "enabled" : "disabled")}!"));
                }
                public Task ShortenersAsync(CommandContext ctx)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    return(this.InformAsync(ctx, $"URL shortening websites filtering for this guild is: {Formatter.Bold(gcfg.LinkfilterSettings.BlockUrlShorteners ? "enabled" : "disabled")}!"));
                }
                public Task InvitesAsync(CommandContext ctx)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    return(this.InformAsync(ctx, $"Invite link filtering for this guild is: {Formatter.Bold(gcfg.LinkfilterSettings.BlockDiscordInvites ? "enabled" : "disabled")}!"));
                }
                public Task ExecuteGroupAsync(CommandContext ctx)
                {
                    CachedGuildConfig gcfg = this.Shared.GetGuildConfig(ctx.Guild.Id);

                    return(this.InformAsync(ctx, $"Ratelimit watch for this guild is {Formatter.Bold(gcfg.RatelimitSettings.Enabled ? "enabled" : "disabled")}"));
                }
示例#24
0
        public Task SuggestionsAsync(CommandContext ctx)
        {
            CachedGuildConfig gcfg = this.Service.GetCachedConfig(ctx.Guild.Id);

            return(ctx.InfoAsync(this.ModuleColor, gcfg.SuggestionsEnabled ? "str-cfg-suggest-get-on" : "str-cfg-suggest-get-off"));
        }
示例#25
0
        public Task CurrencyAsync(CommandContext ctx)
        {
            CachedGuildConfig gcfg = this.Service.GetCachedConfig(ctx.Guild.Id);

            return(ctx.InfoAsync(this.ModuleColor, Emojis.MoneyBag, "str-currency-get", gcfg.Currency));
        }
示例#26
0
        public Task SilentResponseAsync(CommandContext ctx)
        {
            CachedGuildConfig gcfg = this.Service.GetCachedConfig(ctx.Guild.Id);

            return(ctx.InfoAsync(this.ModuleColor, gcfg.ReactionResponse ? "str-cfg-silent-get-on" : "str-cfg-silent-get-off"));
        }