Fix SB Replies
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 17s
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 17s
This commit is contained in:
parent
0c03b4b2d4
commit
a8519af9cc
@ -10,7 +10,10 @@ module.exports = {
|
||||
// message.reply(fn.spongebob(commandData)).then(() => {
|
||||
// message.delete();
|
||||
// });
|
||||
// Check if the message is replying to another message
|
||||
if (message.reference != undefined) {
|
||||
// Check if the message is just ".sb" or ".spongebob" (empty arguments)
|
||||
if (commandData.args === "") {
|
||||
const repliedMessageId = message.reference.messageId;
|
||||
message.channel.messages.fetch(repliedMessageId)
|
||||
.then(repliedMessage => {
|
||||
@ -21,6 +24,18 @@ module.exports = {
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
} else { // If there is content before the .sb, meaning the reply is just for reference...
|
||||
const repliedMessageId = message.reference.messageId;
|
||||
message.channel.messages.fetch(repliedMessageId)
|
||||
.then(repliedMessage => {
|
||||
repliedMessage.reply(fn.spongebob({ args: commandData.args })).then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
message.channel.send(fn.spongebob(commandData)).then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
|
Loading…
Reference in New Issue
Block a user