allowed execution of commands within direct message channels, also fixed 2 crashes with attempting to delete messages without permission to do so

This commit is contained in:
ayeuhugyu 2023-09-11 22:45:21 -07:00
parent 03a7851605
commit cb16a007d3
3 changed files with 6 additions and 3 deletions

View file

@ -67,7 +67,9 @@ module.exports = {
); );
ableToSend = false; ableToSend = false;
}); });
message.delete(); if (message.deletable) {
message.delete();
}
if (ableToSend) { if (ableToSend) {
fs.appendFileSync( fs.appendFileSync(
"../pepperbot/src/logs/forcesay.log", "../pepperbot/src/logs/forcesay.log",

View file

@ -18,7 +18,9 @@ module.exports = {
if (msg !== "") { if (msg !== "") {
message.channel.send(msg); message.channel.send(msg);
message.delete(); if (message.deletable) {
message.delete();
}
fs.appendFileSync( fs.appendFileSync(
"../pepperbot/src/logs/forcesay.log", "../pepperbot/src/logs/forcesay.log",
Date() + Date() +

View file

@ -100,7 +100,6 @@ client.on("messageCreate", async (message) => {
message.content + message.content +
'"\n' '"\n'
); );
return;
} }
if (!message.content.startsWith(prefix)) return; if (!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).split(/ +/); const args = message.content.slice(prefix.length).split(/ +/);