Skip to content

Commit 7029b1f

Browse files
committed
Support tiktok deletions
1 parent 36ea3b0 commit 7029b1f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/commands/tiktok.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ export default class TikTokLink implements SpecialCommand {
1313
cooldownTime = 0;
1414

1515
matches(message: Message<boolean>): boolean {
16+
return TikTokLink.matchesPattern(message.content);
17+
}
18+
19+
static matchesPattern(message: string): boolean {
1620
const pattern = /((www|m\.)?tiktok\.com)|(vm\.tiktok\.com)/i;
17-
return pattern.test(message.content);
21+
return pattern.test(message);
1822
}
1923

2024
async handleSpecialMessage(message: Message<true>) {

src/handler/messageDeleteHandler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { BotContext } from "#context.ts";
55
import * as pollService from "#service/poll.ts";
66

77
import InstagramLink from "#commands/instagram.ts";
8+
import TikTokLink from "#commands/tiktok.ts";
89

910
import log from "#log";
1011

@@ -30,8 +31,9 @@ export default async function (message: Message<true>, context: BotContext) {
3031
message.content.startsWith(context.prefix.modCommand);
3132

3233
const isInstagramLink = InstagramLink.matchesPattern(message.content);
34+
const isTikTokLink = TikTokLink.matchesPattern(message.content);
3335

34-
if (isNormalCommand || isInstagramLink) {
36+
if (isNormalCommand || isInstagramLink || isTikTokLink) {
3537
await deleteInlineRepliesFromBot(message, context.client.user);
3638
}
3739
}

0 commit comments

Comments
 (0)