mirror of
https://github.com/litruv/DAdmin.git
synced 2026-07-24 02:36:11 +10:00
DM changes..
This commit is contained in:
22
index.js
22
index.js
@@ -93,7 +93,7 @@ client.on("message", (msg) => {
|
||||
|
||||
function onMessage(msg, again = true) {
|
||||
if (msg.channel.type = "dm") {
|
||||
doCommand(msg, "")
|
||||
doPMCommand(msg, "")
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -116,6 +116,26 @@ function onMessage(msg, again = true) {
|
||||
|
||||
}
|
||||
}
|
||||
function doPMCommand(msg, prefix) {
|
||||
const command = message.substring(prefix.length).split(/[ \n]/)[0].trim().toLowerCase()
|
||||
msg.suffix = message.substring(prefix.length + command.length).trim()
|
||||
|
||||
var cmds = client.cachedcommands.filter(cmd => cmd.alias == command);
|
||||
if (cmds.length > 0) {
|
||||
console.log("CMD:".green + " ".reset + msg.author.user.username.bold + "#".reset + msg.author.user.discriminator.reset + " " + prefix.grey + command.green.bold + " ".reset + msg.suffix + " | PM")
|
||||
var reqcommand = require('./commands/' + cmds[0].file)
|
||||
msg.react('✅')
|
||||
try {
|
||||
reqcommand.command(client, msg)
|
||||
} catch (err) {
|
||||
console.error('There was an error running: ' + command);
|
||||
console.error(err.stack);
|
||||
}
|
||||
}
|
||||
|
||||
delete require.cache[require.resolve('./commands/' + cmds[0].file)]
|
||||
}
|
||||
}
|
||||
|
||||
function doCommand(msg, prefix) {
|
||||
var message = msg.cleanContent
|
||||
|
||||
Reference in New Issue
Block a user