mirror of
https://github.com/discordjs/discord.js.git
synced 2026-05-25 13:00:08 +00:00
Compare commits
8 Commits
@discordjs
...
14.14.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2550c7931d | ||
|
|
40726db722 | ||
|
|
1e4ef35436 | ||
|
|
4bc1dae36f | ||
|
|
cc07a28f12 | ||
|
|
f93abf7e35 | ||
|
|
f0ec70dfda | ||
|
|
8a6045f600 |
@@ -2,6 +2,16 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [create-discord-bot@0.2.3](https://github.com/discordjs/discord.js/compare/create-discord-bot/0.2.2...create-discord-bot/0.2.3) - (2023-11-12)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Import picocolors as default (#9949) ([8a6045f](https://github.com/discordjs/discord.js/commit/8a6045f6003971dbf64c8576f08631751b982ae4))
|
||||
|
||||
## Features
|
||||
|
||||
- Bump package versions ([e8bd354](https://github.com/discordjs/discord.js/commit/e8bd35405239616b12cb5f09eb983f5251298aca))
|
||||
|
||||
# [create-discord-bot@0.2.2](https://github.com/discordjs/discord.js/compare/create-discord-bot@0.2.1...create-discord-bot@0.2.2) - (2023-11-12)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// eslint-disable-next-line n/shebang
|
||||
import process from 'node:process';
|
||||
import { Option, program } from 'commander';
|
||||
import { red, yellow, green } from 'picocolors';
|
||||
import picocolors from 'picocolors';
|
||||
import prompts from 'prompts';
|
||||
import validateProjectName from 'validate-npm-package-name';
|
||||
import packageJSON from '../package.json' assert { type: 'json' };
|
||||
@@ -34,7 +34,7 @@ program
|
||||
.version(packageJSON.version)
|
||||
.description('Create a basic discord.js bot.')
|
||||
.argument('[directory]', 'What is the name of the directory you want to create this project in?')
|
||||
.usage(`${green('<directory>')}`)
|
||||
.usage(`${picocolors.green('<directory>')}`)
|
||||
.action((directory) => {
|
||||
projectDirectory = directory;
|
||||
})
|
||||
@@ -68,13 +68,13 @@ if (!projectDirectory) {
|
||||
const errors = [];
|
||||
|
||||
for (const error of [...(validationResult.errors ?? []), ...(validationResult.warnings ?? [])]) {
|
||||
errors.push(red(`- ${error}`));
|
||||
errors.push(picocolors.red(`- ${error}`));
|
||||
}
|
||||
|
||||
return red(
|
||||
`Cannot create a project named ${yellow(
|
||||
return picocolors.red(
|
||||
`Cannot create a project named ${picocolors.yellow(
|
||||
`"${directory}"`,
|
||||
)} due to npm naming restrictions.\n\nErrors:\n${errors.join('\n')}\n\n${red(
|
||||
)} due to npm naming restrictions.\n\nErrors:\n${errors.join('\n')}\n\n${picocolors.red(
|
||||
'\nSee https://docs.npmjs.com/cli/configuring-npm/package-json for more details.',
|
||||
)}}`,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "create-discord-bot",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "A simple way to create a startup Discord bot.",
|
||||
"scripts": {
|
||||
"build": "tsc --noEmit && tsup",
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"start": "bun run src/index.[REPLACE_IMPORT_EXT]"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.0.1",
|
||||
"discord.js": "^14.13.0"
|
||||
"@discordjs/core": "^1.1.0",
|
||||
"discord.js": "^14.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sapphire/ts-config": "^4.0.1",
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"start": "bun run src/index.[REPLACE_IMPORT_EXT]"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.0.1",
|
||||
"discord.js": "^14.13.0"
|
||||
"@discordjs/core": "^1.1.0",
|
||||
"discord.js": "^14.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sapphire/ts-config": "^5.0.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RESTPostAPIApplicationCommandsJSONBody, CommandInteraction } from 'npm:discord.js@^14.13.0';
|
||||
import type { RESTPostAPIApplicationCommandsJSONBody, CommandInteraction } from 'npm:discord.js@^14.14.0';
|
||||
import type { StructurePredicate } from '../util/loaders.ts';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ClientEvents } from 'npm:discord.js@^14.13.0';
|
||||
import type { ClientEvents } from 'npm:discord.js@^14.14.0';
|
||||
import type { StructurePredicate } from '../util/loaders.ts';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Events } from 'npm:discord.js@^14.13.0';
|
||||
import { Events } from 'npm:discord.js@^14.14.0';
|
||||
import type { Event } from './index.ts';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'https://deno.land/std@0.199.0/dotenv/load.ts';
|
||||
import { URL } from 'node:url';
|
||||
import { Client, GatewayIntentBits } from 'npm:discord.js@^14.13.0';
|
||||
import { Client, GatewayIntentBits } from 'npm:discord.js@^14.14.0';
|
||||
import { loadCommands, loadEvents } from './util/loaders.ts';
|
||||
import { registerEvents } from './util/registerEvents.ts';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'https://deno.land/std@0.199.0/dotenv/load.ts';
|
||||
import { URL } from 'node:url';
|
||||
import { API } from 'npm:@discordjs/core@^1.0.1/http-only';
|
||||
import { REST } from 'npm:discord.js@^14.13.0';
|
||||
import { API } from 'npm:@discordjs/core@^1.1.0/http-only';
|
||||
import { REST } from 'npm:discord.js@^14.14.0';
|
||||
import { loadCommands } from './loaders.ts';
|
||||
|
||||
const commands = await loadCommands(new URL('../commands/', import.meta.url));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Events, type Client } from 'npm:discord.js@^14.13.0';
|
||||
import { Events, type Client } from 'npm:discord.js@^14.14.0';
|
||||
import type { Command } from '../commands/index.ts';
|
||||
import type { Event } from '../events/index.ts';
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"deploy": "node --require dotenv/config src/util/deploy.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.0.1",
|
||||
"discord.js": "^14.13.0",
|
||||
"@discordjs/core": "^1.1.0",
|
||||
"discord.js": "^14.14.0",
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
"start": "node --require dotenv/config dist/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/core": "^1.0.1",
|
||||
"discord.js": "^14.13.0",
|
||||
"@discordjs/core": "^1.1.0",
|
||||
"discord.js": "^14.14.0",
|
||||
"dotenv": "^16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -2,6 +2,25 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
# [14.14.1](https://github.com/discordjs/discord.js/compare/14.14.0...14.14.1) - (2023-11-12)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- **Emoji:** `id` set as `undefined` edge case (#9953) ([cc07a28](https://github.com/discordjs/discord.js/commit/cc07a28f125be63a7f1132a5a07d317c160f9a89))
|
||||
- **BaseClient:** Default in objects properly (#9952) ([f93abf7](https://github.com/discordjs/discord.js/commit/f93abf7e35ab6793aa530ceadc279d8c80b7aebf))
|
||||
|
||||
## Documentation
|
||||
|
||||
- Use preferred nullable syntax (`?T` over `T | null`) (#9946) ([1e4ef35](https://github.com/discordjs/discord.js/commit/1e4ef35436cd134db70c1c3152e33342baf9d6b6))
|
||||
|
||||
## Refactor
|
||||
|
||||
- Use formatters (#9956) ([40726db](https://github.com/discordjs/discord.js/commit/40726db722c7851f4096cda29667ea4ee89da98b))
|
||||
|
||||
## Typings
|
||||
|
||||
- Use wrapper utilities (#9945) ([4bc1dae](https://github.com/discordjs/discord.js/commit/4bc1dae36f01649127774c40b14e778d65cf25c5))
|
||||
|
||||
# [14.14.0](https://github.com/discordjs/discord.js/compare/14.13.0...14.14.0) - (2023-11-12)
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "discord.js",
|
||||
"version": "14.14.0",
|
||||
"version": "14.14.1",
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"scripts": {
|
||||
"test": "pnpm run docs:test && pnpm run test:typescript",
|
||||
|
||||
@@ -27,11 +27,20 @@ class BaseClient extends EventEmitter {
|
||||
this.options = {
|
||||
...defaultOptions,
|
||||
...options,
|
||||
presence: {
|
||||
...defaultOptions.presence,
|
||||
...options.presence,
|
||||
},
|
||||
sweepers: {
|
||||
...defaultOptions.sweepers,
|
||||
...options.sweepers,
|
||||
},
|
||||
ws: {
|
||||
...defaultOptions.ws,
|
||||
...options.ws,
|
||||
},
|
||||
rest: {
|
||||
...defaultOptions.rest,
|
||||
...options.rest,
|
||||
userAgentAppendix: options.rest?.userAgentAppendix
|
||||
? `${Options.userAgentAppendix} ${options.rest.userAgentAppendix}`
|
||||
|
||||
@@ -93,7 +93,7 @@ class GuildMemberManager extends CachedManager {
|
||||
* <info>This method requires the {@link PermissionFlagsBits.CreateInstantInvite} permission.
|
||||
* @param {UserResolvable} user The user to add to the guild
|
||||
* @param {AddGuildMemberOptions} options Options for adding the user to the guild
|
||||
* @returns {Promise<GuildMember|null>}
|
||||
* @returns {Promise<?GuildMember>}
|
||||
*/
|
||||
async add(user, options) {
|
||||
const userId = this.client.users.resolveId(user);
|
||||
@@ -326,9 +326,9 @@ class GuildMemberManager extends CachedManager {
|
||||
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles or role ids to apply
|
||||
* @property {boolean} [mute] Whether or not the member should be muted
|
||||
* @property {boolean} [deaf] Whether or not the member should be deafened
|
||||
* @property {GuildVoiceChannelResolvable|null} [channel] Channel to move the member to
|
||||
* @property {?GuildVoiceChannelResolvable} [channel] Channel to move the member to
|
||||
* (if they are connected to voice), or `null` if you want to disconnect them from voice
|
||||
* @property {DateResolvable|null} [communicationDisabledUntil] The date or timestamp
|
||||
* @property {?DateResolvable} [communicationDisabledUntil] The date or timestamp
|
||||
* for the member's communication to be disabled until. Provide `null` to enable communication again.
|
||||
* @property {GuildMemberFlagsResolvable} [flags] The flags to set for the member
|
||||
* @property {string} [reason] Reason for editing this user
|
||||
@@ -400,7 +400,7 @@ class GuildMemberManager extends CachedManager {
|
||||
/**
|
||||
* Prunes members from the guild based on how long they have been inactive.
|
||||
* @param {GuildPruneMembersOptions} [options] Options for pruning
|
||||
* @returns {Promise<number|null>} The number of members that were/will be kicked
|
||||
* @returns {Promise<?number>} The number of members that were/will be kicked
|
||||
* @example
|
||||
* // See how many members will be pruned
|
||||
* guild.members.prune({ dry: true })
|
||||
|
||||
@@ -144,7 +144,7 @@ class ApplicationCommand extends Base {
|
||||
/**
|
||||
* Whether the command can be used in DMs
|
||||
* <info>This property is always `null` on guild commands</info>
|
||||
* @type {boolean|null}
|
||||
* @type {?boolean}
|
||||
*/
|
||||
this.dmPermission = data.dm_permission;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { channelLink } = require('@discordjs/builders');
|
||||
const { channelLink, channelMention } = require('@discordjs/formatters');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const { ChannelType, Routes } = require('discord-api-types/v10');
|
||||
const Base = require('./Base');
|
||||
@@ -89,7 +89,7 @@ class BaseChannel extends Base {
|
||||
* console.log(`Hello from ${channel}!`);
|
||||
*/
|
||||
toString() {
|
||||
return `<#${this.id}>`;
|
||||
return channelMention(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { userMention } = require('@discordjs/builders');
|
||||
const { userMention } = require('@discordjs/formatters');
|
||||
const { ChannelType } = require('discord-api-types/v10');
|
||||
const { BaseChannel } = require('./BaseChannel');
|
||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const process = require('node:process');
|
||||
const { formatEmoji } = require('@discordjs/formatters');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const Base = require('./Base');
|
||||
|
||||
@@ -29,7 +30,7 @@ class Emoji extends Base {
|
||||
* The emoji's id
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.id = emoji.id;
|
||||
this.id = emoji.id ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +98,7 @@ class Emoji extends Base {
|
||||
* reaction.message.channel.send(`The emoji used was: ${reaction.emoji}`);
|
||||
*/
|
||||
toString() {
|
||||
return this.id ? `<${this.animated ? 'a' : ''}:${this.name}:${this.id}>` : this.name;
|
||||
return this.id ? formatEmoji(this.id, this.animated) : this.name;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
||||
@@ -404,7 +404,7 @@ class GuildMember extends Base {
|
||||
|
||||
/**
|
||||
* Times this guild member out.
|
||||
* @param {DateResolvable|null} communicationDisabledUntil The date or timestamp
|
||||
* @param {?DateResolvable} communicationDisabledUntil The date or timestamp
|
||||
* for the member's communication to be disabled until. Provide `null` to remove the timeout.
|
||||
* @param {string} [reason] The reason for this timeout.
|
||||
* @returns {Promise<GuildMember>}
|
||||
@@ -425,7 +425,7 @@ class GuildMember extends Base {
|
||||
|
||||
/**
|
||||
* Times this guild member out.
|
||||
* @param {number|null} timeout The duration in milliseconds
|
||||
* @param {?number} timeout The duration in milliseconds
|
||||
* for the member's communication to be disabled. Provide `null` to remove the timeout.
|
||||
* @param {string} [reason] The reason for this timeout.
|
||||
* @returns {Promise<GuildMember>}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { messageLink } = require('@discordjs/builders');
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { messageLink } = require('@discordjs/formatters');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const {
|
||||
InteractionType,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { roleMention } = require('@discordjs/formatters');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const { PermissionFlagsBits } = require('discord-api-types/v10');
|
||||
const Base = require('./Base');
|
||||
@@ -452,7 +453,7 @@ class Role extends Base {
|
||||
*/
|
||||
toString() {
|
||||
if (this.id === this.guild.id) return '@everyone';
|
||||
return `<@&${this.id}>`;
|
||||
return roleMention(this.id);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
||||
@@ -310,7 +310,7 @@ class ThreadChannel extends BaseChannel {
|
||||
* or when the original message in the parent channel is deleted.
|
||||
* If you just need the id of that message, use {@link ThreadChannel#id} instead.</info>
|
||||
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
||||
* @returns {Promise<Message<true>|null>}
|
||||
* @returns {Promise<?Message<true>>}
|
||||
*/
|
||||
// eslint-disable-next-line require-await
|
||||
async fetchStarterMessage(options) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { userMention } = require('@discordjs/builders');
|
||||
const { userMention } = require('@discordjs/formatters');
|
||||
const { calculateUserDefaultAvatarIndex } = require('@discordjs/rest');
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const Base = require('./Base');
|
||||
|
||||
@@ -197,7 +197,7 @@ class VoiceState extends Base {
|
||||
|
||||
/**
|
||||
* Moves the member to a different channel, or disconnects them from the one they're in.
|
||||
* @param {GuildVoiceChannelResolvable|null} channel Channel to move the member to, or `null` if you want to
|
||||
* @param {?GuildVoiceChannelResolvable} channel Channel to move the member to, or `null` if you want to
|
||||
* disconnect them from voice.
|
||||
* @param {string} [reason] Reason for moving member to another channel or disconnecting
|
||||
* @returns {Promise<GuildMember>}
|
||||
|
||||
@@ -81,7 +81,7 @@ class Collector extends EventEmitter {
|
||||
|
||||
/**
|
||||
* The reason the collector ended
|
||||
* @type {string|null}
|
||||
* @type {?string}
|
||||
* @private
|
||||
*/
|
||||
this._endReason = null;
|
||||
|
||||
@@ -55,7 +55,7 @@ class TextBasedChannel {
|
||||
/**
|
||||
* The base message options for messages.
|
||||
* @typedef {Object} BaseMessageOptions
|
||||
* @property {string|null} [content=''] The content for the message. This can only be `null` when editing a message.
|
||||
* @property {?string} [content=''] The content for the message. This can only be `null` when editing a message.
|
||||
* @property {Array<(EmbedBuilder|Embed|APIEmbed)>} [embeds] The embeds for the message
|
||||
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
|
||||
* (see [here](https://discord.com/developers/docs/resources/channel#allowed-mentions-object) for more details)
|
||||
|
||||
@@ -19,7 +19,7 @@ const {
|
||||
TimestampStyles,
|
||||
underscore,
|
||||
userMention,
|
||||
} = require('@discordjs/builders');
|
||||
} = require('@discordjs/formatters');
|
||||
|
||||
/**
|
||||
* Formats an application command name and id into an application command mention.
|
||||
|
||||
@@ -7,7 +7,7 @@ const { DiscordjsTypeError, ErrorCodes } = require('../errors');
|
||||
|
||||
/**
|
||||
* @typedef {Function} GlobalSweepFilter
|
||||
* @returns {Function|null} Return `null` to skip sweeping, otherwise a function passed to `sweep()`,
|
||||
* @returns {?Function} Return `null` to skip sweeping, otherwise a function passed to `sweep()`,
|
||||
* See {@link [Collection#sweep](https://discord.js.org/docs/packages/collection/stable/Collection:Class#sweep)}
|
||||
* for the definition of this function.
|
||||
*/
|
||||
|
||||
42
packages/discord.js/typings/index.d.ts
vendored
42
packages/discord.js/typings/index.d.ts
vendored
@@ -1,19 +1,8 @@
|
||||
import {
|
||||
ActionRowBuilder as BuilderActionRow,
|
||||
MessageActionRowComponentBuilder,
|
||||
blockQuote,
|
||||
bold,
|
||||
ButtonBuilder as BuilderButtonComponent,
|
||||
channelMention,
|
||||
codeBlock,
|
||||
EmbedBuilder as BuildersEmbed,
|
||||
formatEmoji,
|
||||
hideLinkEmbed,
|
||||
hyperlink,
|
||||
inlineCode,
|
||||
italic,
|
||||
quote,
|
||||
roleMention,
|
||||
ChannelSelectMenuBuilder as BuilderChannelSelectMenuComponent,
|
||||
MentionableSelectMenuBuilder as BuilderMentionableSelectMenuComponent,
|
||||
RoleSelectMenuBuilder as BuilderRoleSelectMenuComponent,
|
||||
@@ -21,12 +10,6 @@ import {
|
||||
UserSelectMenuBuilder as BuilderUserSelectMenuComponent,
|
||||
TextInputBuilder as BuilderTextInputComponent,
|
||||
SelectMenuOptionBuilder as BuildersSelectMenuOption,
|
||||
spoiler,
|
||||
strikethrough,
|
||||
time,
|
||||
TimestampStyles,
|
||||
underscore,
|
||||
userMention,
|
||||
ModalActionRowComponentBuilder,
|
||||
ModalBuilder as BuildersModal,
|
||||
AnyComponentBuilder,
|
||||
@@ -34,6 +17,25 @@ import {
|
||||
type RestOrArray,
|
||||
ApplicationCommandOptionAllowedChannelTypes,
|
||||
} from '@discordjs/builders';
|
||||
import {
|
||||
blockQuote,
|
||||
bold,
|
||||
channelMention,
|
||||
codeBlock,
|
||||
formatEmoji,
|
||||
hideLinkEmbed,
|
||||
hyperlink,
|
||||
inlineCode,
|
||||
italic,
|
||||
quote,
|
||||
roleMention,
|
||||
spoiler,
|
||||
strikethrough,
|
||||
time,
|
||||
TimestampStyles,
|
||||
underscore,
|
||||
userMention,
|
||||
} from '@discordjs/formatters';
|
||||
import { Awaitable, JSONEncodable } from '@discordjs/util';
|
||||
import { Collection, ReadonlyCollection } from '@discordjs/collection';
|
||||
import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
|
||||
@@ -1129,7 +1131,7 @@ export abstract class Collector<Key, Value, Extras extends unknown[] = []> exten
|
||||
public toJSON(): unknown;
|
||||
|
||||
protected listener: (...args: any[]) => void;
|
||||
public abstract collect(...args: unknown[]): Key | null | Promise<Key | null>;
|
||||
public abstract collect(...args: unknown[]): Awaitable<Key | null>;
|
||||
public abstract dispose(...args: unknown[]): Key | null;
|
||||
|
||||
public on<EventKey extends keyof CollectorEventTypes<Key, Value, Extras>>(
|
||||
@@ -5066,7 +5068,7 @@ export interface CloseEvent {
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export type CollectorFilter<Arguments extends unknown[]> = (...args: Arguments) => boolean | Promise<boolean>;
|
||||
export type CollectorFilter<Arguments extends unknown[]> = (...args: Arguments) => Awaitable<boolean>;
|
||||
|
||||
export interface CollectorOptions<FilterArguments extends unknown[]> {
|
||||
filter?: CollectorFilter<FilterArguments>;
|
||||
@@ -6647,7 +6649,7 @@ export type Serialized<Value> = Value extends symbol | bigint | (() => any)
|
||||
? never
|
||||
: Value extends number | string | boolean | undefined
|
||||
? Value
|
||||
: Value extends { toJSON(): infer JSONResult }
|
||||
: Value extends JSONEncodable<infer JSONResult>
|
||||
? JSONResult
|
||||
: Value extends ReadonlyArray<infer ItemType>
|
||||
? Serialized<ItemType>[]
|
||||
|
||||
@@ -185,6 +185,7 @@ import {
|
||||
PartialEmojiOnlyId,
|
||||
Emoji,
|
||||
PartialEmoji,
|
||||
Awaitable,
|
||||
} from '.';
|
||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import type { ContextMenuCommandBuilder, SlashCommandBuilder } from '@discordjs/builders';
|
||||
@@ -412,7 +413,7 @@ client.on('messageCreate', async message => {
|
||||
(
|
||||
test: ButtonInteraction<'cached'>,
|
||||
items: Collection<Snowflake, ButtonInteraction<'cached'>>,
|
||||
) => boolean | Promise<boolean>
|
||||
) => Awaitable<boolean>
|
||||
>(buttonCollector.filter);
|
||||
expectType<GuildTextBasedChannel>(message.channel);
|
||||
expectType<Guild>(message.guild);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Readable } from 'node:stream';
|
||||
import type { ReadableStream } from 'node:stream/web';
|
||||
import type { Collection } from '@discordjs/collection';
|
||||
import type { Awaitable } from '@discordjs/util';
|
||||
import type { Agent, Dispatcher, RequestInit, BodyInit, Response } from 'undici';
|
||||
import type { IHandler } from '../interfaces/Handler.js';
|
||||
|
||||
@@ -183,7 +184,7 @@ export interface RateLimitData {
|
||||
/**
|
||||
* A function that determines whether the rate limit hit should throw an Error
|
||||
*/
|
||||
export type RateLimitQueueFilter = (rateLimitData: RateLimitData) => Promise<boolean> | boolean;
|
||||
export type RateLimitQueueFilter = (rateLimitData: RateLimitData) => Awaitable<boolean>;
|
||||
|
||||
export interface APIRequest {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user