mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-23 15:47:57 -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,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0]===bot.hash) {
|
||||
bot.emit('end', 'end command');
|
||||
bot.end('end command');
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
if (message.member._roles.at(0)===config.discord.trustedRoleID) {
|
||||
bot.emit('end', 'end command');
|
||||
bot.end('end command');
|
||||
} else {
|
||||
throw new Error('You\'re not in trusted role!');
|
||||
}
|
||||
|
|
11
index.js
11
index.js
|
@ -372,13 +372,15 @@ function main() {
|
|||
});
|
||||
|
||||
process.on('SIGINT', async function() {
|
||||
bot.chat('Interrupted by console');
|
||||
try {
|
||||
bot.chat('Interrupted by console');
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
process.exit();
|
||||
});
|
||||
}
|
||||
|
||||
function onEnd() {
|
||||
bot.on('end', (reason, event) => {
|
||||
bot.once('end', (reason, event) => {
|
||||
console.log(`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);
|
||||
main();
|
||||
onEnd();
|
||||
chomenschannel = dcclient.channels.cache.get(chomenschannel);
|
||||
bot.hashchannel = dcclient.channels.cache.get(hashchannel);
|
||||
bot.ownerhashchannel = dcclient.channels.cache.get(ownerhashchannel);
|
||||
|
|
Loading…
Reference in a new issue