feat: sessionId
This commit is contained in:
parent
5962c59684
commit
e8c2b967c3
@ -507,6 +507,14 @@ class Client extends BaseClient {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The current session id of the shard
|
||||
* @type {?string}
|
||||
*/
|
||||
get sessionId() {
|
||||
return this.ws.shards.first()?.sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for {@link Client#acceptInvite}.
|
||||
* @typedef {Object} AcceptInviteOptions
|
||||
@ -539,7 +547,7 @@ class Client extends BaseClient {
|
||||
const data = await this.api.invites(code).post({
|
||||
DiscordContext: { location: 'Markdown Link' },
|
||||
data: {
|
||||
session_id: this.ws.shards.first()?.sessionId,
|
||||
session_id: this.sessionId,
|
||||
},
|
||||
});
|
||||
this.emit(Events.DEBUG, `[Invite > Guild ${i.guild?.id}] Joined`);
|
||||
|
@ -1025,7 +1025,7 @@ class Message extends Base {
|
||||
channel_id: this.channelId,
|
||||
message_id: this.id,
|
||||
application_id: this.applicationId ?? this.author.id,
|
||||
session_id: this.client.ws.shards.first()?.sessionId,
|
||||
session_id: this.client.sessionId,
|
||||
message_flags: this.flags.bitfield,
|
||||
data: {
|
||||
component_type: MessageComponentTypes.BUTTON,
|
||||
@ -1124,7 +1124,7 @@ class Message extends Base {
|
||||
channel_id: this.channelId,
|
||||
message_id: this.id,
|
||||
application_id: this.applicationId ?? this.author.id,
|
||||
session_id: this.client.ws.shards.first()?.sessionId,
|
||||
session_id: this.client.sessionId,
|
||||
message_flags: this.flags.bitfield,
|
||||
data: {
|
||||
component_type: MessageComponentTypes[selectMenu.type],
|
||||
|
@ -205,7 +205,7 @@ class MessagePayload {
|
||||
this.options.activity.type
|
||||
) {
|
||||
const type = ActivityFlags.resolve(this.options.activity.type);
|
||||
const sessionId = this.target.client.ws.shards.first()?.sessionId;
|
||||
const sessionId = this.target.client.sessionId;
|
||||
const partyId = this.options.activity.partyId;
|
||||
activity = {
|
||||
type,
|
||||
|
@ -132,7 +132,7 @@ class Modal {
|
||||
channel_id: this.channelId,
|
||||
data: dataFinal,
|
||||
nonce,
|
||||
session_id: this.client.ws.shards.first()?.sessionId,
|
||||
session_id: this.client.sessionId,
|
||||
};
|
||||
this.client.api.interactions.post({
|
||||
data: postData,
|
||||
|
@ -703,7 +703,7 @@ function createPostData(
|
||||
application_id: applicationId,
|
||||
guild_id: guildId,
|
||||
channel_id: channelId,
|
||||
session_id: client.ws.shards.first()?.sessionId,
|
||||
session_id: client.sessionId,
|
||||
data: {
|
||||
version: commandVersion,
|
||||
id: commandId,
|
||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -791,6 +791,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
||||
public presences: PresenceManager;
|
||||
public billing: BillingManager;
|
||||
public settings: ClientUserSettingManager;
|
||||
public readonly sessionId: If<Ready, string, undefined>;
|
||||
public destroy(): void;
|
||||
public fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>;
|
||||
public fetchInvite(invite: InviteResolvable, options?: ClientFetchInviteOptions): Promise<Invite>;
|
||||
|
Loading…
Reference in New Issue
Block a user