Exemplo n.º 1
0
        public async Task DisplayRolesAsync(
            [Summary("The type of roles you want a list of. If left empty, this will default to show all roles")]
            [Example("Admin")]
            [Example("Color")]
            [Example("Game")]
            [Example("Other")]
            RoleType type = RoleType.Last)
        {
            string listDescription = "Here is a list of every ";

            if (type != RoleType.Last)
            {
                listDescription += "`" + type.ToString() + "`";
            }
            listDescription += $" role on `{Context.Guild.Name}`";
            if (type == RoleType.Last)
            {
                listDescription += ", sorted into types:";
            }

            // Declare EmbedBuilder base.
            EmbedBuilder builder = new EmbedBuilder()
                                   .WithColor(Data.COLOR_BOT)
                                   .WithThumbnailUrl(Data.URL_IMAGE_INFINITY_GAMING)
                                   .WithTitle("Roles")
                                   .WithDescription(listDescription);

            // Get the role list fields to the EmbedBuilder.
            builder = Data.AddRoleFields(builder, ((SocketGuildUser)Context.User).GuildPermissions.Administrator, type);

            // Send role list to user and return feedback message.
            await Context.User.SendMessageAsync(embed : builder.Build());

            string feedbackDescription = "I have PMed you a list of the ";

            if (type == RoleType.Last)
            {
                feedbackDescription += "server";
            }
            else
            {
                feedbackDescription += $"`{type.ToString()}`";
            }
            feedbackDescription += " roles.";
            IMessage m = await ReplyAsync(
                embed : new EmbedBuilder()
                .WithTitle("Role list sent")
                .WithDescription(feedbackDescription)
                .WithAutoDeletionFooter()
                .Build());

            // Delete prompt and feedback messages.
            await Task.Delay(Data.MESSAGE_DELETE_DELAY * 1000);

            await Context.Message.DeleteAsync();

            await m.DeleteAsync();
        }