Adding requester in response

This commit is contained in:
= 2021-06-28 22:38:03 -04:00
parent 48188db0b0
commit 60f2ebbc2a
2 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{ {
"prefix": "/", "prefix": "/",
"serverID": "760701839427108874", "serverID": "760701839427108874",
"logChannel": "858449941911437353", "logChannel": "859249300894908447",
"bootMessage": "NodBot v2 Starting Up", "bootMessage": "NodBot v2 Starting Up",
"shutdownMessage": "NodBot v2 Shutting Down" "shutdownMessage": "NodBot v2 Shutting Down"
} }

View File

@ -67,14 +67,14 @@ client.on('message', message => {
if (!client.gifs.has(file[0])) { if (!client.gifs.has(file[0])) {
giphy.search(query, (err, res) => { giphy.search(query, (err, res) => {
if (res.data[0] != undefined) { if (res.data[0] != undefined) {
message.channel.send(res.data[0].embed_url).then().catch(console.error); message.channel.send(query + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error);
} else { } else {
message.channel.send('I was unable to find a gif of ' + query); message.channel.send('I was unable to find a gif of ' + query);
} }
if (err) console.error(err); if (err) console.error(err);
}); });
} else { } else {
message.channel.send(client.gifs.get(query).embed_url); message.channel.send(query + ' requested by ' + message.author.username + '\n' + client.gifs.get(query).embed_url);
} }
break; break;
case 'pasta': case 'pasta':
@ -92,5 +92,8 @@ client.on('message', message => {
} }
} }
// Try to delete the requester's message
if (message.deletable) {
message.delete().then().catch(err => console.error(err));
}
}); });