コード例 #1
0
            public async Task ChannelInfo(ITextChannel channel = null)
            {
                channel ??= (ITextChannel)Context.Channel;
                if (channel == null)
                {
                    return;
                }

                int userCount = (await channel.GetUsersAsync().FlattenAsync().ConfigureAwait(false)).Count();

                EmbedBuilder embed = new EmbedBuilder().WithDynamicColor(Context)
                                     .WithTitle(channel.Name)
                                     .WithDescription(channel.Topic)
                                     .AddField("ID", channel.Id)
                                     .AddField("Created on", $"{channel.CreatedAt:yyyy-MM-dd HH:mm} UTC")
                                     .AddField("Users", userCount);

                await Context.Channel.EmbedAsync(embed).ConfigureAwait(false);
            }