better polycatgen
This commit is contained in:
parent
d7f4e5b7a5
commit
1dbd406935
3 changed files with 8 additions and 25 deletions
18
commands.ts
18
commands.ts
|
@ -1,6 +1,5 @@
|
||||||
import type { Client, Message } from 'discord.js';
|
import type { Client, Message } from 'discord.js';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import pLimit from 'p-limit';
|
|
||||||
import { POLYCAT_CHANNEL_ID } from './constants';
|
import { POLYCAT_CHANNEL_ID } from './constants';
|
||||||
|
|
||||||
type Commands = {
|
type Commands = {
|
||||||
|
@ -126,23 +125,20 @@ We highly encourage asking authors that opted out to stop doing so.
|
||||||
|
|
||||||
'!polycatgen': async (c, e) => {
|
'!polycatgen': async (c, e) => {
|
||||||
if (!e.guild) return;
|
if (!e.guild) return;
|
||||||
if (e.channelId !== POLYCAT_CHANNEL_ID) return;
|
if (
|
||||||
|
e.channelId !== POLYCAT_CHANNEL_ID &&
|
||||||
|
process.env.NODE_ENV !== 'development'
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
await e.guild.emojis.fetch();
|
await e.guild.emojis.fetch();
|
||||||
const polycat = e.guild.emojis.cache.find(
|
const polycat = e.guild.emojis.cache.find(
|
||||||
(emoji) => emoji.name?.toLowerCase() === 'polycat'
|
(emoji) => emoji.name?.toLowerCase() === 'polycat'
|
||||||
);
|
);
|
||||||
|
|
||||||
const lim = pLimit(2);
|
await e.reply(
|
||||||
const prom = [];
|
`.\n${polycat}${polycat}${polycat}${polycat}${polycat}\n${polycat}${polycat}${polycat}${polycat}${polycat}\n${polycat}${polycat}${polycat}${polycat}${polycat}\n${polycat}${polycat}${polycat}${polycat}${polycat}\n${polycat}${polycat}${polycat}${polycat}${polycat}`
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
prom.push(
|
|
||||||
lim(() =>
|
|
||||||
e.channel.send(`${polycat}${polycat}${polycat}${polycat}${polycat}`)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
await Promise.all(prom);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'!piracy': async (c, e) => {
|
'!piracy': async (c, e) => {
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
"discord.js": "^13.7.0",
|
"discord.js": "^13.7.0",
|
||||||
"kleur": "^4.1.4",
|
"kleur": "^4.1.4",
|
||||||
"node-fetch": "^3.2.4",
|
"node-fetch": "^3.2.4",
|
||||||
"p-limit": "^4.0.0",
|
|
||||||
"url-regex": "^5.0.0"
|
"url-regex": "^5.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -1645,13 +1645,6 @@ p-cancelable@^1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc"
|
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc"
|
||||||
integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==
|
integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==
|
||||||
|
|
||||||
p-limit@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-4.0.0.tgz#914af6544ed32bfa54670b061cafcbd04984b644"
|
|
||||||
integrity sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==
|
|
||||||
dependencies:
|
|
||||||
yocto-queue "^1.0.0"
|
|
||||||
|
|
||||||
package-json@^6.3.0:
|
package-json@^6.3.0:
|
||||||
version "6.5.0"
|
version "6.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0"
|
resolved "https://registry.yarnpkg.com/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0"
|
||||||
|
@ -2143,8 +2136,3 @@ yallist@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||||
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
||||||
|
|
||||||
yocto-queue@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251"
|
|
||||||
integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue