Как выдать роль по кнопке в эмбеде?
Хочу выдать роль по кнопке, но не знаю как это сделать. Помогите. Вот пример чего у меня есть. Но кнопки не работают, хочу чтобы выдавали роль
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, Events, SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require('discord.js');
const client = require('discord.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('control')
.setDescription('Управление пользователем')
.addUserOption(option =>
option
.setName('target')
.setDescription('Пользователь, кем вы хотите управлять')
.setRequired(true))
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers, PermissionFlagsBits.KickMembers)
.setDMPermission(false),
async execute(interaction) {
const member = await interaction.guild.members.fetch(interaction.options.getUser("target").id);
await interaction.reply({
"channel_id": `1073225699600637962`,
"content": "",
"tts": false,
"components": [
{
"type": 1,
"components": [
{
"style": 4,
"label": `Забанить `,
"custom_id": `row_0_button_0`,
"disabled": false,
"emoji": {
"id": null,
"name": `⛔`
},
"type": 2
},
{
"style": 3,
"label": `Разбанить`,
"custom_id": `row_0_button_1`,
"disabled": false,
"emoji": {
"id": null,
"name": `?`
},
"type": 2
},
{
"style": 4,
"label": `Мут`,
"custom_id": `row_0_button_4`,
"disabled": false,
"emoji": {
"id": null,
"name": `?`
},
"type": 2
},
{
"style": 3,
"label": `Размут`,
"custom_id": `row_0_button_5`,
"disabled": false,
"emoji": {
"id": null,
"name": `?`
},
"type": 2
}
]
}
],
"message_reference": {
"guild_id": "1070745792874291292",
"fail_if_not_exists": true
},
"allowed_mentions": {
"replied_user": true,
"roles": [
null,
null
]
},
"embeds": [
{
"type": "rich",
"title": `Управление пользователем сервера Abbadon`,
"description": "",
"color": 0x08f300,
"fields": [
{
"name": `Участник`,
"value": `<@${member.user.id}>`,
"inline": true
},
{
"name": `Дата регистрации`,
"value": `<t:${Math.round(member.user.createdTimestamp / 1000)}>`,
"inline": true
},
{
"name": `Присоединился к серверу`,
"value": `<t:${Math.round(member.joinedAt / 1000)}>`,
"inline": true
}
]
}
]
});
}
}
