Ejemplo n.º 1
0
        public async Task ExcludeChannel(CommandContext ctx,
                                         [Description("Exclude a channel")] DiscordChannel chan)
        {
            // Check if the user can use config commands.
            if (ctx.Member.GetRole().IsBotManagerOrHigher())
            {
                await ctx.Channel.TriggerTypingAsync();

                // Cancels:
                if (BotSettings.IsChannelExcluded(chan))
                {   // This channel does not exist.
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Unable to uexclude channel. This channel is already excluded..."));

                    return;
                }
                if (!ctx.Guild.Channels.ContainsKey(chan.Id))
                {   // This channel is not in the guild.
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Unable to exclude channel. This channel does not exist in this server..."));

                    return;
                }


                BotSettings.ExcludeChannel(chan);
                BotSettings.Save();

                await ctx.Channel.SendMessageAsync(
                    ChatObjects.GetSuccessMessage(
                        String.Format("{0} was successfully excluded!", chan.Mention)));
            }
        }
Ejemplo n.º 2
0
        public async Task FilterExclude(CommandContext ctx, string word)
        {
            if (ctx.Member.GetRole().IsSeniorModOrHigher())
            {
                await ctx.TriggerTypingAsync();

                // Cancels:
                if (FilterSystem.IsWord(word))
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Cannot add that word. It's a filter word..."));

                    return;
                }
                if (Excludes.IsExcluded(word))
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Cannot add that word. It's already excluded..."));

                    return;
                }

                Excludes.AddWord(word);
                Excludes.Save();

                await ctx.Channel.SendMessageAsync(
                    ChatObjects.GetSuccessMessage(
                        String.Format("I excluded the word {0}!", word)));
            }
        }
Ejemplo n.º 3
0
        public async Task SetFilterChannel(CommandContext ctx,
                                           [Description("The channel to set the filter logs to.")] DiscordChannel chan)
        {
            // Check if the user can use these sorts of commands.
            if (ctx.Member.GetRole().IsBotManagerOrHigher())
            {
                await ctx.TriggerTypingAsync();

                // Cancels:
                if (BotSettings.FilterChannelId == chan.Id)
                {   // Trying to set the channel to itself.
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Unable to set filter channel. That's already the channel..."));

                    return;
                }
                if (!ctx.Guild.Channels.ContainsKey(chan.Id))
                {   // Channel does not exist.
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Unable to set filter channel. Does not exist or is not in this guild..."));

                    return;
                }

                // Update the settings.
                BotSettings.FilterChannelId = chan.Id;
                BotSettings.Save();

                // Success message.
                await ctx.Channel.SendMessageAsync(
                    ChatObjects.GetSuccessMessage(
                        String.Format("Filter channel set to {0}!", chan.Mention)));
            }
        }
Ejemplo n.º 4
0
        public async Task FilterInclude(CommandContext ctx, string word)
        {
            if (ctx.Member.GetRole().IsSeniorModOrHigher())
            {
                await ctx.TriggerTypingAsync();

                if (!Excludes.IsExcluded(word))
                {
                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetErrMessage(@"Cannot un-exclude that word. It's not already excluded..."));
                }
                else
                {
                    Excludes.RemoveWord(word);
                    Excludes.Save();

                    await ctx.Channel.SendMessageAsync(
                        ChatObjects.GetSuccessMessage(@"I removed that word from exclusion!"));
                }
            }
        }