mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 17:45:34 -05:00
fix.
This commit is contained in:
parent
26c9c0e3b3
commit
cd4d2427b6
2 changed files with 8 additions and 7 deletions
|
@ -8,14 +8,14 @@ module.exports = {
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||||
if (args[0]===bot.hash) {
|
if (args[0]===bot.hash) {
|
||||||
bot.emit('end', 'end command');
|
bot.end('end command');
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid hash');
|
throw new Error('Invalid hash');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||||
if (message.member._roles.at(0)===config.discord.trustedRoleID) {
|
if (message.member._roles.at(0)===config.discord.trustedRoleID) {
|
||||||
bot.emit('end', 'end command');
|
bot.end('end command');
|
||||||
} else {
|
} else {
|
||||||
throw new Error('You\'re not in trusted role!');
|
throw new Error('You\'re not in trusted role!');
|
||||||
}
|
}
|
||||||
|
|
9
index.js
9
index.js
|
@ -372,13 +372,15 @@ function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('SIGINT', async function() {
|
process.on('SIGINT', async function() {
|
||||||
|
try {
|
||||||
bot.chat('Interrupted by console');
|
bot.chat('Interrupted by console');
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function onEnd() {
|
bot.once('end', (reason, event) => {
|
||||||
bot.on('end', (reason, event) => {
|
|
||||||
console.log(`Disconnected (${event} event): ${util.inspect(reason)}`);
|
console.log(`Disconnected (${event} event): ${util.inspect(reason)}`);
|
||||||
channel.send(`Disconnected (${event} event): ${util.inspect(reason)}`);
|
channel.send(`Disconnected (${event} event): ${util.inspect(reason)}`);
|
||||||
|
|
||||||
|
@ -433,7 +435,6 @@ dcclient.on('ready', async () => {
|
||||||
}
|
}
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
main();
|
main();
|
||||||
onEnd();
|
|
||||||
chomenschannel = dcclient.channels.cache.get(chomenschannel);
|
chomenschannel = dcclient.channels.cache.get(chomenschannel);
|
||||||
bot.hashchannel = dcclient.channels.cache.get(hashchannel);
|
bot.hashchannel = dcclient.channels.cache.get(hashchannel);
|
||||||
bot.ownerhashchannel = dcclient.channels.cache.get(ownerhashchannel);
|
bot.ownerhashchannel = dcclient.channels.cache.get(ownerhashchannel);
|
||||||
|
|
Loading…
Reference in a new issue