update packages + make discord.js 14 work

This commit is contained in:
ChomeNS 2022-12-24 12:59:52 +07:00
parent 7a2e6ef96b
commit 93494c9feb
21 changed files with 72 additions and 76 deletions

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'botuser',
alias: [],
@ -9,7 +9,7 @@ module.exports = {
bot.tellraw(selector, [{ text: 'The bot\'s username is: ', color: 'white' }, { text: `${bot.username}`, color: 'gold', clickEvent: { action: 'copy_to_clipboard', value: `${bot.username}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the username to your clipboard', color: 'green' }] } }, { text: ' and the UUID is: ' }, { text: `${bot.uuid}`, color: 'aqua', clickEvent: { action: 'copy_to_clipboard', value: `${bot.uuid}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the UUID to your clipboard', color: 'green' }] } }])
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s User')
.setDescription(`The bot's username is: \`${bot.username}\` and the UUID is: \`${bot.uuid}\``)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'botvisibility',
alias: ['botvis', 'togglevis', 'togglevisibility'],
@ -33,7 +33,7 @@ module.exports = {
if (args[0] === 'true' || args[0] === 'on') {
bot.visibility = true
bot.chat('/essentials:vanish disable')
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now visible')
@ -41,7 +41,7 @@ module.exports = {
} else if (args[0] === 'false' || args[0] === 'off') {
bot.visibility = false
bot.chat('/essentials:vanish enable')
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Visibility')
.setDescription('The bot\'s visibility is now invisible')
@ -51,7 +51,7 @@ module.exports = {
const visibleOrInvisible = bot.visibility ? 'visible' : 'invisible'
const enableOrDisable = bot.visibility ? 'disable' : 'enable'
bot.chat(`/essentials:vanish ${enableOrDisable}`)
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Visibility')
.setDescription(`The bot's visibility is now ${visibleOrInvisible}`)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'bruhify',
alias: [],
@ -10,7 +10,7 @@ module.exports = {
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
bot.bruhifyText = args.join(' ')
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Bruhify')
.setDescription(`Bruhify set to: ${bot.bruhifyText}`)

View file

@ -1,5 +1,5 @@
const changelog = require('../changelog.json')
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'changelog',
alias: ['changelogs'],
@ -32,7 +32,7 @@ module.exports = {
number += 1
changelogs += `\`${number}\` - \`${message}\`` + '\n'
})
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle(`Changelogs (${changelog.length})`)
.setDescription(changelogs)

View file

@ -1,5 +1,5 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
function list (bot, discord, channeldc, selector, config) {
const message = []
@ -17,7 +17,7 @@ function list (bot, discord, channeldc, selector, config) {
message.pop()
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloops')
.setDescription(message.join(''))
@ -74,7 +74,7 @@ module.exports = {
if (args[0] === 'add' && args[2]) {
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval')
bot.cloop.add(args.slice(2).join(' '), args[1])
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloop')
.setDescription(`Added cloop \`${args.slice(2).join(' ')}\` with interval ${args[1]} to the cloops`)
@ -83,14 +83,14 @@ module.exports = {
list(bot, true, channeldc, '@a', config)
} else if (args[0] === 'remove') {
bot.cloop.remove(args[1])
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloop')
.setDescription(`Removed cloop \`${args[1]}\``)
channeldc.send({ embeds: [Embed] })
} else if (args[0] === 'removeall' || args[0] === 'clear') {
bot.cloop.clear()
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Cloop')
.setDescription('Removed all looped commands')

View file

@ -1,6 +1,6 @@
const cowsay = require('cowsay2')
const cows = require('cowsay2/cows')
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'cowsay',
alias: [],
@ -34,7 +34,7 @@ module.exports = {
}
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Cowsay')
.setDescription(cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }))

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'creator',
alias: [],
@ -9,7 +9,7 @@ module.exports = {
bot.tellraw(selector, [{ text: 'ChomeNS Bot ', color: 'yellow' }, { text: 'was created by ', color: 'white' }, { text: 'chayapak', color: 'gold' }])
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Creator')
.setDescription('ChomeNS Bot was created by chayapak')

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
const { VM } = require('vm2')
const axios = require('axios')
const util = require('util')
@ -41,7 +41,7 @@ module.exports = {
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
if (args[0] === 'run') {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(`\`\`\`${util.inspect(bot.vm.run(args.slice(1).join(' '))).substring(0, 1950)}\`\`\``)
@ -55,7 +55,7 @@ module.exports = {
showErrorMsg: false,
code: args[1]
})).then((res) => {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(`\`\`\`${res.data}\`\`\``)

View file

@ -1,6 +1,6 @@
/* eslint-disable no-var */
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'help',
alias: ['heko', 'cmds', 'commands'],
@ -105,7 +105,7 @@ module.exports = {
if (command.alias.toString() !== '') {
alias = command.alias.join(', ')
}
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle(`${prefix + command.name} (${alias}) - ${command.description}`)
.setDescription(`Trust level: ${command.trusted}
@ -131,7 +131,7 @@ module.exports = {
if (command.discordExecute || command.proxy) continue
unsupportedCommands += command.name + ' '
}
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle(`Commands (Length: ${bot.command_handler.commands.length})`)
.setDescription('**Supported Commands**\n' + supportedCommands + '\n**Unsupported Commands**\n' + unsupportedCommands)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'list',
alias: [],
@ -64,7 +64,7 @@ module.exports = {
// if (property.match.startsWith('@')) continue;
players += `\`${property.name}\` \`${property.UUID}\`` + '\n'
}
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle(`Players (${bot.players.list.length})`)
.setDescription(players.substring(0, 4096))

View file

@ -1,7 +1,7 @@
/* eslint-disable no-case-declarations */
const fs = require('fs/promises')
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
const path = require('path')
const fileExists = require('../util/file-exists')
const fileList = require('../util/file-list')
@ -35,7 +35,7 @@ async function play (bot, values, discord, channeldc, selector, config) {
bot.music.queue.push(song)
bot.music.play(song)
if (discord) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Music')
.setDescription(`Added ${song.name} to the song queue`)
@ -45,7 +45,7 @@ async function play (bot, values, discord, channeldc, selector, config) {
}
} catch (e) {
if (discord) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription('```SyntaxError: Invalid file```')
@ -70,7 +70,7 @@ async function playUrl (bot, values, discord, channeldc, selector, config) {
bot.music.queue.push(song)
bot.music.play(song)
if (discord) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Music')
.setDescription(`Added ${song.name} to the song queue`)
@ -81,7 +81,7 @@ async function playUrl (bot, values, discord, channeldc, selector, config) {
} catch (_err) {
const e = response.data.toString()
if (discord) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e}\`\`\``)
@ -110,7 +110,7 @@ async function list (bot, discord, channeldc, prefix, selector, args, config) {
const listed = await fileList(absolutePath)
if (discord) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Songs')
.setDescription(listed.join(', '))
@ -145,7 +145,7 @@ async function list (bot, discord, channeldc, prefix, selector, args, config) {
bot.tellraw(selector, message)
} catch (e) {
if (discord) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e.toString()}\`\`\``)
@ -274,7 +274,7 @@ module.exports = {
break
case 'stop':
try {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Stop')
.setDescription('Cleared the song queue')
@ -286,7 +286,7 @@ module.exports = {
break
case 'skip':
try {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Skip')
.setDescription(`Skipping ${bot.music.song.name}`)
@ -300,7 +300,7 @@ module.exports = {
switch (args[1]) {
case 'off':
bot.music.loop = 0
Embed = new MessageEmbed()
Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Loop')
.setDescription('Looping is now disabled')
@ -308,7 +308,7 @@ module.exports = {
break
case 'current':
bot.music.loop = 1
Embed = new MessageEmbed()
Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Loop')
.setDescription(`Now looping ${song.name}`)
@ -316,7 +316,7 @@ module.exports = {
break
case 'all':
bot.music.loop = 2
Embed = new MessageEmbed()
Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Loop')
.setDescription('Now looping every song in the queue')
@ -328,7 +328,7 @@ module.exports = {
list(bot, true, channeldc, prefix, '@a', args, config)
break
case 'nowplaying':
Embed = new MessageEmbed()
Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Now playing')
.setDescription(`Now playing ${bot.music.song.name}`)
@ -337,7 +337,7 @@ module.exports = {
case 'queue':
const queueWithName = []
bot.music.queue.forEach((song) => queueWithName.push(song.name))
Embed = new MessageEmbed()
Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Queue')
.setDescription(queueWithName.join(', '))

View file

@ -1,7 +1,7 @@
/* eslint-disable no-eval */
const util = require('util')
const { stylize } = require('../util/colors/minecraft')
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'servereval',
alias: [],
@ -17,13 +17,13 @@ module.exports = {
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
try {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(util.inspect(eval(args.join(' '))))
channeldc.send({ embeds: [Embed] })
} catch (err) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${util.inspect(err).replaceAll('runner', 'chayapak1')}\`\`\``)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'test',
alias: [],
@ -26,7 +26,7 @@ module.exports = {
])
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Hello!')
.setDescription('This is the first ever command to be discordified!' + '\n' + `More info: Username: ${username}, Prefix: ${prefix}, Args: ${args.join(' ')}`)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
const moment = require('moment-timezone')
module.exports = {
name: 'time',
@ -23,7 +23,7 @@ module.exports = {
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
const description = `The current date and time for the timezone ${timezone} is: ${momented}`
if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Time')
.setDescription(description)
@ -31,7 +31,7 @@ module.exports = {
} else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) {
throw new SyntaxError('Invalid timezone')
} else {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Time')
.setDescription(description)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
const translate = require('@vitalets/google-translate-api')
module.exports = {
name: 'translate',
@ -17,13 +17,13 @@ module.exports = {
discordExecute: async function (bot, username, sender, prefix, args, channeldc, message, config) {
try {
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Result')
.setDescription(res.text)
channeldc.send({ embeds: [Embed] })
} catch (e) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e}\`\`\``)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
const moment = require('moment-timezone')
module.exports = {
name: 'uptime',
@ -12,7 +12,7 @@ module.exports = {
},
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
const time = moment.utc(Math.floor(performance.now())).format('H [hours], m [minutes], s [seconds]')
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Bot\'s Uptime')
.setDescription(`The bot's uptime is ${time}`)

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'uuid',
alias: [],
@ -68,13 +68,13 @@ module.exports = {
const player = bot.players.list.find((user) => user.name === playername)
if (!player) throw new SyntaxError('Invalid username')
const playerUUID = player.UUID
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('UUID')
.setDescription(`${playername}'s UUID: ${playerUUID}`)
channeldc.send({ embeds: [Embed] })
} else {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription('No player name specified')

View file

@ -1,6 +1,6 @@
const wiki = require('wikipedia')
const util = require('util')
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
module.exports = {
name: 'wikipedia',
alias: ['wiki'],
@ -20,13 +20,13 @@ module.exports = {
try {
const page = await wiki.page(args.join(' '))
const summary = await page.summary()
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal)
.setTitle('Output')
.setDescription(summary.extract)
channeldc.send({ embeds: [Embed] })
} catch (e) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${util.inspect(e)}\`\`\``)

View file

@ -3,14 +3,10 @@ const { stdin: input, stdout: output } = require('node:process')
const rl = readline.createInterface({ input, output })
const config = require('./config')
const { createBot } = require('./bot')
const {
Client,
Intents
} = require('discord.js')
const intents = new Intents(['GUILDS', 'GUILD_MESSAGES'])
const dcclient = new Client({
intents
})
const { Client, GatewayIntentBits } = require('discord.js')
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits
const dcclient = new Client({ intents: [Guilds, GuildMessages, MessageContent] })
let bots = []

View file

@ -12,14 +12,14 @@
"license": "ISC",
"dependencies": {
"@tonejs/midi": "^2.0.28",
"@vitalets/google-translate-api": "^8.0.0",
"axios": "^0.27.2",
"@vitalets/google-translate-api": "^9.0.0",
"axios": "^1.2.1",
"color-convert": "^2.0.1",
"cowsay2": "^2.0.4",
"discord.js": "^13.7.0",
"discord.js": "^14.7.1",
"minecraft-data": "^3.11.0",
"minecraft-protocol": "^1.36.1",
"mineflayer": "^4.3.0",
"minecraft-protocol": "^1.26.5",
"mineflayer": "^4.0.0",
"moment-timezone": "^0.5.34",
"prismarine-chat": "^1.7.2",
"prismarine-nbt": "^2.2.1",
@ -27,7 +27,7 @@
"sharp": "^0.31.1",
"sleep-promise": "^9.1.0",
"urban-dictionary": "^3.0.2",
"uuid-by-string": "^3.0.7",
"uuid-by-string": "^4.0.0",
"vec3": "^0.1.7",
"vm2": "^3.9.11",
"wikipedia": "^1.1.9"

View file

@ -1,6 +1,6 @@
const path = require('path')
const { MessageEmbed } = require('discord.js')
const { EmbedBuilder } = require('discord.js')
function inject (bot, dcclient, config) {
const loadFiles = require('../util/load_files')
const channeldc = dcclient.channels.cache.get(config.discord.servers[bot.options.host])
@ -45,7 +45,7 @@ function inject (bot, dcclient, config) {
}
} catch (e) {
if (prefix === config.discord.prefix) {
const Embed = new MessageEmbed()
const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error)
.setTitle('Error')
.setDescription(`\`\`\`${e}\`\`\``)