Skip to content

Commit 0145403

Browse files
committed
fix(utils): prohibit replacing ephemeral messages
1 parent 23e092b commit 0145403

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/discord/messages.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ export type ReplaceableMessage = Message<true> & { channel: WebhookableChannel }
7676
* Custom typeguard for {@link ReplaceableMessage}
7777
*/
7878
export function canReplaceMessage(message: Message): message is ReplaceableMessage {
79-
return message.inGuild() && !!(message.channel as Channel & WebhookableChannel).fetchWebhooks;
79+
return (
80+
message.inGuild() &&
81+
!message.flags.has("Ephemeral") &&
82+
!!(message.channel as Channel & WebhookableChannel).fetchWebhooks
83+
);
8084
}
8185

8286
/**

0 commit comments

Comments
 (0)