示例#1
0
        public async Task ExcludeChannel(CommandContext ctx, string command)
        {
            if (await Permissions.HandlePermissionsCheck(ctx) && command.Equals("list"))
            {
                // Check if there are even any excluded channels.
                if (Program.Settings.ExcludedChannels.Count > 0)
                {
                    var stringBuilder = new StringBuilder();

                    stringBuilder.AppendJoin('\n',
                                             Program.Settings.ExcludedChannels.Select(a => Generics.GetChannelMention(a)));

                    await ctx.RespondAsync(
                        embed : Generics.GenericEmbedTemplate(
                            color: Generics.NeutralColor,
                            description: Generics.NeutralDirectResponseTemplate(
                                mention: ctx.Member.Mention,
                                body: $"here are the excluded channels:\n{stringBuilder.ToString()}"),
                            thumbnail: Generics.URL_SPEECH_BUBBLE,
                            title: @"Excluded channels"));
                }
                else
                {
                    await ctx.RespondAsync(
                        embed : Generics.GenericEmbedTemplate(
                            color: Generics.NeutralColor,
                            description: Generics.NeutralDirectResponseTemplate(
                                mention: ctx.Member.Mention,
                                body: @"there are no excluded channels."),
                            thumbnail: Generics.URL_SPEECH_BUBBLE,
                            title: @"Excluded channels"));
                }
            }
        }