Quick and dirty update to discord.js v13

This commit is contained in:
Nathaniel Mason 2022-04-21 17:29:04 +01:00
parent 05ed4d9c5c
commit 2189417343
28 changed files with 63 additions and 59 deletions

View File

@ -12,7 +12,7 @@ module.exports = {
if (!question) {
await message.channel.send(client.generateErrorMessage("You need to ask a question!", message.author.displayAvatarURL));
} else {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": ":8ball: 8Ball",
"description": `Your amazing question: **${question}**`,
"color": 9442302,
@ -26,7 +26,7 @@ module.exports = {
"value": `${answer}`
}
]
}});
}]});
}
}
}

View File

@ -6,7 +6,7 @@ module.exports = {
async execute(client, message, args, config) {
const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author;
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": `:frame_photo: ${user.username}'s Beautiful Avatar!`,
"color": 9442302,
"footer": {
@ -16,6 +16,6 @@ module.exports = {
"image": {
"url": user.displayAvatarURL()
}
}});
}]});
}
}

View File

@ -9,7 +9,7 @@ module.exports = {
if(!taggedUser) {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<a:SylvBonk:801185845847130113> Bonk",
"description": `${taggedUser} You have been bonked by ${message.author}!`,
"color": 9442302,
@ -20,7 +20,7 @@ module.exports = {
"image": {
"url": "https://cdn.discordapp.com/attachments/793537380330111028/801194481549312060/HappyBONK.gif"
}
}});
}]});
}
}
}

View File

@ -9,7 +9,7 @@ module.exports = {
if(!taggedUser) {
await message.channel.send("*slams cheese on desk*\n**Cheese.** https://www.youtube.com/watch?v=Or4IE8fkpn4");
} else {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": ":cheese: Cheesed",
"description": `${taggedUser} You have been cheesed by ${message.author}!`,
"color": 16312092,
@ -20,7 +20,7 @@ module.exports = {
"image": {
"url": "https://cdn.discordapp.com/attachments/803658122299572255/812867714368536636/R06325af354168febcafd96b8328b7590.png"
}
}});
}]});
}
}
}

View File

@ -12,7 +12,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to provide some input!", message.author.displayAvatarURL()));
} else {
const answer = options[Math.floor(Math.random() * options.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "I have made my decision:",
"description": answer,
"color": 8311585,
@ -20,7 +20,7 @@ module.exports = {
"icon_url": message.author.displayAvatarURL(),
"text": config.footerTxt
},
}});
}]});
}
}
}

View File

@ -18,7 +18,7 @@ module.exports = {
if(!taggedUser) {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": ":heart: Cuddle",
"description": `${taggedUser} You have been cuddled by ${message.author}!`,
"color": 9442302,
@ -29,7 +29,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -12,7 +12,7 @@ module.exports = {
const evaled = inspect(eval(code));
await message.channel.send(evaled, {code:"xl"});
} catch (error) {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:AnitroxError:809651936563429416> **Something went wrong! **",
"color": 13632027,
"footer": {
@ -29,7 +29,7 @@ module.exports = {
"value": error.message
}
]
}});
}]});
}
};
}

View File

@ -5,7 +5,7 @@ module.exports = {
syntax: '<Command>',
async execute(_0, message, _1, config) {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "HELP! SEYMOUR! THE BOT IS ON FIRE!",
"description": "Get help on anything from commands, to what the bot does! just not your homework..",
"color": 9442302,
@ -23,6 +23,6 @@ module.exports = {
"value": "Join the [support server!](https://discord.gg/grebRGsBZ3)"
}
]
}});
}]});
}
}

View File

@ -18,7 +18,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<a:ABlobCatHuggle:801232248035999784> Hug",
"description": `${taggedUser} You have been hugged by ${message.author}!`,
"color": 8311585,
@ -29,7 +29,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -24,7 +24,7 @@ module.exports = {
const osu = require('node-os-utils');
const cpu = osu.cpu;
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:AnitroxInfo:809651936831733791> Information about Anitrox",
"description": "Everything you've ever wanted to know about your favorite bot, Anitrox!",
"color": 9442302,
@ -102,6 +102,6 @@ module.exports = {
}
]
}});
}]});
}
};

View File

@ -5,7 +5,7 @@ module.exports = {
syntax: [],
async execute(_0, message, _1, config) {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "Add Anitrox to your Server!",
"description": "Weather you want stable, or that squeaky clean fresh PTB build, we gotchu.",
"color": 9442302,
@ -30,6 +30,6 @@ module.exports = {
"value": "Come join the Anitrox Support Server, for support and much more!\n [Anitrox Support Server](https://discord.gg/grebRGsBZ3)"
}
]
}});
}]});
},
};

View File

@ -18,7 +18,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": ":heart: Kiss",
"description": `${taggedUser} You have been kissed by ${message.author}!`,
"color": 9442302,
@ -29,7 +29,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -28,7 +28,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": ":heart: <:lesbian:803831629428686849> Kiss",
"description": `${taggedUser} You have been kissed by ${message.author}!`,
"color": 8311585,
@ -39,7 +39,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -17,7 +17,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<a:LeafeonLick:806396195089154058> Lick",
"description": `${taggedUser} You have been licked by ${message.author}!`,
"color": 8311585,
@ -28,7 +28,7 @@ module.exports = {
"image": {
"url": "https://cdn.discordapp.com/attachments/803658122299572255/805314244123951114/cef569820773b0f5d54ee34cfa18e1f8.gif"
}
}});
}]});
}
}
}

View File

@ -17,7 +17,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:BlobNomBlob:801241117919805510> Nom",
"description": `${taggedUser} You have been nommed by ${message.author}!`,
"color": 8311585,
@ -28,7 +28,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -4,7 +4,7 @@ module.exports = {
description: 'Attributions to open source components used by Anitrox',
async execute(_0, message, _1, config){
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "Component Attribution",
"description": "Some parts of Anitrox are using open source code, and their attributions are avaliable here!",
"color": 52508,
@ -29,6 +29,6 @@ module.exports = {
"value": "Using and supporting the Anitrox Project, thank you! ❤"
}
]
}});
}]});
}
}

View File

@ -16,7 +16,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:pats:801238281286713355> Pat",
"description": `${taggedUser} You have been patted by ${message.author}!`,
"color": 8311585,
@ -27,7 +27,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -7,7 +7,7 @@ module.exports = {
const index = Math.floor(Math.random() * config.locations.length);
const location = config.locations[index]
await message.channel.send({embed:{
await message.channel.send({embeds:[{
"title": ":ping_pong: Ping",
"description": `**Pong!** We pinged **${location}** and got ${client.ws.ping} ms.`,
"color": 9442302,
@ -15,6 +15,6 @@ module.exports = {
"icon_url": message.author.displayAvatarURL(),
"text": config.footerTxt
}
}});
}]});
}
};

View File

@ -16,7 +16,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "👉 Poke!",
"description": `${taggedUser} You have been poked by ${message.author}!`,
"color": 8311585,
@ -27,7 +27,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -31,7 +31,7 @@ module.exports = {
});
} else {
message.channel.send({embed: {
message.channel.send({embeds: [{
"title": "<:AnitroxDenied:809651936642203668> **403 Forbidden**",
"color": 13632027,
"footer": {
@ -44,7 +44,7 @@ module.exports = {
"value": "You don't have the appropriate permissions to run this command!"
}
]
}});
}]});
}
}
};

View File

@ -8,7 +8,7 @@ module.exports = {
const newnick = args.slice(0).join(" ")
try {
await message.member.setNickname(newnick, "Nickname change requested by the server member. If you don't want users to be able to change their nickname disable 'CHANGE_NICKNAME' via Change Nickname in Roles.")
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:AnitroxSuccess:809651936819019796> Nickname Changed",
"color": 9442302,
"footer": {
@ -26,7 +26,7 @@ module.exports = {
"inline": true
}
]
}});
}]});
} catch (error) {
await message.channel.send(client.generateErrorMessage("Failed to set user nickname. Does the bot have the correct permissions?", message.author.displayAvatarURL()));
};

View File

@ -9,7 +9,7 @@ module.exports = {
if(!taggedUser) {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": ":anger: Slap",
"description": `${taggedUser} You have been slapped by ${message.author}!`,
"color": 9442302,
@ -20,7 +20,7 @@ module.exports = {
"image": {
"url": "https://media1.tenor.com/images/b6d8a83eb652a30b95e87cf96a21e007/tenor.gif?itemid=10426943"
}
}});
}]});
}
}
}

View File

@ -17,7 +17,7 @@ module.exports = {
await message.channel.send(client.generateErrorMessage("You need to @mention a user!", message.author.displayAvatarURL()));
} else {
const gif = gifchoices[Math.floor(Math.random() * gifchoices.length)];
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:BlobSnuggleCat:806759753450782731> Snuggle",
"description": `${taggedUser} You have been snuggled by ${message.author}!`,
"color": 9442302,
@ -28,7 +28,7 @@ module.exports = {
"image": {
"url": gif
}
}});
}]});
}
}
}

View File

@ -5,7 +5,7 @@ module.exports = {
async execute(_0, message, _1, config) {
if (message.author.id == config.ownerID) {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<a:AnitroxWorking:697147309531594843> **Shutting Down...**",
"description": "See you next time!",
"color": 9442302,
@ -13,11 +13,11 @@ module.exports = {
"icon_url": message.author.displayAvatarURL(),
"text": config.footerTxt
},
}});
}]});
console.log("The bot is shutting down! Bye bye!")
process.exit();
} else {
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": "<:AnitroxDenied:809651936642203668> 403 Forbidden",
"description": "You need to be the bot owner to execute this command!",
"color": 13632027,
@ -25,7 +25,7 @@ module.exports = {
"icon_url": message.author.displayAvatarURL(),
"text": config.footerTxt
},
}});
}]});
}
}
}

View File

@ -7,7 +7,7 @@ module.exports = {
async execute(client, message, args, config) {
const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author
await message.channel.send({embed: {
await message.channel.send({embeds: [{
"title": `Everything you've ever wanted to know about ${user.username}!`,
"color": 9442302,
"footer": {
@ -52,6 +52,6 @@ module.exports = {
inline: true
},
]
}});
}]});
}
}

View File

@ -53,5 +53,9 @@
"Go for it! :smile:",
"Good idea!",
"Sure"
],
"intents": [
"GUILDS",
"GUILD_MESSAGES"
]
}

View File

@ -4,7 +4,7 @@
"description": "Discord Bot Based on Discord.JS",
"main": "start.js",
"dependencies": {
"discord.js": "^12.5.1",
"discord.js": "^13.6.0",
"node-os-utils": "^1.3.2",
"require-all": "^3.0.0"
},

View File

@ -4,7 +4,7 @@ const fs = require('fs');
const Discord = require('discord.js');
const config = require('./config.json');
console.log('Starting!')
const client = new Discord.Client();
const client = new Discord.Client({ intents: config.intents.map(intent => eval(`Discord.Intents.FLAGS.${intent}`))});
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
@ -14,7 +14,7 @@ for (const file of commandFiles) {
client.commands.set(command.name, command);
}
client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: {
client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embeds: [{
"title": "<:AnitroxError:809651936563429416> Error",
"color": 13632027,
"footer": {
@ -27,7 +27,7 @@ client.generateErrorMessage = (errorMsg, messageAuthorURL) => ({embed: {
"value": errorMsg
}
]
}})
}]})
client.on("error", (e) => console.log(`[ERROR] ${error(e)}`));
client.on("warn", (e) => (`[WARN] ${warn(e)}`));
@ -51,7 +51,7 @@ client.once('ready', () => {
// Begin Command Handler
client.on('message', async (message) => {
client.on('messageCreate', async (message) => {
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
@ -64,7 +64,7 @@ client.on('message', async (message) => {
await client.commands.get(command).execute(client, message, args, config);
} catch (error) {
console.stack;
message.channel.send({embed: {
message.channel.send({embeds: [{
"title": "<:AnitroxError:809651936563429416> **Something went wrong!**",
"description": error.stack,
"color": 13632027,
@ -72,7 +72,7 @@ client.on('message', async (message) => {
"icon_url": message.author.displayAvatarURL(),
"text": config.footerTxt
},
}});
}]});
}
});