1.0.3 • Published 3 years ago
teaus-rebuild v1.0.3
Библиотека TeaUs-Rebuild
Установить:
npm i teaus-rebuild
Начнём создавать ботов:
Создайте файл bot.js
и вставьте туда код:
const teaus = require("teaus-rebuild")
const bot = new teaus.Bot({
token: "TOKEN",
prefix: "!"
})
bot.onMessage()
Далее для создания первой команды вставляем в bot.js
этот код:
bot.Command({
name: "trigger",
code: `code`
})
Работаем с когами:
Для начала заменяем весь код (кроме команд) файла bot.js
, на этот:
const teaus = require("teaus-rebuild")
const bot = new teaus.Bot({
token: "token",
prefix: "!"
})
bot.onMessage()
const fs = require('fs')
const folders = fs.readdirSync("./commands/")
for (const files of folders) {
const folder = fs.readdirSync(`./commands/${files}/`).filter(file => file.endsWith(".js"))
for (const commands of folder) {
const command = require(`./commands/${files}/${commands}`)
bot.command({
name: command.name,
code: command.code
})
}
}