discord support for end command

This commit is contained in:
ChomeNS 2022-08-19 06:42:14 +07:00
parent aec461f4f8
commit 89f8d5d94d
3 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,5 @@
/* eslint-disable max-len */
const config = require('../config.json');
module.exports = { module.exports = {
name: 'end', name: 'end',
alias: [], alias: [],
@ -11,4 +13,11 @@ module.exports = {
throw new Error('Invalid hash'); 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');
} else {
throw new Error('You\'re not in trusted role!');
}
},
}; };

View file

@ -17,7 +17,8 @@
"192.168.1.103:25565": "1002806756885413978", "192.168.1.103:25565": "1002806756885413978",
"kitsune.icu:25565": "1004006678460637315" "kitsune.icu:25565": "1004006678460637315"
}, },
"prefix": "!" "prefix": "!",
"trustedRoleID": "981159334299983953"
}, },
"servers": [ "servers": [
{ {

View file

@ -21,7 +21,7 @@ function inject(bot, dcclient) {
if (prefix==='!') { if (prefix==='!') {
if (typeof command.discordExecute==='undefined') throw new Error('This command is not yet supported on discord!'); if (typeof command.discordExecute==='undefined') throw new Error('This command is not yet supported on discord!');
command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc); command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message);
} else { } else {
command.execute(bot, username, usernameraw, sender, prefix, args); command.execute(bot, username, usernameraw, sender, prefix, args);
} }