If I want to make a command that restarts my bot, what is the new client.destroy(); ?

Title. It is saying .destroy() is not a function.
6 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs•2y ago
method Client#destroy() Logs out, terminates the connection to Discord, and destroys the client.
Erin
Erin•2y ago
This is my whole command:
const token = require('../../config/config.json').token;
module.exports = {
name: 'reset',
aliases: ['restart', 'reboot', 'fucku'],
ownerOnly: 1,
description: 'Allows **Erin** to restart the bot directly from discord.',
cooldown: 4500,
execute(message, client) {
message.channel.send('Resetting...')
.then(msg => client.destroy())
.then(() => client.login(token));
}
}
const token = require('../../config/config.json').token;
module.exports = {
name: 'reset',
aliases: ['restart', 'reboot', 'fucku'],
ownerOnly: 1,
description: 'Allows **Erin** to restart the bot directly from discord.',
cooldown: 4500,
execute(message, client) {
message.channel.send('Resetting...')
.then(msg => client.destroy())
.then(() => client.login(token));
}
}
I don't understand You are saying client doesn't exist? It works in my other commands. Odd you are right. Client is just logging [] message.client seems to have worked... I think... no errors but nothing changes in the console. I would expect the loading sequence to show up again, right? Yeah, it isn't working... no errors but when I make any changes in code and use reset in discord, it doesn't actually restart the bot.
Erin
Erin•2y ago
Changed from thumbs up to thumbs down between these and you can see it stays thumbs up...
Erin
Erin•2y ago
Code:
const token = require('../../config/config.json').token;
module.exports = {
name: 'reset',
aliases: ['restart', 'reboot', 'fucku'],
ownerOnly: 1,
description: 'Allows **Erin** to restart the bot directly from discord.',
execute(message) {
message.react('👎')
.then(msg => message.client.destroy())
.then(() => message.client.login(token));
console.log('-----------------------');
console.log('REBOOTED VIA DISCORD');
console.log('-----------------------')
}
}
const token = require('../../config/config.json').token;
module.exports = {
name: 'reset',
aliases: ['restart', 'reboot', 'fucku'],
ownerOnly: 1,
description: 'Allows **Erin** to restart the bot directly from discord.',
execute(message) {
message.react('👎')
.then(msg => message.client.destroy())
.then(() => message.client.login(token));
console.log('-----------------------');
console.log('REBOOTED VIA DISCORD');
console.log('-----------------------')
}
}
Logs: https://srcb.in/weaOplRwRO So use pm2 start index.js --watch ?
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View