Compare commits
2 commits
842ad55d61
...
9bceeb6060
Author | SHA1 | Date | |
---|---|---|---|
|
9bceeb6060 | ||
|
9986d8c410 |
17
src/index.ts
17
src/index.ts
|
@ -542,13 +542,14 @@ client.on('message', async (message) => {
|
|||
});
|
||||
|
||||
async function wordFilters(message: Message) {
|
||||
if (!message.content) return;
|
||||
const content = message.content.replace(/\u200b/g, "");
|
||||
|
||||
try {
|
||||
const RE_POKETUBE_VIDEO = /https?:\/\/(poketube.fun|poketube.sudovanilla.com)\/watch\?([^\s\/]+&)?v=(?<videoid>[^\s\/?&]{1,16})(&\S*)?/gi;
|
||||
const RE_YOUTUBE_PROXY = /https?:\/\/(\w+\.)?(poketube\.fun|poketube\.sudovanilla\.com|piped\.video)\/watch\?([^\s\/]+&)?v=(?<videoid>[^\s\/?&]{1,16})(&\S*)?/gi;
|
||||
const results: string[] = [];
|
||||
|
||||
if (!message.content) return;
|
||||
|
||||
for (const result of message.content.matchAll(RE_POKETUBE_VIDEO)) {
|
||||
for (const result of content.matchAll(RE_YOUTUBE_PROXY)) {
|
||||
var id = result.groups?.videoid;
|
||||
if (id) results.push(`https://youtu.be/${id}`);
|
||||
}
|
||||
|
@ -559,6 +560,14 @@ async function wordFilters(message: Message) {
|
|||
} catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
try {
|
||||
if (message.author_id == "01FD0D2ED95QTQX442AZRWWMQK" && /(^|\s|\W)(pt|poketube|poke|pokesearch)($|\s|\W)/i.test(content)) {
|
||||
await message.react('01HER6VW6PX7H5BD6J6J6ZS3VJ');
|
||||
}
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
client.on('member/join', async (member) => {
|
||||
|
|
Loading…
Reference in a new issue