Last active
April 9, 2022 16:54
-
-
Save Romozz/9c935aa2d4c8337dd190b6ecc6a9c4da to your computer and use it in GitHub Desktop.
Создание слеш-команды мута в сервере
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Client } = require('discord.js'); // Импортируем библиотеку Discord.js | |
const client = new Client({ intents: 32767 }); // Создаём новый объект клиента | |
const guildId = '785859943877574676' // Ваш ID сервера, где вы хотите добавить команду мута | |
const roleId = '848256592750575656' // Ваш ID роли, которая сможет использовать команду мута | |
client.on('ready', () => { // При запуске клиента создается слеш-команда мута | |
client.api.applications(client.user.id).guilds(guildId).commands.post({ data: { | |
name: 'mute', | |
description: 'Выбери пользователя которого хочешь замутить!', | |
options: [ | |
{ | |
type: 6, // Тип опции - выбор пользователя | |
name: "user", | |
description: "Выбери пользователя которого хочешь замутить!", | |
required: true | |
}, | |
{ | |
type: 3, // Тип опции - string | |
name: "time", | |
description: "Время мута", | |
required: true | |
}, | |
{ | |
type: 3, // Тип опции - string | |
name: "reason", | |
description: "Причина мута" | |
} | |
], | |
}}).then((command)=>{ // Настраиваем права для команды мута | |
client.api.applications(client.user.id).guilds(guildId).commands(command.id).permissions.put({ | |
data: { | |
permissions: [ | |
{ | |
id: roleId, | |
type: 1, | |
permission: true | |
} | |
] | |
} | |
}).then(()=>{ | |
console.log('Команда мута успешно создана') | |
process.exit() // Закрываем процесс после создания команды | |
}) | |
}) | |
}) | |
client.login(token) // Введите свой токен для включения бота |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment