mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
fix: allow suppressing embeds on non bot msgs #1074
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
import { botId } from "../../bot.ts";
|
||||||
|
import { cacheHandlers } from "../../cache.ts";
|
||||||
|
import { rest } from "../../rest/rest.ts";
|
||||||
|
import { structures } from "../../structures/mod.ts";
|
||||||
|
import { Errors } from "../../types/discordeno/errors.ts";
|
||||||
|
import { EditMessage } from "../../types/messages/edit_message.ts";
|
||||||
|
import type { Message } from "../../types/messages/message.ts";
|
||||||
|
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
|
||||||
|
import { endpoints } from "../../util/constants.ts";
|
||||||
|
import { requireBotChannelPermissions } from "../../util/permissions.ts";
|
||||||
|
import { snakelize, validateComponents } from "../../util/utils.ts";
|
||||||
|
|
||||||
|
/** Suppress all the embeds in this message */
|
||||||
|
export async function suppressEmbeds(channelId: bigint, messageId: bigint) {
|
||||||
|
const message = await cacheHandlers.get("messages", messageId);
|
||||||
|
|
||||||
|
await requireBotChannelPermissions(channelId, message ? ["MANAGE_MESSAGES"] : ["SEND_MESSAGES"]);
|
||||||
|
|
||||||
|
const result = await rest.runMethod<Message>(
|
||||||
|
"patch",
|
||||||
|
endpoints.CHANNEL_MESSAGE(channelId, messageId),
|
||||||
|
snakelize({ flags: 4 })
|
||||||
|
);
|
||||||
|
|
||||||
|
return await structures.createDiscordenoMessage(result);
|
||||||
|
}
|
||||||
@@ -95,6 +95,7 @@ import { removeAllReactions } from "./messages/remove_all_reactions.ts";
|
|||||||
import { removeReaction } from "./messages/remove_reaction.ts";
|
import { removeReaction } from "./messages/remove_reaction.ts";
|
||||||
import { removeReactionEmoji } from "./messages/remove_reaction_emoji.ts";
|
import { removeReactionEmoji } from "./messages/remove_reaction_emoji.ts";
|
||||||
import { sendMessage } from "./messages/send_message.ts";
|
import { sendMessage } from "./messages/send_message.ts";
|
||||||
|
import { suppressEmbeds } from "./messages/suppress_embeds.ts";
|
||||||
import { unpin, unpinMessage } from "./messages/unpin_message.ts";
|
import { unpin, unpinMessage } from "./messages/unpin_message.ts";
|
||||||
import { editBotProfile } from "./misc/edit_bot_profile.ts";
|
import { editBotProfile } from "./misc/edit_bot_profile.ts";
|
||||||
import { editBotStatus } from "./misc/edit_bot_status.ts";
|
import { editBotStatus } from "./misc/edit_bot_status.ts";
|
||||||
@@ -310,6 +311,7 @@ export {
|
|||||||
startThread,
|
startThread,
|
||||||
unarchiveThread,
|
unarchiveThread,
|
||||||
unlockThread,
|
unlockThread,
|
||||||
|
suppressEmbeds,
|
||||||
};
|
};
|
||||||
|
|
||||||
export let helpers = {
|
export let helpers = {
|
||||||
@@ -474,6 +476,7 @@ export let helpers = {
|
|||||||
startThread,
|
startThread,
|
||||||
unarchiveThread,
|
unarchiveThread,
|
||||||
unlockThread,
|
unlockThread,
|
||||||
|
suppressEmbeds,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Helpers = typeof helpers;
|
export type Helpers = typeof helpers;
|
||||||
|
|||||||
Reference in New Issue
Block a user