mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
Merge branch 'main' of https://github.com/discordeno/discordeno into main
This commit is contained in:
@@ -134,9 +134,7 @@ export async function sendInteractionResponse(
|
||||
};
|
||||
|
||||
// A reply has never been send
|
||||
if (bot.cache.unrepliedInteractions.has(id)) {
|
||||
bot.cache.unrepliedInteractions.delete(id);
|
||||
|
||||
if (bot.cache.unrepliedInteractions.delete(id)) {
|
||||
return await bot.rest.runMethod(bot.rest, "post", bot.constants.endpoints.INTERACTION_ID_TOKEN(id, token), {
|
||||
type: options.type,
|
||||
data,
|
||||
|
||||
@@ -11,6 +11,7 @@ export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint
|
||||
return await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"put",
|
||||
bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction)
|
||||
bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, encodeURIComponent(reaction)),
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,16 @@ export async function getReactions(
|
||||
reaction: string,
|
||||
options?: GetReactions
|
||||
) {
|
||||
if (reaction.startsWith("<:")) {
|
||||
reaction = reaction.substring(2, reaction.length - 1);
|
||||
} else if (reaction.startsWith("<a:")) {
|
||||
reaction = reaction.substring(3, reaction.length - 1);
|
||||
}
|
||||
|
||||
const users = await bot.rest.runMethod<User[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, reaction),
|
||||
bot.constants.endpoints.CHANNEL_MESSAGE_REACTION(channelId, messageId, encodeURIComponent(reaction)),
|
||||
options
|
||||
);
|
||||
|
||||
|
||||
@@ -18,7 +18,12 @@ export async function removeReaction(
|
||||
bot.rest,
|
||||
"delete",
|
||||
options?.userId
|
||||
? bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_USER(channelId, messageId, reaction, options.userId)
|
||||
: bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction)
|
||||
? bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_USER(
|
||||
channelId,
|
||||
messageId,
|
||||
encodeURIComponent(reaction),
|
||||
options.userId
|
||||
)
|
||||
: bot.constants.endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, encodeURIComponent(reaction))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export function createRequestBody(rest: RestManager, queuedRequest: { request: R
|
||||
|
||||
return {
|
||||
headers,
|
||||
body: (queuedRequest.payload.body?.file || JSON.stringify(queuedRequest.payload.body)) as FormData | string,
|
||||
body: (queuedRequest.payload.body?.file ?? JSON.stringify(queuedRequest.payload.body)) as FormData | string,
|
||||
method: queuedRequest.request.method.toUpperCase(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user