This commit is contained in:
ChomeNS 2022-08-19 07:44:50 +07:00
parent 26c9c0e3b3
commit cd4d2427b6
2 changed files with 8 additions and 7 deletions

View file

@ -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!');
}

View file

@ -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);