Compare commits
No commits in common. "0106983a5f122bd488cf68df270f16fdd2d5d143" and "ff3a423a30cd7518f448c62939704a758f12a510" have entirely different histories.
0106983a5f
...
ff3a423a30
@ -10,21 +10,9 @@ module.exports = {
|
|||||||
// message.reply(fn.spongebob(commandData)).then(() => {
|
// message.reply(fn.spongebob(commandData)).then(() => {
|
||||||
// message.delete();
|
// message.delete();
|
||||||
// });
|
// });
|
||||||
if (message.reference != undefined) { // message.reference is undefined if the message isn't a reply to another message
|
if (message.reference != undefined) {
|
||||||
if (commandData.args !== "") { // If the replying message isn't just .sb
|
const repliedMessageId = message.reference.messageId;
|
||||||
const repliedMessageId = message.reference.messageId; // grab the message Id of the replied-to msg
|
message.channel.messages.fetch(repliedMessageId)
|
||||||
message.channel.messages.fetch(repliedMessageId) // Fetch the message because with our luck it isn't in the cache
|
|
||||||
.then(repliedMessage => {
|
|
||||||
repliedMessage.reply(fn.spongebob({ args: commandData.args })).then(() => { // Use the pre-command text of the replying message to sb-ify
|
|
||||||
if (message.deletable) message.delete(); // If the initiating message is deletable, delete it.
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
} else { // We're working with a basic ".sb" and can proceed as we did before...
|
|
||||||
const repliedMessageId = message.reference.messageId; // grab the message Id of the replied-to msg
|
|
||||||
message.channel.messages.fetch(repliedMessageId) // Fetch the message because with our luck it isn't in the cache
|
|
||||||
.then(repliedMessage => {
|
.then(repliedMessage => {
|
||||||
repliedMessage.reply(fn.spongebob({ args: repliedMessage.content })).then(() => {
|
repliedMessage.reply(fn.spongebob({ args: repliedMessage.content })).then(() => {
|
||||||
if (message.deletable) message.delete();
|
if (message.deletable) message.delete();
|
||||||
@ -33,10 +21,9 @@ module.exports = {
|
|||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
} else { // The message isn't a reply, so just sb it like we did from the very beginning
|
|
||||||
message.channel.send(fn.spongebob(commandData)).then(() => {
|
message.channel.send(fn.spongebob(commandData)).then(() => {
|
||||||
if (message.deletable) message.delete(); // If the initiating message is deletable, delete it.
|
if (message.deletable) message.delete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ const functions = {
|
|||||||
// Get the first part of the message, everything leading up to the final period
|
// Get the first part of the message, everything leading up to the final period
|
||||||
commandData.args = message.content.slice(0,finalPeriod).toLowerCase();
|
commandData.args = message.content.slice(0,finalPeriod).toLowerCase();
|
||||||
// Get the last part of the message, everything after the final period
|
// Get the last part of the message, everything after the final period
|
||||||
commandData.command = message.content.slice(finalPeriod + 1).toLowerCase();
|
commandData.command = message.content.slice(finalPeriod).replace('.','').toLowerCase();
|
||||||
commandData.author = `${message.author.username}`;
|
commandData.author = `${message.author.username}`;
|
||||||
return this.checkCommand(commandData);
|
return this.checkCommand(commandData);
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodbot",
|
"name": "nodbot",
|
||||||
"version": "3.2.2",
|
"version": "3.2.1",
|
||||||
"description": "Nods and Nod Accessories, now with ChatGPT!",
|
"description": "Nods and Nod Accessories, now with ChatGPT!",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user