dsm-14
v0.6.1
Published
Упрощение для Djs которое не является контруктором по типу aoi.js
Downloads
19
Readme
Привет, это dsm-14 (Discord-Smart v14)
Создание бота
Создаем файл index.js и прописываем туда
// Импорт нужный классов для создания бота и команд
import { Bot, Database } from 'dsm-14'
// Создание базы данных и бота
const database = new Database()
const bot = new Bot({
prefix: "PREFIX",
token: "TOKEN",
intents: 131071,
db: database
})
// Создание команд для бота
// Префиксная команда
bot.command({
name: "command",
async execute(bot, message, args) {
message.reply("Привет мир!")
}
})
// Слэш команда
bot.slashCommand({
name: "command",
description: "Привет мир!",
async execute(interaction, bot) {
interaction.reply("Привет мир!")
}
})
Пример музыки
bot.music = new MusicClient(bot, {
defeanOnJoin: true,
leaveOnEnd: true,
leaveOnEmpty: false
})
bot.command({
name: "play",
async execute(bot, message, args) {
let queue = bot.music.createQueue(message.guild.id);
try {
const info = await bot.music.playSong({
queue: queue,
songName: args.join(" "),
voiceChannelId: message.member.voice.channel,
requestedBy: message.author.tag,
guildId: message.guild.id
})
message.reply(`Добавил в очередь! \nНазвание: ${info.name}\nАвтор: ${info.author}\nДлина: ${info.duration}`)
} catch(e) {
message.reply(`${e.message}`)
}
}
})