Added functionality to remove docs embed.

This commit is contained in:
Keanu Timmermans 2021-04-12 20:42:16 +02:00
parent 3cd05cd48c
commit 2dd776c86d
Signed by: keanucode
GPG Key ID: A7431C0D513CA93B
1 changed files with 15 additions and 2 deletions

View File

@ -7,11 +7,24 @@ export default new NamedCommand({
run: "You need to specify a term to query the docs with.",
any: new RestCommand({
description: "What to query the docs with.",
async run({send, args}) {
async run({send, author, args}) {
var queryString = args[0];
let url = new URL(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${queryString}`);
const content = await getContent(url.toString());
return send({embed: content});
const msg = await send({embed: content});
const react = await msg.react("❌");
const collector = msg.createReactionCollector(
(reaction, user) => {
if (user.id === author.id && reaction.emoji.name === "❌") msg.delete();
return false;
},
{time: 60000}
);
collector.on("end", () => {
react.users.remove(msg.author);
});
}
})
});