mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
Added functionality to remove docs embed.
This commit is contained in:
parent
3cd05cd48c
commit
2dd776c86d
1 changed files with 15 additions and 2 deletions
|
@ -7,11 +7,24 @@ export default new NamedCommand({
|
||||||
run: "You need to specify a term to query the docs with.",
|
run: "You need to specify a term to query the docs with.",
|
||||||
any: new RestCommand({
|
any: new RestCommand({
|
||||||
description: "What to query the docs with.",
|
description: "What to query the docs with.",
|
||||||
async run({send, args}) {
|
async run({send, author, args}) {
|
||||||
var queryString = args[0];
|
var queryString = args[0];
|
||||||
let url = new URL(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${queryString}`);
|
let url = new URL(`https://djsdocs.sorta.moe/v2/embed?src=master&q=${queryString}`);
|
||||||
const content = await getContent(url.toString());
|
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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue