Skip to content

Commit 4a3bced

Browse files
committed
feat: suppress discord embeds if possible
because they're very useless and very big
1 parent 68116e6 commit 4a3bced

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/events/messageCreate.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { logger } from "@yuudachi/framework";
22
import type { Event } from "@yuudachi/framework/types";
3-
import { Events, Client } from "discord.js";
3+
import { Events, Client, MessageFlags, PermissionFlagsBits } from "discord.js";
44
import { container, injectable } from "tsyringe";
55
import { kAutoresponses } from "../tokens.js";
66
import type { AutoResponse } from "../util/autoresponses.js";
@@ -21,6 +21,13 @@ export default class implements Event {
2121
return;
2222
}
2323

24+
if (
25+
message.content.includes("://discord.com") &&
26+
(message.guild?.members.me?.permissionsIn(message.channelId).has(PermissionFlagsBits.ManageMessages) ?? false)
27+
) {
28+
await message.edit({ flags: MessageFlags.SuppressEmbeds }).catch(() => null);
29+
}
30+
2431
const responses = container.resolve<AutoResponse[]>(kAutoresponses);
2532

2633
try {

0 commit comments

Comments
 (0)