mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
feat: add nonce to sendMessage options (#2459)
* add nonce to sendMessage options * add nonce to (Discordeno)Message
This commit is contained in:
@@ -39,6 +39,7 @@ export async function sendMessage(bot: Bot, channelId: bigint, options: CreateMe
|
||||
bot.constants.routes.CHANNEL_MESSAGES(channelId),
|
||||
{
|
||||
content: options.content,
|
||||
nonce: options.nonce,
|
||||
tts: options.tts,
|
||||
embeds: options.embeds?.map((embed) => bot.transformers.reverse.embed(bot, embed)),
|
||||
allowed_mentions: options.allowedMentions
|
||||
@@ -125,6 +126,8 @@ export async function sendMessage(bot: Bot, channelId: bigint, options: CreateMe
|
||||
export interface CreateMessage {
|
||||
/** The message contents (up to 2000 characters) */
|
||||
content?: string;
|
||||
/** Can be used to verify a message was sent (up to 25 characters). Value will appear in the Message Create event. */
|
||||
nonce?: string | number;
|
||||
/** true if this is a TTS message */
|
||||
tts?: boolean;
|
||||
/** Embedded `rich` content (up to 6000 characters) */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Bot } from "../bot.ts";
|
||||
import { DiscordMessage } from "../types/discord.ts";
|
||||
import { Optionalize } from "../types/shared.ts";
|
||||
import { CHANNEL_MENTION_REGEX } from "../util/constants.ts";
|
||||
import { MemberToggles } from "./toggles/member.ts";
|
||||
import { Optionalize } from "../types/shared.ts";
|
||||
|
||||
export function transformMessage(bot: Bot, payload: DiscordMessage) {
|
||||
const guildId = payload.guild_id ? bot.transformers.snowflake(payload.guild_id) : undefined;
|
||||
@@ -104,6 +104,7 @@ export function transformMessage(bot: Bot, payload: DiscordMessage) {
|
||||
),
|
||||
],
|
||||
member: payload.member && guildId ? bot.transformers.member(bot, payload.member, guildId, userId) : undefined,
|
||||
nonce: payload.nonce,
|
||||
};
|
||||
|
||||
return message as Optionalize<typeof message>;
|
||||
|
||||
Reference in New Issue
Block a user