Update discord.js dependency to version 14 (#116)

* Update discord.js in package.json to v14.16.3 & update package-lock.json

* Update all embeds to work with v14

* Do not show discriminator if it is 0
This commit is contained in:
SileNce5k 2024-10-22 07:36:10 +02:00
parent c751a5aec2
commit 062e6d43dc
Signed by: SileNce
GPG key ID: B0A142BB4291B204
14 changed files with 1306 additions and 2437 deletions

View file

@ -19,13 +19,22 @@ module.exports = {
switch (presenceType) { switch (presenceType) {
case "PLAY": case "PLAY":
presenceType = "PLAYING"; presenceType = 0;
break; break;
case "LISTEN": case "LISTEN":
presenceType = "LISTENING"; presenceType = 2;
break; break;
case "WATCH": case "WATCH":
presenceType = "WATCHING"; presenceType = 3;
break;
case "CUSTOM":
presenceType = 4;
break;
case "COMPETING":
presenceType = 5;
break;
case "STREAM":
presenceType = 1;
break; break;
default: default:
presenceType = "INVALID"; presenceType = "INVALID";

View file

@ -1,24 +1,24 @@
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
const getCreationDate = require('../../util/getCreationDate'); const getCreationDate = require('../../util/getCreationDate');
const getGuildCount = require('../../util/getGuildCount'); const getGuildCount = require('../../util/getGuildCount');
module.exports = { module.exports = {
name: 'botinfo', name: 'botinfo',
description: 'Shows information about the bot', description: 'Shows information about the bot',
execute({message, client, prefix}) { execute({message, client, prefix}) {
let guildCount = getGuildCount(client) let guildCount = getGuildCount(client)
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setColor(15780145) .setColor(15780145)
.setTitle("Information about bot") .setTitle("Information about bot")
.setTimestamp() .setTimestamp()
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 })) .setAuthor({name: client.user.username, iconURL: client.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })})
.addFields({ .addFields({
name: "General info", value: `Name: ${client.user.username}\nPrefix: ${prefix}\nTotal Servers: ${guildCount}\nTotal Commands: ${client.commands.size}\nCreation Date: ${getCreationDate(client)}\nSource: [Click Here](https://github.com/SileNce5k/discord_bot)`, name: "General info", value: `Name: ${client.user.username}\nPrefix: ${prefix}\nTotal Servers: ${guildCount}\nTotal Commands: ${client.commands.size}\nCreation Date: ${getCreationDate(client)}\nSource: [Click Here](https://github.com/SileNce5k/discord_bot)`,
},) },)
message.channel.send({embeds :[embed]}) message.channel.send({embeds :[embed]})
} }
}; };

View file

@ -1,97 +1,97 @@
const fs = require('fs'); const fs = require('fs');
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
const getSubdirFiles = require('../../util/getSubdirFiles'); const getSubdirFiles = require('../../util/getSubdirFiles');
module.exports = { module.exports = {
name: 'help', name: 'help',
description: 'List all available commands.', description: 'List all available commands.',
moreHelp: ["Examples:","`<prefix>help [optional_page]` will return help with a small description for each command", moreHelp: ["Examples:","`<prefix>help [optional_page]` will return help with a small description for each command",
"`<prefix>help <another_command>` will return help with a more descriptive description", "`<prefix>help <another_command>` will return help with a more descriptive description",
"The descriptive description isn't available on all commands", "The descriptive description isn't available on all commands",
"`<prefix>help netmodules` to display help for netmodules" "`<prefix>help netmodules` to display help for netmodules"
], ],
execute({ message, args, prefix, client }) { execute({ message, args, prefix, client }) {
let commands = "" let commands = ""
let commandFiles = getSubdirFiles('commands/') let commandFiles = getSubdirFiles('commands/')
let x = false; let x = false;
let fieldName = `Page [[page]]/${Math.round(client.commands.size / 10)}`; let fieldName = `Page [[page]]/${Math.round(client.commands.size / 10)}`;
let iteration = 0; let iteration = 0;
let num_in_args = false; let num_in_args = false;
let added_commands = 0; let added_commands = 0;
let page = -1; let page = -1;
if (args[0] == "netmodules") { if (args[0] == "netmodules") {
commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js')); commandFiles = fs.readdirSync('../../netload').filter(file => file.endsWith('.js'));
if (commandFiles.length == 0) { if (commandFiles.length == 0) {
message.channel.send("There are no netmodules currently loaded.") message.channel.send("There are no netmodules currently loaded.")
x = true; x = true;
} }
}else if(!isNaN(parseInt(args[0])) && parseInt(args[0])){ }else if(!isNaN(parseInt(args[0])) && parseInt(args[0])){
num_in_args = true; num_in_args = true;
iteration = ( parseInt(args[0]) - 1) * 10; iteration = ( parseInt(args[0]) - 1) * 10;
page = Math.round(parseInt(args[0])) page = Math.round(parseInt(args[0]))
} }
if(page === -1){ if(page === -1){
page = 1; page = 1;
} }
fieldName = fieldName.replace("[[page]]", page); fieldName = fieldName.replace("[[page]]", page);
const max_commands = iteration + 10; const max_commands = iteration + 10;
if (x) return; if (x) return;
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setColor(15780145) .setColor(15780145)
.setTitle("Commands") .setTitle("Commands")
.setTimestamp() .setTimestamp()
.setAuthor(client.user.username, client.user.avatarURL({ dynamic: true, size: 4096 })) .setAuthor({name: client.user.username, iconURL: client.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })})
let start = 0; let start = 0;
for (const file of commandFiles) { for (const file of commandFiles) {
if(iteration >= max_commands) break; if(iteration >= max_commands) break;
const command = require(`../../${file}`); const command = require(`../../${file}`);
if(command.disabled) continue; if(command.disabled) continue;
if (args[0] == "admin") { if (args[0] == "admin") {
if (command.admin) if (command.admin)
commands = commands + `${prefix}${command.name} | ${command.description}\n` commands = commands + `${prefix}${command.name} | ${command.description}\n`
}else if(!args[0] || num_in_args){ }else if(!args[0] || num_in_args){
if (!command.admin){ if (!command.admin){
if(start < iteration){ if(start < iteration){
}else{ }else{
added_commands++ added_commands++
commands = commands + `${prefix}${command.name} | ${command.description}\n`; commands = commands + `${prefix}${command.name} | ${command.description}\n`;
iteration++ iteration++
} }
start++; start++;
} }
}else if(args[0] === command.name){ }else if(args[0] === command.name){
commands = commands + `${prefix}${command.name}\n` commands = commands + `${prefix}${command.name}\n`
embed.setTitle(command.name.charAt(0).toUpperCase() + command.name.slice(1)) embed.setTitle(command.name.charAt(0).toUpperCase() + command.name.slice(1))
if(command.moreHelp){ if(command.moreHelp){
command.moreHelp.forEach(element => { command.moreHelp.forEach(element => {
commands = commands + `${element}\n` commands = commands + `${element}\n`
}); });
} else { } else {
fieldName = "Description"; fieldName = "Description";
commands = commands + `${command.description}`; commands = commands + `${command.description}`;
} }
break; break;
} }
} }
if(commands === ""){ if(commands === ""){
fieldName = "Command not found"; fieldName = "Command not found";
commands = "No command with that name found." commands = "No command with that name found."
} }
let regex = /<prefix>/g; let regex = /<prefix>/g;
commands = commands.replace(regex, prefix) commands = commands.replace(regex, prefix)
embed.addFields( embed.addFields(
{ name: fieldName, value: commands }, { name: fieldName, value: commands },
) )
if(embed.fields[0].value.length > 1023){ if(embed.data.fields[0].value.length > 1023){
message.channel.send(`There are more than 1023 characters`) message.channel.send(`There are more than 1023 characters`)
}else { }else {
message.channel.send({embeds :[embed]}); message.channel.send({embeds :[embed]});
} }
}, },
}; };

View file

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

View file

@ -1,4 +1,4 @@
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
const getCreationDate = require('../../util/getCreationDate.js'); const getCreationDate = require('../../util/getCreationDate.js');
const getJoinDate = require('../../util/getJoinDate.js'); const getJoinDate = require('../../util/getJoinDate.js');
const getNickname = require('../../util/getNickname.js'); const getNickname = require('../../util/getNickname.js');
@ -39,7 +39,8 @@ module.exports = {
} }
status = user.presence.status.charAt(0).toUpperCase()+user.presence.status.slice(1) status = user.presence.status.charAt(0).toUpperCase()+user.presence.status.slice(1)
} }
if(status === "Dnd") status = "Do Not Disturb";
let roles = ""; let roles = "";
user.roles.cache.each(role => { user.roles.cache.each(role => {
if (role.name != "@everyone") if (role.name != "@everyone")
@ -48,23 +49,32 @@ module.exports = {
let discriminator = user.user.discriminator; let discriminator = user.user.discriminator;
if(discriminator === "0") if(discriminator === "0")
discriminator = ""; discriminator = "";
let username = `**${user.user.username}#${user.user.discriminator}**${nickname}` else
const embed = new Discord.MessageEmbed() discriminator = `#${discriminator}`;
let username = `**${user.user.username}${discriminator}**${nickname}`;
const embed = new EmbedBuilder()
.setThumbnail(user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })) .setThumbnail(user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 }))
.setColor(roleColor) .setColor(roleColor)
.setTimestamp() .setTimestamp()
.setAuthor(user.user.username, user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })) .setAuthor({name: user.user.username, iconURL: user.user.avatarURL({ format: 'png', dynamic: true, size: 2048 })})
.addField("Username", username) .addFields([
.addField("Status", status, false) { name: "Username", value: username, inline: false },
if(isPresence) ]);
embed.addField("Presence", user.presence.activities[0].name, false) if (isPresence)
if(presenceDetails != 0) embed.addFields([{name: "Presence", value: user.presence.activities[0].name, inline: false}])
embed.addField("Details", presenceDetails.toString(), false) if (presenceDetails != 0){
embed.addField("Creation date", getCreationDate(user), true) embed.addFields([{name: "Details", value: presenceDetails.toString(), inline: false}])
embed.addField("Join date", getJoinDate(user, message.guild), true) embed.addFields([{name: "Status", value: status, inline: true }])
if(roles != ""){ }
embed.addField("Roles", roles) else
} embed.addFields([{ name: "Status", value: status, inline: false }])
embed.addFields([
{ name: "Creation date", value: getCreationDate(user), inline: true },
{ name: "Join date", value: getJoinDate(user, message.guild), inline: true }
])
if (roles != "") {
embed.addFields({name: "Roles", value: roles, inline: false})
}
message.channel.send({embeds :[embed]}); message.channel.send({embeds :[embed]});
} }

View file

@ -1,97 +1,97 @@
const addCustomCommand = require("../../util/custom_commands/addCustomCommand"); const addCustomCommand = require("../../util/custom_commands/addCustomCommand");
const deleteCustomCommand = require("../../util/custom_commands/deleteCustomCommand"); const deleteCustomCommand = require("../../util/custom_commands/deleteCustomCommand");
const getAllCustomCommands = require("../../util/custom_commands/getAllCustomCommands"); const getAllCustomCommands = require("../../util/custom_commands/getAllCustomCommands");
const getOwnerOfCustomCommand = require("../../util/custom_commands/getOwnerOfCustomCommand"); const getOwnerOfCustomCommand = require("../../util/custom_commands/getOwnerOfCustomCommand");
const renameCustomCommand = require("../../util/custom_commands/renameCustomCommand"); const renameCustomCommand = require("../../util/custom_commands/renameCustomCommand");
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
const fs = require('fs'); const fs = require('fs');
const editCustomCommand = require("../../util/custom_commands/editCustomCommand"); const editCustomCommand = require("../../util/custom_commands/editCustomCommand");
module.exports = { module.exports = {
name: 'custom', name: 'custom',
description: "Manage custom commands, see <prefix>help custom for more", description: "Manage custom commands, see <prefix>help custom for more",
moreHelp: ["<prefix>custom add - Add new custom commands", moreHelp: ["<prefix>custom add - Add new custom commands",
"<prefix>custom edit - Edit an existing command that you own", "<prefix>custom edit - Edit an existing command that you own",
"<prefix>custom rename - Rename an existing command that you own", "<prefix>custom rename - Rename an existing command that you own",
"<prefix>custom show - Show custom message unformatted.", "<prefix>custom show - Show custom message unformatted.",
"<prefix>custom remove - Delete your custom commands.", "<prefix>custom remove - Delete your custom commands.",
"<prefix>custom owner - check owner of custom command", "<prefix>custom owner - check owner of custom command",
"<prefix>custom list - list all custom commands", "<prefix>custom list - list all custom commands",
"<prefix>custom variables - list all variables you can use" "<prefix>custom variables - list all variables you can use"
], ],
execute({message, args, client, prefix, owners}) { execute({message, args, client, prefix, owners}) {
const customPath = 'data/customCommands.json'; const customPath = 'data/customCommands.json';
if(!fs.existsSync(customPath)){ if(!fs.existsSync(customPath)){
fs.writeFileSync(customPath,"[]") fs.writeFileSync(customPath,"[]")
} }
let sendText; let sendText;
let isEmbed = false; let isEmbed = false;
if (args){ if (args){
let customName = args[1]; let customName = args[1];
let customMessage = args.slice(2, args.length).join(" "); let customMessage = args.slice(2, args.length).join(" ");
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "add": case "add":
if(!customMessage) { if(!customMessage) {
message.channel.send("Message can't be empty"); message.channel.send("Message can't be empty");
return; return;
} }
sendText = addCustomCommand(customName, customMessage, message.author.id); sendText = addCustomCommand(customName, customMessage, message.author.id);
break; break;
case "remove": case "remove":
case "delete": case "delete":
sendText = deleteCustomCommand(customName, message.author.id, owners); sendText = deleteCustomCommand(customName, message.author.id, owners);
break; break;
case "owner": case "owner":
let author = getOwnerOfCustomCommand(customName); let author = getOwnerOfCustomCommand(customName);
let user; let user;
if(!author) if(!author)
sendText = `${customName} does not exist` sendText = `${customName} does not exist`
else{ else{
client.guilds.cache.each(guild => { client.guilds.cache.each(guild => {
user = guild.members.cache.get(author); user = guild.members.cache.get(author);
}); });
sendText = `The owner of ${customName} is ${user.user.username} (id: ${user.user.id}).` sendText = `The owner of ${customName} is ${user.user.username} (id: ${user.user.id}).`
} }
break; break;
case "list": case "list":
const embed = new Discord.MessageEmbed(); const embed = new EmbedBuilder();
sendText = getAllCustomCommands(); sendText = getAllCustomCommands();
if(sendText != ""){ if(sendText != ""){
embed.setColor(15780145) embed.setColor(15780145)
embed.addFields( embed.addFields(
{ name: "Custom commands", value: sendText }, { name: "Custom commands", value: sendText },
) )
sendText = embed sendText = embed
isEmbed = true; isEmbed = true;
}else sendText = "NO CUSTOM COMMANDS" }else sendText = "NO CUSTOM COMMANDS"
break; break;
case "variables": case "variables":
sendText = "The variables you can use are:\n<prefix>\n<globalPrefix>\n<username>\n<nickname>\n<user_id>\n<guild_name>\n<guild_id>" sendText = "The variables you can use are:\n<prefix>\n<globalPrefix>\n<username>\n<nickname>\n<user_id>\n<guild_name>\n<guild_id>"
break; break;
case "edit": case "edit":
sendText = editCustomCommand(customName, message.author.id, customMessage) sendText = editCustomCommand(customName, message.author.id, customMessage)
break; break;
case "show": case "show":
let json = fs.readFileSync(customPath, 'utf8'); let json = fs.readFileSync(customPath, 'utf8');
let customCommands = JSON.parse(json) let customCommands = JSON.parse(json)
sendText = "Command not found." sendText = "Command not found."
customCommands.forEach(function (customCommand) { customCommands.forEach(function (customCommand) {
if (customCommand.customName === customName) { if (customCommand.customName === customName) {
sendText = `\`\`\`\n${customCommand.customMessage}\n\`\`\`` sendText = `\`\`\`\n${customCommand.customMessage}\n\`\`\``
} }
}); });
break; break;
case "rename": case "rename":
sendText = renameCustomCommand(customName, args[2], message.author.id); sendText = renameCustomCommand(customName, args[2], message.author.id);
break; break;
default: default:
sendText = `Argument not recognized.\n"${prefix}help custom" to see all arguments you can use.` sendText = `Argument not recognized.\n"${prefix}help custom" to see all arguments you can use.`
break; break;
} }
} }
if(isEmbed) message.channel.send({embeds :[sendText]}) if(isEmbed) message.channel.send({embeds :[sendText]})
else message.channel.send(sendText); else message.channel.send(sendText);
} }
}; };

3166
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
"main": "server.js", "main": "server.js",
"dependencies": { "dependencies": {
"@zuzak/owo": "^1.14.1", "@zuzak/owo": "^1.14.1",
"discord.js": "^13.6.0", "discord.js": "^14.16.3",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"express": "^4.21.1", "express": "^4.21.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",

View file

@ -20,8 +20,13 @@ const createDatabaseTables = require('./server/createDatabaseTables');
const createLastfmTable = require('./server/createLastfmTable'); const createLastfmTable = require('./server/createLastfmTable');
createLastfmTable(); createLastfmTable();
checkAndConvertJSONToSQL(); checkAndConvertJSONToSQL();
const Discord = require('discord.js'); const { Collection, Client, GatewayIntentBits, Partials } = require('discord.js');
const client = new Discord.Client({ intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES, Discord.Intents.FLAGS.GUILD_PRESENCES] }); const client = new Client({ intents: [GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences
], partials: [Partials.Channel] });
const { const {
globalPrefix, globalPrefix,
token, token,
@ -33,10 +38,10 @@ const {
presenceText presenceText
} = require('./data/config.json'); } = require('./data/config.json');
client.settings = new Discord.Collection(); client.settings = new Collection();
client.commands = new Discord.Collection(); client.commands = new Collection();
client.serverPrefixes = new Discord.Collection(); client.serverPrefixes = new Collection();
client.netmodules = new Discord.Collection(); client.netmodules = new Collection();
client.settings.set("presenceType", presenceType); client.settings.set("presenceType", presenceType);

View file

@ -1,7 +1,7 @@
const getNickname = require("../getNickname"); const getNickname = require("../getNickname");
const parseMention = require("../parseMention"); const parseMention = require("../parseMention");
const getFmUsername = require("./getFmUsername"); const getFmUsername = require("./getFmUsername");
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
require("dotenv").config(); require("dotenv").config();
module.exports = async function(userID, guild) { module.exports = async function(userID, guild) {
@ -50,7 +50,7 @@ module.exports = async function(userID, guild) {
sendText.text = scrobble.errorMsg; sendText.text = scrobble.errorMsg;
return sendText; return sendText;
} }
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(`${scrobble.artist} - **${scrobble.album}**`) .setTitle(`${scrobble.artist} - **${scrobble.album}**`)
.setImage(scrobble.cover) .setImage(scrobble.cover)
sendText.embed = embed; sendText.embed = embed;

View file

@ -1,7 +1,7 @@
const getNickname = require("../getNickname"); const getNickname = require("../getNickname");
const parseMention = require("../parseMention"); const parseMention = require("../parseMention");
const getFmUsername = require("./getFmUsername"); const getFmUsername = require("./getFmUsername");
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
require("dotenv").config(); require("dotenv").config();
module.exports = async function (userID, guild) { module.exports = async function (userID, guild) {
@ -57,8 +57,8 @@ module.exports = async function (userID, guild) {
sendText.text = tracks.errorMsg; sendText.text = tracks.errorMsg;
return sendText; return sendText;
} }
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setAuthor(`Now playing - ${nickname}`, user.user.avatarURL({ dynamic: true, size: 4096 })) .setAuthor({name: `Now playing - ${nickname}`, iconURL: user.user.avatarURL({ dynamic: true, size: 4096 })})
.setThumbnail(tracks[0].cover) .setThumbnail(tracks[0].cover)
.setColor(15780145) .setColor(15780145)
.addFields({ .addFields({

View file

@ -1,7 +1,7 @@
// http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=username&api_key=YOUR_API_KEY&format=json // http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=username&api_key=YOUR_API_KEY&format=json
const getFmUsername = require("./getFmUsername"); const getFmUsername = require("./getFmUsername");
const Discord = require('discord.js'); const {EmbedBuilder} = require('discord.js');
const getNickname = require('../getNickname') const getNickname = require('../getNickname')
const parseMention = require('../parseMention') const parseMention = require('../parseMention')
@ -94,8 +94,8 @@ module.exports = async function (userID, option, guild, compatibility=false) {
}); });
}); });
} }
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setAuthor(`Top ${duration} tracks for ${nickname}`, user.user.avatarURL({ dynamic: true, size: 4096 })) .setAuthor({name: `Top ${duration} tracks for ${nickname}`, iconURL: user.user.avatarURL({ dynamic: true, size: 4096 })})
.setThumbnail(tracks[0].cover) .setThumbnail(tracks[0].cover)
.setColor(15780145) .setColor(15780145)
let tracksInfo = ""; let tracksInfo = "";

View file

@ -14,7 +14,10 @@ module.exports = function (user) {
details = `Artist: ${user.presence.activities[0].state}\nAlbum: ${user.presence.activities[0].details}\nSong: ${user.presence.activities[0].assets.largeText}\n` details = `Artist: ${user.presence.activities[0].state}\nAlbum: ${user.presence.activities[0].details}\nSong: ${user.presence.activities[0].assets.largeText}\n`
break; break;
case "Custom Status": case "Custom Status":
details = `"${user.presence.activities[0].state}"\n` if(user.presence.activities[0].state !== null)
details = `"${user.presence.activities[0].state}"\n`
else
details = "";
break; break;
case "Code": case "Code":
if(user.presence.activities[0].details != null) if(user.presence.activities[0].details != null)

View file

@ -25,7 +25,7 @@ module.exports = function ({presenceText, presenceType, client}) {
} }
try { try {
client.user.setActivity(presenceText, { type: presenceType }); client.user.setPresence({ activities: [{ name: presenceText, type: presenceType }]});
}catch(e){ }catch(e){
console.error(`${convertDateToISOString(new Date)}\n${e}`); console.error(`${convertDateToISOString(new Date)}\n${e}`);
} }