Beispiel #1
0
        public async Task IncludeChannel(CommandContext ctx,
                                         [Description("Channel to exclude.")] 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 un-exclude channel. This channel is not 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 un-exclude channel. This channel does not exist in this server..."));

                    return;
                }

                BotSettings.IncludeChannel(chan);
                BotSettings.Save();

                await ctx.Channel.SendMessageAsync(
                    ChatObjects.GetSuccessMessage(
                        String.Format("{0} was successfully un-excluded!", chan.Mention)));
            }
        }