add filter & !polycatgen

This commit is contained in:
Ryan Cao 2022-05-22 13:28:48 +08:00
parent 1908a4f79e
commit ef133512a3
No known key found for this signature in database
GPG key ID: 528A2C1B6656B97F
5 changed files with 65 additions and 14 deletions

View file

@ -1,4 +1,6 @@
import type { Client, Message } from 'discord.js';
import pLimit from 'p-limit';
import { POLYCAT_CHANNEL_ID } from './constants';
type Commands = {
[cmd: string]: (c: Client, e: Message) => void | Promise<void>;
@ -97,6 +99,27 @@ We probably can't fully fix this. If you find out which mod is causing this, tel
],
});
},
'!polycatgen': async (c, e) => {
if (!e.guild) return;
if (e.channelId !== POLYCAT_CHANNEL_ID) return;
await e.guild.emojis.fetch();
const polycat = e.guild.emojis.cache.find(
(emoji) => emoji.name?.toLowerCase() === 'polycat'
);
const lim = pLimit(2);
const prom = [];
for (let i = 0; i < 10; i++) {
prom.push(
lim(() =>
e.channel.send(`${polycat}${polycat}${polycat}${polycat}${polycat}`)
)
);
}
await Promise.all(prom);
},
};
export const aliases: { [a: string]: string } = {