Update to make it work on discord.js v13

* Use intents
* Use messageCreate instead of message
* Update sending embeds for v13
* Fix getNickname for v13
* Fix user presence
* guild.member to guild.members.cache.get
* Fix userinfo (+ some other minor changes)
This commit is contained in:
SileNce5k 2021-08-09 18:12:56 +02:00
parent 2ac01e2ce1
commit 1ea4892167
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
11 changed files with 299 additions and 141 deletions

View file

@ -18,7 +18,7 @@ module.exports = {
name: "General info", value: `Name: ${client.user.username}\nPrefix: ${prefix}\nTotal Servers: ${guildCount}\nCreation Date: ${getCreationDate(client)}\nSource: [Click Here](https://github.com/SileNce5k/discord_bot)`,
},)
message.channel.send(embed)
message.channel.send({embeds :[embed]})
}
};

View file

@ -64,7 +64,7 @@ module.exports = {
{ name: "General", value: commands },
)
if(noHelp == 0)
message.channel.send(embed);
message.channel.send({embeds :[embed]});
else
message.channel.send("Either there is no command with that name, or there is no specific help for it.")
},

View file

@ -1,22 +1,22 @@
const Discord = require('discord.js')
const Discord = require('discord.js');
const convertDateToISOString = require('../../util/convertDateToISOString');
module.exports = {
name: 'serverinfo',
description: 'Displays information about the server',
execute({message}) {
console.log(message.guild.emojis.cache)
const embed = new Discord.MessageEmbed()
.setThumbnail(message.guild.iconURL({ format: 'png', dynamic: true, size: 4096 }))
.setColor("#ee7939")
.setTimestamp()
.addField("Server Owner: ", `<@${message.guild.ownerID}>`)
.addField("Server Owner: ", `<@${message.guild.ownerId}>`)
.addField("Server Name: ", message.guild.name)
.addField("Created", message.guild.createdAt.toUTCString())
.addField("Members: ", message.guild.memberCount)
.addField("Created", convertDateToISOString(message.guild.createdAt))
.addField("Members: ", message.guild.memberCount.toString())
//.addField("Emojis: ", message.guild.emojis.cache.array().length)
message.channel.send(embed);
message.channel.send({embeds :[embed]});
}

View file

@ -31,8 +31,7 @@ module.exports = {
}
let presenceDetails = 0;
let isPresence = false;
if(user.user.presence.activities.length != 0){
if(user.presence.activities.length != 0){
presenceDetails = morePresence(user);
isPresence = true;
}
@ -47,9 +46,9 @@ module.exports = {
.setTimestamp()
.setAuthor(user.user.username, user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
.addField("Username", `**${user.user.username}#${user.user.discriminator}**${nickname}`)
.addField("Status", user.user.presence.status.charAt(0).toUpperCase()+user.user.presence.status.slice(1), true)
.addField("Status", user.presence.status.charAt(0).toUpperCase()+user.presence.status.slice(1), true)
if(isPresence)
embed.addField("Presence", user.user.presence.activities[0].name, true)
embed.addField("Presence", user.presence.activities[0].name, true)
if(presenceDetails != 0)
embed.addField("Details", presenceDetails, false)
embed.addField("Creation date", getCreationDate(user), true)
@ -58,6 +57,6 @@ module.exports = {
embed.addField("Roles", roles)
}
message.channel.send(embed);
message.channel.send({embeds :[embed]});
}
};

View file

@ -26,6 +26,7 @@ module.exports = {
if (args){
let customName = args[1];
let customMessage = args.slice(2, args.length).join(" ");
const isEmbed = false;
switch (args[0].toLowerCase()) {
case "add":
if(!customMessage) {
@ -60,6 +61,7 @@ module.exports = {
{ name: "Custom commands", value: sendText },
)
sendText = embed
isEmbed = true;
}else sendText = "NO CUSTOM COMMANDS"
break;
case "variables":
@ -83,7 +85,7 @@ module.exports = {
break;
}
}
message.channel.send(sendText);
if(isEmbed) message.channeel.send({embeds :[sendText]})
else message.channel.send(sendText);
}
};