eris-collector
This commit is contained in:
parent
94ae2c548c
commit
7d1a3793ce
3 changed files with 44 additions and 18 deletions
33
bot/event_modules/messageCreate/collector.js
Normal file
33
bot/event_modules/messageCreate/collector.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
const { ReactionCollector } = require('eris-collector');
|
||||||
|
|
||||||
|
module.exports = class {
|
||||||
|
constructor (wsEvent) {
|
||||||
|
this.wsEvent = wsEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
async run (client, message) {
|
||||||
|
/* Creating reaction collector */
|
||||||
|
if (message.content === 'createReactionCollector') {
|
||||||
|
|
||||||
|
/* Send informative message */
|
||||||
|
const msg = await client.createMessage(message.channel.id, 'This is a reaction collector example!');
|
||||||
|
await msg.addReaction('🐝');
|
||||||
|
|
||||||
|
/* Create reaction filter */
|
||||||
|
const filter = (m, emoji, userID) => emoji.name === '🐝' && userID === message.author.id;
|
||||||
|
|
||||||
|
/* Create collector */
|
||||||
|
const collector = new ReactionCollector(client, msg, filter, {
|
||||||
|
time: 1000 * 20
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Emitted when collector collects something suitable for filter
|
||||||
|
* For more information, please see discord.js docs: https://discord.js.org/#/docs/main/stable/class/ReactionCollector
|
||||||
|
*/
|
||||||
|
collector.on('collect', (m, emoji, userID) => {
|
||||||
|
console.log(client.createMessage(m.channel.id, `Reaction added by \`${userID}\``));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
27
package-lock.json
generated
27
package-lock.json
generated
|
@ -334,24 +334,12 @@
|
||||||
"ws": "^7.2.1"
|
"ws": "^7.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eris-additions": {
|
"eris-collector": {
|
||||||
"version": "1.4.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/eris-additions/-/eris-additions-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/eris-collector/-/eris-collector-1.0.1.tgz",
|
||||||
"integrity": "sha512-ZaAvQKZjXWOJB653RCKsdYMgJH+vXqdjjv/wTVtmFTUvaRdehON3x/yU/YseQwpoTwQVhOBLofTu6fdz0KzZmQ==",
|
"integrity": "sha512-qAuIP8//rMaTFs/3J7Ggk2tzWuNbFqJsAP8DuT9MLpNYc6f0u+Cifpa06//oxGQOWl4sWY1+0ncJDfRvlz2PMg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"eris": "^0.12.0"
|
"events": "^3.1.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"eris": {
|
|
||||||
"version": "0.12.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eris/-/eris-0.12.0.tgz",
|
|
||||||
"integrity": "sha512-LIw+uEOfHFCdE9BXL3wqxwml+74TJ7eMiMcyeW/jsmiWndDzybA/WlakiXAAnyg9a5OULOkHlKLOFsl+EgoZag==",
|
|
||||||
"requires": {
|
|
||||||
"opusscript": "^0.0.7",
|
|
||||||
"tweetnacl": "^1.0.1",
|
|
||||||
"ws": "^7.2.1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"escape-string-regexp": {
|
"escape-string-regexp": {
|
||||||
|
@ -494,6 +482,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
|
||||||
},
|
},
|
||||||
|
"events": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg=="
|
||||||
|
},
|
||||||
"fast-deep-equal": {
|
"fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"@sentry/node": "^5.26.0",
|
"@sentry/node": "^5.26.0",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"eris": "^0.13.3",
|
"eris": "^0.13.3",
|
||||||
"eris-additions": "^1.4.1",
|
"eris-collector": "^1.0.1",
|
||||||
"eslint": "^7.11.0",
|
"eslint": "^7.11.0",
|
||||||
"fs-readdir-recursive": "^1.1.0",
|
"fs-readdir-recursive": "^1.1.0",
|
||||||
"js-yaml": "^3.14.0",
|
"js-yaml": "^3.14.0",
|
||||||
|
|
Loading…
Reference in a new issue