Compare commits

...

10 Commits

Author SHA1 Message Date
Elizabeth Cray
1cafa029f0 Issue #1126 fix data initialization error 2024-04-03 22:18:43 -04:00
Elysia
20241ade25
Merge pull request #1111 from TheDevYellowy/main
feat: add email and password login to client
2024-03-27 11:45:55 +07:00
TheDevYellowy
d7fc839e80 feat: add email and password login to client 2024-03-26 22:51:17 -05:00
Elysia
90085a99ce Update Message.js 2024-03-03 15:16:55 +07:00
Elysia
5c92f0de33 Update Options.js 2024-02-17 18:25:50 +07:00
Elysia
a2a5c602a1 Update SlashCommand.md 2024-02-17 17:50:50 +07:00
Elysia
08f822e48a fix: proxy #1043 2024-02-14 08:14:01 +07:00
Elysia
077f087ca0 fix: clean content #1049 2024-02-14 08:00:56 +07:00
Elysia
b06f0fdc33 Update ClientPresence.js 2024-02-14 07:54:37 +07:00
Elysia
3e84e501b7 fix: rpc 2024-01-31 21:19:09 +07:00
12 changed files with 185 additions and 94 deletions

File diff suppressed because one or more lines are too long

View File

@ -89,3 +89,31 @@ await message.channel.sendSlash('718642000898818048', 'sauce', a)
} }
``` ```
### Receive messages after bot has replied `{botname} is thinking...`
> [aiko-chan-ai/discord.js-selfbot-v13#1055 (comment)](https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/1055#issuecomment-1949653100)
![image](https://cdn.discordapp.com/attachments/820557032016969751/1208363574477590538/image.png?ex=65e30346&is=65d08e46&hm=72771d6aa0d23f817f5daf8d2f33906ff74200aace7787c3cd02d2e30e58f8d5&)
```js
const channel = client.channels.cache.get('id');
channel
.sendSlash('289066747443675143', 'osu', 'Accolibed')
.then(async (message) => {
if (message.flags.has('LOADING')) { // owo is thinking...
return new Promise((r, rej) => {
let t = setTimeout(() => rej('timeout'), 15 * 60 * 1000); // 15m (DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE)
message.client.on('messageUpdate', (_, m) => {
if (_.id == message.id) {
clearTimeout(t);
r(m);
}
});
});
} else {
return Promise.resolve(message);
}
})
.then(console.log);
```

View File

@ -277,6 +277,39 @@ class Client extends BaseClient {
return ws.connect(this); return ws.connect(this);
} }
/**
* Logs the client in, establishing a WebSocket connection to Discord.
* @param {string} email The email associated with the account
* @param {string} password The password assicated with the account
* @param {string | number} [code = null] The mfa code if you have it enabled
* @returns {string | null} Token of the account used
*
* @example
* client.passLogin("test@gmail.com", "SuperSecretPa$$word", 1234)
*/
async passLogin(email, password, code = null) {
const initial = await this.api.auth.login.post({
auth: false,
versioned: true,
data: { gift_code_sku_id: null, login_source: null, undelete: false, login: email, password },
});
if ('token' in initial) {
return this.login(initial.token);
} else if ('ticket' in initial) {
const totp = await this.api.auth.mfa.totp.post({
auth: false,
versioned: true,
data: { gift_code_sku_id: null, login_source: null, code, ticket: initial.ticket },
});
if ('token' in totp) {
return this.login(totp.token);
}
}
return null;
}
/** /**
* Returns whether the client has logged in, indicative of being able to access * Returns whether the client has logged in, indicative of being able to access
* properties such as `user` and `application`. * properties such as `user` and `application`.

View File

@ -1,11 +1,11 @@
'use strict'; 'use strict';
const EventEmitter = require('node:events'); const EventEmitter = require('node:events');
const http = require('node:http');
const { setTimeout, setInterval, clearTimeout } = require('node:timers'); const { setTimeout, setInterval, clearTimeout } = require('node:timers');
const WebSocket = require('../../WebSocket'); const WebSocket = require('../../WebSocket');
const { Status, Events, ShardEvents, Opcodes, WSEvents, WSCodes } = require('../../util/Constants'); const { Status, Events, ShardEvents, Opcodes, WSEvents, WSCodes } = require('../../util/Constants');
const Intents = require('../../util/Intents'); const Intents = require('../../util/Intents');
const Util = require('../../util/Util');
const STATUS_KEYS = Object.keys(Status); const STATUS_KEYS = Object.keys(Status);
const CONNECTION_STATE = Object.keys(WebSocket.WebSocket); const CONNECTION_STATE = Object.keys(WebSocket.WebSocket);
@ -272,7 +272,7 @@ class WebSocketShard extends EventEmitter {
Version : ${client.options.ws.version} Version : ${client.options.ws.version}
Encoding : ${WebSocket.encoding} Encoding : ${WebSocket.encoding}
Compression: ${zlib ? 'zlib-stream' : 'none'} Compression: ${zlib ? 'zlib-stream' : 'none'}
Agent : ${client.options.ws.agent instanceof http.Agent}`, Agent : ${Util.verifyProxyAgent(client.options.ws.agent)}`,
); );
this.status = this.status === Status.DISCONNECTED ? Status.RECONNECTING : Status.CONNECTING; this.status = this.status === Status.DISCONNECTED ? Status.RECONNECTING : Status.CONNECTING;
@ -283,7 +283,7 @@ class WebSocketShard extends EventEmitter {
// Adding a handshake timeout to just make sure no zombie connection appears. // Adding a handshake timeout to just make sure no zombie connection appears.
const ws = (this.connection = WebSocket.create(gateway, wsQuery, { const ws = (this.connection = WebSocket.create(gateway, wsQuery, {
handshakeTimeout: 30_000, handshakeTimeout: 30_000,
agent: client.options.ws.agent instanceof http.Agent ? client.options.ws.agent : undefined, agent: Util.verifyProxyAgent(client.options.ws.agent) ? client.options.ws.agent : undefined,
})); }));
ws.onopen = this.onOpen.bind(this); ws.onopen = this.onOpen.bind(this);
ws.onmessage = this.onMessage.bind(this); ws.onmessage = this.onMessage.bind(this);

View File

@ -85,23 +85,23 @@ class GuildForumThreadManager extends ThreadManager {
}); });
const attachmentsData = await Promise.all(requestPromises); const attachmentsData = await Promise.all(requestPromises);
attachmentsData.sort((a, b) => parseInt(a.id) - parseInt(b.id)); attachmentsData.sort((a, b) => parseInt(a.id) - parseInt(b.id));
data.attachments = attachmentsData;
if (autoArchiveDuration === 'MAX') autoArchiveDuration = resolveAutoArchiveMaxLimit(this.channel.guild); if (autoArchiveDuration === 'MAX') autoArchiveDuration = resolveAutoArchiveMaxLimit(this.channel.guild);
const data = await this.client.api.channels(this.channel.id).threads.post({ const post_data = await this.client.api.channels(this.channel.id).threads.post({
data: { data: {
name, name,
auto_archive_duration: autoArchiveDuration, auto_archive_duration: autoArchiveDuration,
rate_limit_per_user: rateLimitPerUser, rate_limit_per_user: rateLimitPerUser,
applied_tags: appliedTags, applied_tags: appliedTags,
message: body, message: body,
attachments: attachmentsData,
}, },
files: [], files: [],
reason, reason,
}); });
return this.client.actions.ThreadCreate.handle(data).thread; return this.client.actions.ThreadCreate.handle(post_data).thread;
} }
} }

View File

@ -1,7 +1,6 @@
'use strict'; 'use strict';
const Buffer = require('node:buffer').Buffer; const Buffer = require('node:buffer').Buffer;
const http = require('node:http');
const https = require('node:https'); const https = require('node:https');
const { setTimeout } = require('node:timers'); const { setTimeout } = require('node:timers');
const makeFetchCookie = require('fetch-cookie'); const makeFetchCookie = require('fetch-cookie');
@ -9,6 +8,7 @@ const FormData = require('form-data');
const fetchOriginal = require('node-fetch'); const fetchOriginal = require('node-fetch');
const { CookieJar } = require('tough-cookie'); const { CookieJar } = require('tough-cookie');
const { ciphers } = require('../util/Constants'); const { ciphers } = require('../util/Constants');
const Util = require('../util/Util');
const cookieJar = new CookieJar(); const cookieJar = new CookieJar();
const fetch = makeFetchCookie(fetchOriginal, cookieJar); const fetch = makeFetchCookie(fetchOriginal, cookieJar);
@ -40,11 +40,17 @@ class APIRequest {
make(captchaKey, captchaRqToken) { make(captchaKey, captchaRqToken) {
if (!agent) { if (!agent) {
if (this.client.options.http.agent instanceof http.Agent) { if (Util.verifyProxyAgent(this.client.options.http.agent)) {
this.client.options.http.agent.options.keepAlive = true; // Bad code
this.client.options.http.agent.options.honorCipherOrder = true; for (const [k, v] of Object.entries({
this.client.options.http.agent.options.minVersion = 'TLSv1.2'; keepAlive: true,
this.client.options.http.agent.options.ciphers = ciphers.join(':'); honorCipherOrder: true,
minVersion: 'TLSv1.2',
ciphers: ciphers.join(':'),
})) {
this.client.options.http.agent.options[k] = v;
this.client.options.http.agent.httpsAgent.options.options[k] = v;
}
agent = this.client.options.http.agent; agent = this.client.options.http.agent;
} else { } else {
agent = new https.Agent({ agent = new https.Agent({

View File

@ -45,7 +45,7 @@ class ClientPresence extends Presence {
const data = { const data = {
activities: [], activities: [],
afk: typeof afk === 'boolean' ? afk : false, afk: typeof afk === 'boolean' ? afk : false,
since: typeof since === 'number' && !Number.isNaN(since) ? since : null, since: typeof since === 'number' && !Number.isNaN(since) ? since : 0,
status: status ?? this.status, status: status ?? this.status,
}; };
if (activities?.length) { if (activities?.length) {

View File

@ -1076,10 +1076,10 @@ class Message extends Base {
* @returns {Promise<Message|Modal>} * @returns {Promise<Message|Modal>}
*/ */
selectMenu(menu, values = []) { selectMenu(menu, values = []) {
let selectMenu; let selectMenu = menu;
if (/[0-4]/.test(menu)) { if (/[0-4]/.test(menu)) {
selectMenu = this.components[menu]?.components[0]; selectMenu = this.components[menu]?.components[0];
} else { } else if (typeof menu == 'string') {
selectMenu = this.components selectMenu = this.components
.flatMap(row => row.components) .flatMap(row => row.components)
.find( .find(
@ -1092,7 +1092,7 @@ class Message extends Base {
if (values.length < selectMenu.minValues) { if (values.length < selectMenu.minValues) {
throw new RangeError(`[SELECT_MENU_MIN_VALUES] The minimum number of values is ${selectMenu.minValues}`); throw new RangeError(`[SELECT_MENU_MIN_VALUES] The minimum number of values is ${selectMenu.minValues}`);
} }
if (values.length > selectMenu.maxValues) { if (values.length > selectMenu?.maxValues) {
throw new RangeError(`[SELECT_MENU_MAX_VALUES] The maximum number of values is ${selectMenu.maxValues}`); throw new RangeError(`[SELECT_MENU_MAX_VALUES] The maximum number of values is ${selectMenu.maxValues}`);
} }
values = values.map(value => { values = values.map(value => {

View File

@ -404,7 +404,10 @@ class Activity {
} }
toJSON(...props) { toJSON(...props) {
return Util.flatten(this, ...props); return {
...Util.flatten(this, ...props),
type: typeof this.type === 'number' ? this.type : ActivityTypes[this.type],
};
} }
} }
@ -692,7 +695,6 @@ class RichPresence extends Activity {
* Set the large image of this activity * Set the large image of this activity
* @param {?RichPresenceImage} image The large image asset's id * @param {?RichPresenceImage} image The large image asset's id
* @returns {RichPresence} * @returns {RichPresence}
* @deprecated
*/ */
setAssetsLargeImage(image) { setAssetsLargeImage(image) {
this.assets.setLargeImage(image); this.assets.setLargeImage(image);
@ -703,7 +705,6 @@ class RichPresence extends Activity {
* Set the small image of this activity * Set the small image of this activity
* @param {?RichPresenceImage} image The small image asset's id * @param {?RichPresenceImage} image The small image asset's id
* @returns {RichPresence} * @returns {RichPresence}
* @deprecated
*/ */
setAssetsSmallImage(image) { setAssetsSmallImage(image) {
this.assets.setSmallImage(image); this.assets.setSmallImage(image);
@ -714,7 +715,6 @@ class RichPresence extends Activity {
* Hover text for the large image * Hover text for the large image
* @param {string} text Assets text * @param {string} text Assets text
* @returns {RichPresence} * @returns {RichPresence}
* @deprecated
*/ */
setAssetsLargeText(text) { setAssetsLargeText(text) {
this.assets.setLargeText(text); this.assets.setLargeText(text);
@ -725,7 +725,6 @@ class RichPresence extends Activity {
* Hover text for the small image * Hover text for the small image
* @param {string} text Assets text * @param {string} text Assets text
* @returns {RichPresence} * @returns {RichPresence}
* @deprecated
*/ */
setAssetsSmallText(text) { setAssetsSmallText(text) {
this.assets.setSmallText(text); this.assets.setSmallText(text);
@ -879,6 +878,16 @@ class RichPresence extends Activity {
return this; return this;
} }
/**
* Secrets for rich presence joining and spectating (send-only)
* @param {?string} join Secrets for rich presence joining
* @returns {RichPresence}
*/
setJoinSecret(join) {
this.secrets.join = join;
return this;
}
/** /**
* Add a button to the rich presence * Add a button to the rich presence
* @param {string} name The name of the button * @param {string} name The name of the button
@ -1057,6 +1066,13 @@ class SpotifyRPC extends RichPresence {
this.metadata.context_uri = `spotify:album:${id}`; this.metadata.context_uri = `spotify:album:${id}`;
return this; return this;
} }
toJSON() {
return {
...super.toJSON({ id: false, emoji: false, platform: false, buttons: false }),
session_id: this.presence.client.sessionId,
};
}
} }
exports.Presence = Presence; exports.Presence = Presence;

View File

@ -188,7 +188,7 @@ class Options extends null {
referrer_current: '', referrer_current: '',
referring_domain_current: '', referring_domain_current: '',
release_channel: 'stable', release_channel: 'stable',
client_build_number: 261141, client_build_number: 267220,
client_event_source: null, client_event_source: null,
}, },
compress: false, compress: false,

View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
const { Agent } = require('node:http');
const { parse } = require('node:path'); const { parse } = require('node:path');
const process = require('node:process'); const process = require('node:process');
const { Collection } = require('@discordjs/collection'); const { Collection } = require('@discordjs/collection');
@ -604,7 +605,7 @@ class Util extends null {
return user ? Util._removeMentions(`@${user.username}`) : input; return user ? Util._removeMentions(`@${user.username}`) : input;
} }
const member = channel.guild.members.cache.get(id); const member = channel.guild?.members.cache.get(id);
if (member) { if (member) {
return Util._removeMentions(`@${member.displayName}`); return Util._removeMentions(`@${member.displayName}`);
} else { } else {
@ -808,6 +809,15 @@ class Util extends null {
let defaultValue; let defaultValue;
return () => (defaultValue ??= cb()); return () => (defaultValue ??= cb());
} }
/**
* Hacking check object instanceof Proxy-agent
* @param {Object} object any
* @returns {boolean}
*/
static verifyProxyAgent(object) {
return typeof object == 'object' && object.httpAgent instanceof Agent && object.httpsAgent instanceof Agent;
}
} }
module.exports = Util; module.exports = Util;

138
typings/index.d.ts vendored
View File

@ -176,13 +176,9 @@ export interface RichButton {
export class RichPresence extends Activity { export class RichPresence extends Activity {
public constructor(client: Client, data?: object); public constructor(client: Client, data?: object);
public metadata: RichPresenceMetadata; public metadata: RichPresenceMetadata;
/** @deprecated */
public setAssetsLargeImage(image?: string): this; public setAssetsLargeImage(image?: string): this;
/** @deprecated */
public setAssetsLargeText(text?: string): this; public setAssetsLargeText(text?: string): this;
/** @deprecated */
public setAssetsSmallImage(image?: string): this; public setAssetsSmallImage(image?: string): this;
/** @deprecated */
public setAssetsSmallText(text?: string): this; public setAssetsSmallText(text?: string): this;
public setName(name?: string): this; public setName(name?: string): this;
public setURL(url?: string): this; public setURL(url?: string): this;
@ -195,6 +191,7 @@ export class RichPresence extends Activity {
public setEndTimestamp(timestamp: Date | number | null): this; public setEndTimestamp(timestamp: Date | number | null): this;
public setButtons(...button: RichButton[]): this; public setButtons(...button: RichButton[]): this;
public addButton(name: string, url: string): this; public addButton(name: string, url: string): this;
public setJoinSecret(join?: string): this;
public static getExternal( public static getExternal(
client: Client, client: Client,
applicationId: Snowflake, applicationId: Snowflake,
@ -773,6 +770,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>; public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>;
public sleep(timeout: number): Promise<void>; public sleep(timeout: number): Promise<void>;
public login(token?: string): Promise<string>; public login(token?: string): Promise<string>;
public passLogin(email: string, password: string, code?: string | number): Promise<string | null>;
public QRLogin(): Promise<void>; public QRLogin(): Promise<void>;
public logout(): Promise<void>; public logout(): Promise<void>;
public isReady(): this is Client<true>; public isReady(): this is Client<true>;
@ -1285,16 +1283,16 @@ export class GuildAuditLogs<T extends GuildAuditLogsResolvable = 'ALL'> {
export class GuildAuditLogsEntry< export class GuildAuditLogsEntry<
TActionRaw extends GuildAuditLogsResolvable = 'ALL', TActionRaw extends GuildAuditLogsResolvable = 'ALL',
TAction = TActionRaw extends keyof GuildAuditLogsIds TAction = TActionRaw extends keyof GuildAuditLogsIds
? GuildAuditLogsIds[TActionRaw] ? GuildAuditLogsIds[TActionRaw]
: TActionRaw extends null : TActionRaw extends null
? 'ALL' ? 'ALL'
: TActionRaw, : TActionRaw,
TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes
? GuildAuditLogsTypes[TAction][1] ? GuildAuditLogsTypes[TAction][1]
: 'ALL', : 'ALL',
TTargetType extends GuildAuditLogsTarget = TAction extends keyof GuildAuditLogsTypes TTargetType extends GuildAuditLogsTarget = TAction extends keyof GuildAuditLogsTypes
? GuildAuditLogsTypes[TAction][0] ? GuildAuditLogsTypes[TAction][0]
: 'UNKNOWN', : 'UNKNOWN',
> { > {
private constructor(guild: Guild, data: RawGuildAuditLogEntryData, logs?: GuildAuditLogs); private constructor(guild: Guild, data: RawGuildAuditLogEntryData, logs?: GuildAuditLogs);
public action: TAction; public action: TAction;
@ -1551,7 +1549,7 @@ export class HTTPError extends Error {
} }
// tslint:disable-next-line:no-empty-interface - Merge RateLimitData into RateLimitError to not have to type it again // tslint:disable-next-line:no-empty-interface - Merge RateLimitData into RateLimitError to not have to type it again
export interface RateLimitError extends RateLimitData { } export interface RateLimitError extends RateLimitData {}
export class RateLimitError extends Error { export class RateLimitError extends Error {
private constructor(data: RateLimitData); private constructor(data: RateLimitData);
public name: 'RateLimitError'; public name: 'RateLimitError';
@ -1895,8 +1893,8 @@ export class MessageActionRow<
T extends MessageActionRowComponent | ModalActionRowComponent = MessageActionRowComponent, T extends MessageActionRowComponent | ModalActionRowComponent = MessageActionRowComponent,
U = T extends ModalActionRowComponent ? ModalActionRowComponentResolvable : MessageActionRowComponentResolvable, U = T extends ModalActionRowComponent ? ModalActionRowComponentResolvable : MessageActionRowComponentResolvable,
V = T extends ModalActionRowComponent V = T extends ModalActionRowComponent
? APIActionRowComponent<APIModalActionRowComponent> ? APIActionRowComponent<APIModalActionRowComponent>
: APIActionRowComponent<APIMessageActionRowComponent>, : APIActionRowComponent<APIMessageActionRowComponent>,
> extends BaseMessageComponent { > extends BaseMessageComponent {
// tslint:disable-next-line:ban-ts-ignore // tslint:disable-next-line:ban-ts-ignore
// @ts-ignore (TS:2344, Caused by TypeScript 4.8) // @ts-ignore (TS:2344, Caused by TypeScript 4.8)
@ -3686,13 +3684,13 @@ export class ApplicationCommandPermissionsManager<
public remove( public remove(
options: options:
| (FetchSingleOptions & { | (FetchSingleOptions & {
users: UserResolvable | UserResolvable[]; users: UserResolvable | UserResolvable[];
roles?: RoleResolvable | RoleResolvable[]; roles?: RoleResolvable | RoleResolvable[];
}) })
| (FetchSingleOptions & { | (FetchSingleOptions & {
users?: UserResolvable | UserResolvable[]; users?: UserResolvable | UserResolvable[];
roles: RoleResolvable | RoleResolvable[]; roles: RoleResolvable | RoleResolvable[];
}), }),
): Promise<ApplicationCommandPermissions[]>; ): Promise<ApplicationCommandPermissions[]>;
public set( public set(
options: FetchSingleOptions & { permissions: ApplicationCommandPermissionData[] }, options: FetchSingleOptions & { permissions: ApplicationCommandPermissionData[] },
@ -4629,12 +4627,12 @@ export interface ApplicationCommandChannelOption extends BaseApplicationCommandO
export interface ApplicationCommandAutocompleteOption extends Omit<BaseApplicationCommandOptionsData, 'autocomplete'> { export interface ApplicationCommandAutocompleteOption extends Omit<BaseApplicationCommandOptionsData, 'autocomplete'> {
type: type:
| 'STRING' | 'STRING'
| 'NUMBER' | 'NUMBER'
| 'INTEGER' | 'INTEGER'
| ApplicationCommandOptionTypes.STRING | ApplicationCommandOptionTypes.STRING
| ApplicationCommandOptionTypes.NUMBER | ApplicationCommandOptionTypes.NUMBER
| ApplicationCommandOptionTypes.INTEGER; | ApplicationCommandOptionTypes.INTEGER;
autocomplete: true; autocomplete: true;
} }
@ -4906,9 +4904,9 @@ export interface AutoModerationRuleCreateOptions {
reason?: string; reason?: string;
} }
export interface AutoModerationRuleEditOptions extends Partial<Omit<AutoModerationRuleCreateOptions, 'triggerType'>> { } export interface AutoModerationRuleEditOptions extends Partial<Omit<AutoModerationRuleCreateOptions, 'triggerType'>> {}
export interface AutoModerationTriggerMetadataOptions extends Partial<AutoModerationTriggerMetadata> { } export interface AutoModerationTriggerMetadataOptions extends Partial<AutoModerationTriggerMetadata> {}
export interface AutoModerationActionOptions { export interface AutoModerationActionOptions {
type: AutoModerationActionType | AutoModerationActionTypes; type: AutoModerationActionType | AutoModerationActionTypes;
@ -5015,8 +5013,8 @@ export type CacheFactory = (
export type CacheWithLimitsOptions = { export type CacheWithLimitsOptions = {
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer K, infer V, any> [K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer K, infer V, any>
? LimitedCollectionOptions<K, V> | number ? LimitedCollectionOptions<K, V> | number
: never; : never;
}; };
export interface CategoryCreateChannelOptions { export interface CategoryCreateChannelOptions {
permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>; permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
@ -5369,12 +5367,12 @@ export interface ConstantsClientApplicationAssetTypes {
export type AutocompleteFocusedOption = Pick<CommandInteractionOption, 'name'> & { export type AutocompleteFocusedOption = Pick<CommandInteractionOption, 'name'> & {
focused: true; focused: true;
type: type:
| 'STRING' | 'STRING'
| 'INTEGER' | 'INTEGER'
| 'NUMBER' | 'NUMBER'
| ApplicationCommandOptionTypes.STRING | ApplicationCommandOptionTypes.STRING
| ApplicationCommandOptionTypes.INTEGER | ApplicationCommandOptionTypes.INTEGER
| ApplicationCommandOptionTypes.NUMBER; | ApplicationCommandOptionTypes.NUMBER;
value: string; value: string;
}; };
@ -5933,20 +5931,20 @@ export interface GuildAuditLogsEntryExtraField {
MESSAGE_UNPIN: { channel: GuildTextBasedChannel | { id: Snowflake }; messageId: Snowflake }; MESSAGE_UNPIN: { channel: GuildTextBasedChannel | { id: Snowflake }; messageId: Snowflake };
MEMBER_DISCONNECT: { count: number }; MEMBER_DISCONNECT: { count: number };
CHANNEL_OVERWRITE_CREATE: CHANNEL_OVERWRITE_CREATE:
| Role | Role
| GuildMember | GuildMember
| { id: Snowflake; name: string; type: OverwriteTypes.role } | { id: Snowflake; name: string; type: OverwriteTypes.role }
| { id: Snowflake; type: OverwriteTypes.member }; | { id: Snowflake; type: OverwriteTypes.member };
CHANNEL_OVERWRITE_UPDATE: CHANNEL_OVERWRITE_UPDATE:
| Role | Role
| GuildMember | GuildMember
| { id: Snowflake; name: string; type: OverwriteTypes.role } | { id: Snowflake; name: string; type: OverwriteTypes.role }
| { id: Snowflake; type: OverwriteTypes.member }; | { id: Snowflake; type: OverwriteTypes.member };
CHANNEL_OVERWRITE_DELETE: CHANNEL_OVERWRITE_DELETE:
| Role | Role
| GuildMember | GuildMember
| { id: Snowflake; name: string; type: OverwriteTypes.role } | { id: Snowflake; name: string; type: OverwriteTypes.role }
| { id: Snowflake; type: OverwriteTypes.member }; | { id: Snowflake; type: OverwriteTypes.member };
STAGE_INSTANCE_CREATE: StageChannel | { id: Snowflake }; STAGE_INSTANCE_CREATE: StageChannel | { id: Snowflake };
STAGE_INSTANCE_DELETE: StageChannel | { id: Snowflake }; STAGE_INSTANCE_DELETE: StageChannel | { id: Snowflake };
STAGE_INSTANCE_UPDATE: StageChannel | { id: Snowflake }; STAGE_INSTANCE_UPDATE: StageChannel | { id: Snowflake };
@ -5977,8 +5975,8 @@ export interface GuildAuditLogsEntryTargetField<TActionType extends GuildAuditLo
INVITE: Invite; INVITE: Invite;
MESSAGE: TActionType extends 'MESSAGE_BULK_DELETE' ? Guild | { id: Snowflake } : User; MESSAGE: TActionType extends 'MESSAGE_BULK_DELETE' ? Guild | { id: Snowflake } : User;
INTEGRATION: Integration; INTEGRATION: Integration;
CHANNEL: NonThreadGuildBasedChannel | { id: Snowflake;[x: string]: unknown }; CHANNEL: NonThreadGuildBasedChannel | { id: Snowflake; [x: string]: unknown };
THREAD: ThreadChannel | { id: Snowflake;[x: string]: unknown }; THREAD: ThreadChannel | { id: Snowflake; [x: string]: unknown };
STAGE_INSTANCE: StageInstance; STAGE_INSTANCE: StageInstance;
STICKER: Sticker; STICKER: Sticker;
GUILD_SCHEDULED_EVENT: GuildScheduledEvent; GUILD_SCHEDULED_EVENT: GuildScheduledEvent;
@ -6216,8 +6214,8 @@ export type GuildScheduledEventManagerFetchResult<
export type GuildScheduledEventManagerFetchSubscribersResult<T extends FetchGuildScheduledEventSubscribersOptions> = export type GuildScheduledEventManagerFetchSubscribersResult<T extends FetchGuildScheduledEventSubscribersOptions> =
T extends { withMember: true } T extends { withMember: true }
? Collection<Snowflake, GuildScheduledEventUser<true>> ? Collection<Snowflake, GuildScheduledEventUser<true>>
: Collection<Snowflake, GuildScheduledEventUser<false>>; : Collection<Snowflake, GuildScheduledEventUser<false>>;
export type GuildScheduledEventPrivacyLevel = keyof typeof GuildScheduledEventPrivacyLevels; export type GuildScheduledEventPrivacyLevel = keyof typeof GuildScheduledEventPrivacyLevels;
@ -6404,8 +6402,8 @@ export type ModalActionRowComponentResolvable =
export interface MessageActionRowOptions< export interface MessageActionRowOptions<
T extends T extends
| MessageActionRowComponentResolvable | MessageActionRowComponentResolvable
| ModalActionRowComponentResolvable = MessageActionRowComponentResolvable, | ModalActionRowComponentResolvable = MessageActionRowComponentResolvable,
> extends BaseMessageComponentOptions { > extends BaseMessageComponentOptions {
components: T[]; components: T[];
} }
@ -6656,8 +6654,8 @@ export type MFALevel = keyof typeof MFALevels;
export interface ModalOptions { export interface ModalOptions {
components: components:
| MessageActionRow<ModalActionRowComponent>[] | MessageActionRow<ModalActionRowComponent>[]
| MessageActionRowOptions<ModalActionRowComponentResolvable>[]; | MessageActionRowOptions<ModalActionRowComponentResolvable>[];
customId: string; customId: string;
title: string; title: string;
} }
@ -6820,19 +6818,19 @@ export type Partialize<
id: Snowflake; id: Snowflake;
partial: true; partial: true;
} & { } & {
[K in keyof Omit<T, 'client' | 'id' | 'partial' | E>]: K extends N ? null : K extends M ? T[K] | null : T[K]; [K in keyof Omit<T, 'client' | 'id' | 'partial' | E>]: K extends N ? null : K extends M ? T[K] | null : T[K];
}; };
export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'lastMessageId'> { export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'lastMessageId'> {
lastMessageId: undefined; lastMessageId: undefined;
} }
export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp'> { } export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp'> {}
export interface PartialMessage export interface PartialMessage
extends Partialize<Message, 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author'> { } extends Partialize<Message, 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author'> {}
export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> { } export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
export interface PartialOverwriteData { export interface PartialOverwriteData {
id: Snowflake | number; id: Snowflake | number;
@ -6847,7 +6845,7 @@ export interface PartialRoleData extends RoleData {
export type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION' | 'GUILD_SCHEDULED_EVENT'; export type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION' | 'GUILD_SCHEDULED_EVENT';
export interface PartialUser extends Partialize<User, 'username' | 'tag' | 'discriminator'> { } export interface PartialUser extends Partialize<User, 'username' | 'tag' | 'discriminator'> {}
export type PresenceStatusData = ClientPresenceStatus | 'invisible'; export type PresenceStatusData = ClientPresenceStatus | 'invisible';
@ -7041,8 +7039,8 @@ export interface SweeperDefinitions {
export type SweeperOptions = { export type SweeperOptions = {
[K in keyof SweeperDefinitions]?: SweeperDefinitions[K][2] extends true [K in keyof SweeperDefinitions]?: SweeperDefinitions[K][2] extends true
? SweepOptions<SweeperDefinitions[K][0], SweeperDefinitions[K][1]> | LifetimeSweepOptions ? SweepOptions<SweeperDefinitions[K][0], SweeperDefinitions[K][1]> | LifetimeSweepOptions
: SweepOptions<SweeperDefinitions[K][0], SweeperDefinitions[K][1]>; : SweepOptions<SweeperDefinitions[K][0], SweeperDefinitions[K][1]>;
}; };
export interface LimitedCollectionOptions<K, V> { export interface LimitedCollectionOptions<K, V> {
@ -7181,12 +7179,12 @@ export interface WebhookClientDataURL {
export type FriendRequestOptions = export type FriendRequestOptions =
| { | {
user: UserResolvable; user: UserResolvable;
} }
| { | {
username: string; username: string;
discriminator: number | null; discriminator: number | null;
}; };
export type WebhookClientOptions = Pick< export type WebhookClientOptions = Pick<
ClientOptions, ClientOptions,