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,17 +10,32 @@ module.exports = {
|
||||
// message.reply(fn.spongebob(commandData)).then(() => {
|
||||
// message.delete();
|
||||
// });
|
||||
// Check if the message is replying to another message
|
||||
if (message.reference != undefined) {
|
||||
const repliedMessageId = message.reference.messageId;
|
||||
message.channel.messages.fetch(repliedMessageId)
|
||||
.then(repliedMessage => {
|
||||
repliedMessage.reply(fn.spongebob({ args: repliedMessage.content })).then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
// 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 => {
|
||||
repliedMessage.reply(fn.spongebob({ args: repliedMessage.content })).then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
})
|
||||
.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