Merge branch 'aiko-chan-ai:main' into main
This commit is contained in:
commit
e6854991c9
@ -704,8 +704,6 @@ class WebSocketShard extends EventEmitter {
|
||||
// Remove: shard: [this.id, Number(client.options.shardCount)],
|
||||
};
|
||||
|
||||
delete d.large_threshold;
|
||||
|
||||
this.debug(
|
||||
`[IDENTIFY] Shard ${this.id}/${client.options.shardCount} with intents: ${Intents.resolve(
|
||||
client.options.intents,
|
||||
|
@ -8,6 +8,7 @@ const BaseMessageComponent = require('./BaseMessageComponent');
|
||||
const ClientApplication = require('./ClientApplication');
|
||||
const InteractionCollector = require('./InteractionCollector');
|
||||
const MessageAttachment = require('./MessageAttachment');
|
||||
const MessageButton = require('./MessageButton');
|
||||
const Embed = require('./MessageEmbed');
|
||||
const Mentions = require('./MessageMentions');
|
||||
const MessagePayload = require('./MessagePayload');
|
||||
@ -1029,33 +1030,26 @@ class Message extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Click specific button [Suggestion: Dux#2925]
|
||||
* @param {string} buttonID Button ID
|
||||
* Click specific button
|
||||
* @param {MessageButton|string} button Button ID
|
||||
* @returns {Promise<InteractionResponseBody>}
|
||||
*/
|
||||
async clickButton(buttonID) {
|
||||
if (typeof buttonID !== 'string') {
|
||||
clickButton(button) {
|
||||
let buttonID;
|
||||
if (button instanceof MessageButton) button = button.customId;
|
||||
if (typeof button === 'string') buttonID = button;
|
||||
if (!buttonID) {
|
||||
throw new TypeError('BUTTON_ID_NOT_STRING');
|
||||
}
|
||||
if (!this.components[0]) throw new TypeError('MESSAGE_NO_COMPONENTS');
|
||||
let button;
|
||||
await Promise.all(
|
||||
this.components.map(async row => {
|
||||
await Promise.all(
|
||||
row.components.map(interactionComponent => {
|
||||
if (interactionComponent.type == 'BUTTON' && interactionComponent.customId == buttonID) {
|
||||
button = interactionComponent;
|
||||
}
|
||||
return true;
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
if (!button) {
|
||||
throw new TypeError('BUTTON_NOT_FOUND');
|
||||
} else {
|
||||
return button.click(this);
|
||||
for (const components of this.components) {
|
||||
for (const interactionComponent of components.components) {
|
||||
if (interactionComponent.type == 'BUTTON' && interactionComponent.customId == buttonID) {
|
||||
return interactionComponent.click(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new TypeError('BUTTON_NOT_FOUND');
|
||||
}
|
||||
/**
|
||||
* Select specific menu or First Menu
|
||||
|
@ -6,28 +6,28 @@ const Package = (exports.Package = require('../../package.json'));
|
||||
const { Error, RangeError, TypeError } = require('../errors');
|
||||
// #88: https://jnrbsn.github.io/user-agents/user-agents.json
|
||||
const listUserAgent = [
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12.5; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (X11; Linux i686; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12.6; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (X11; Linux i686; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12.5; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12.6; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 Edg/104.0.1293.63',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_5_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 Edg/104.0.1293.63',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.50',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.50',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -108,8 +108,8 @@ const { randomUA } = require('../util/Constants');
|
||||
/**
|
||||
* WebSocket options (these are left as snake_case to match the API)
|
||||
* @typedef {Object} WebsocketOptions
|
||||
* @property {number} [large_threshold=50] Number of members in a guild after which offline users will no longer be
|
||||
* sent in the initial guild member list, must be between 50 and 250
|
||||
* @property {boolean} [compress=false] Whether to compress data sent on the connection
|
||||
* @property {WebSocketProperties} [properties] Properties to identify the client with
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -171,24 +171,23 @@ class Options extends null {
|
||||
sweepers: {},
|
||||
proxy: '',
|
||||
ws: {
|
||||
large_threshold: 50,
|
||||
compress: false,
|
||||
properties: {
|
||||
os: 'Windows',
|
||||
browser: 'Chrome',
|
||||
device: '',
|
||||
system_locale: 'en-US',
|
||||
browser_version: '104.0.0.0',
|
||||
browser_version: '105.0.0.0',
|
||||
os_version: '10',
|
||||
referrer: '',
|
||||
referring_domain: '',
|
||||
referrer_current: '',
|
||||
referring_domain_current: '',
|
||||
release_channel: 'stable',
|
||||
client_build_number: 142510,
|
||||
client_build_number: 149043,
|
||||
client_event_source: null,
|
||||
},
|
||||
// ? capabilities: 509,
|
||||
// ? capabilities: 1021,
|
||||
version: 9,
|
||||
client_state: {
|
||||
guild_hashes: {},
|
||||
@ -196,6 +195,7 @@ class Options extends null {
|
||||
read_state_version: 0,
|
||||
user_guild_settings_version: -1,
|
||||
user_settings_version: -1,
|
||||
private_channels_version: '0',
|
||||
},
|
||||
},
|
||||
http: {
|
||||
|
3
typings/index.d.ts
vendored
3
typings/index.d.ts
vendored
@ -1929,7 +1929,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
|
||||
// Added
|
||||
public markUnread(): Promise<boolean>;
|
||||
public markRead(): Promise<boolean>;
|
||||
public clickButton(buttonID: string): Promise<InteractionResponseBody>;
|
||||
public clickButton(button: MessageButton | string): Promise<InteractionResponseBody>;
|
||||
public selectMenu(menuID: string, options: string[]): Promise<InteractionResponseBody>;
|
||||
public selectMenu(options: string[]): Promise<InteractionResponseBody>;
|
||||
public contextMenu(botID: Snowflake, commandName: string): Promise<InteractionResponseBody>;
|
||||
@ -6703,7 +6703,6 @@ export interface WebhookMessageOptions extends Omit<MessageOptions, 'reply' | 's
|
||||
export type WebhookType = keyof typeof WebhookTypes;
|
||||
|
||||
export interface WebSocketOptions {
|
||||
large_threshold?: number;
|
||||
compress?: boolean;
|
||||
properties?: WebSocketProperties;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user