mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
patch: Session.applicationId
This commit is contained in:
parent
5b0d124380
commit
d10adfdec3
@ -18,6 +18,8 @@ export type RawHandler<T> = (...args: [Session, number, T]) => void;
|
||||
export type Handler<T extends unknown[]> = (...args: T) => unknown;
|
||||
|
||||
export const READY: RawHandler<DiscordReady> = (session, shardId, payload) => {
|
||||
session.applicationId = payload.application.id;
|
||||
session.botId = payload.user.id;
|
||||
session.emit("ready", { ...payload, user: new User(session, payload.user) }, shardId);
|
||||
};
|
||||
|
||||
|
@ -42,6 +42,15 @@ export class Session extends EventEmitter {
|
||||
unrepliedInteractions: Set<bigint> = new Set();
|
||||
|
||||
#botId: Snowflake;
|
||||
#applicationId?: Snowflake;
|
||||
|
||||
set applicationId(id: Snowflake) {
|
||||
this.#applicationId = id;
|
||||
}
|
||||
|
||||
get applicationId() {
|
||||
return this.#applicationId!;
|
||||
}
|
||||
|
||||
set botId(id: Snowflake) {
|
||||
this.#botId = id;
|
||||
|
@ -116,7 +116,7 @@ export class Interaction implements Model {
|
||||
const result = await this.session.rest.sendRequest<DiscordMessage>(
|
||||
this.session.rest,
|
||||
{
|
||||
url: Routes.WEBHOOK(this.session.botId, this.token),
|
||||
url: Routes.WEBHOOK(this.session.applicationId ?? this.session.botId, this.token),
|
||||
method: "POST",
|
||||
payload: this.session.rest.createRequestBody(this.session.rest, {
|
||||
method: "POST",
|
||||
|
Loading…
x
Reference in New Issue
Block a user