mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
minor fixes
This commit is contained in:
parent
6c6f982100
commit
06c4cd15c0
@ -306,6 +306,13 @@ export abstract class BaseInteraction implements Model {
|
||||
return this.sendFollowUp(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* internal usage only, same as respond but doesn't tries to follow up
|
||||
* */
|
||||
async respond_(resp: InteractionResponse): Promise<void> {
|
||||
if (!this.responded) return this.respond(resp) as Promise<undefined>;
|
||||
}
|
||||
|
||||
// start custom methods
|
||||
|
||||
async respondWith(
|
||||
@ -328,6 +335,31 @@ export abstract class BaseInteraction implements Model {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* taken from Detritus
|
||||
* try respond, try edit, try follow up
|
||||
* */
|
||||
async editOrReply(resp: InteractionResponseWithData & EditWebhookMessage) {
|
||||
if (this.responded) {
|
||||
return this.editReply(resp);
|
||||
}
|
||||
|
||||
let type: InteractionResponseTypes = InteractionResponseTypes.ChannelMessageWithSource;
|
||||
|
||||
switch (this.type) {
|
||||
case InteractionTypes.ApplicationCommand:
|
||||
type = InteractionResponseTypes.ChannelMessageWithSource;
|
||||
break;
|
||||
case InteractionTypes.MessageComponent:
|
||||
type = InteractionResponseTypes.UpdateMessage;
|
||||
break;
|
||||
}
|
||||
|
||||
const result = await this.respond({ type, data: resp });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// end custom methods
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
WEBHOOK_MESSAGE,
|
||||
WEBHOOK_MESSAGE_ORIGINAL,
|
||||
} from '@biscuitland/api-types';
|
||||
import { NewEmbed } from './embed';
|
||||
|
||||
export type ExecuteWebhookOptions = WebhookOptions &
|
||||
CreateMessage & { avatarUrl?: string; username?: string };
|
||||
@ -87,7 +88,7 @@ export class Webhook implements Model {
|
||||
|
||||
const data = {
|
||||
content: options?.content,
|
||||
embeds: options?.embeds,
|
||||
embeds: options?.embeds?.map(NewEmbed),
|
||||
tts: options?.tts,
|
||||
allowed_mentions: options?.allowedMentions,
|
||||
components: options?.components,
|
||||
@ -158,7 +159,7 @@ export class Webhook implements Model {
|
||||
: WEBHOOK_MESSAGE_ORIGINAL(this.id, this.token),
|
||||
{
|
||||
content: options?.content,
|
||||
embeds: options?.embeds,
|
||||
embeds: options?.embeds?.map(NewEmbed),
|
||||
file: options?.files,
|
||||
components: options?.components,
|
||||
allowed_mentions: options?.allowedMentions && {
|
||||
|
Loading…
x
Reference in New Issue
Block a user