mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 04:56:07 +00:00
fix: collect.run types
This commit is contained in:
parent
865f863e53
commit
4c05c25a41
@ -7,11 +7,9 @@ import type { Button } from './Button';
|
||||
import type { TextInput } from './Modal';
|
||||
import type { BuilderSelectMenus } from './SelectMenu';
|
||||
|
||||
export type ComponentCallback = (
|
||||
interaction: ComponentInteraction | StringSelectMenuInteraction,
|
||||
stop: ComponentStopCallback,
|
||||
refresh: ComponentRefreshCallback,
|
||||
) => any;
|
||||
export type ComponentCallback<
|
||||
T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction,
|
||||
> = (interaction: T, stop: ComponentStopCallback, refresh: ComponentRefreshCallback) => any;
|
||||
export type ComponentFilterCallback<T = ComponentInteraction> = (interaction: T) => any;
|
||||
export type ComponentStopCallback = (reason?: string, refresh?: ComponentRefreshCallback) => any;
|
||||
export type ComponentRefreshCallback = () => any;
|
||||
|
2
src/cache/resources/voice-states.ts
vendored
2
src/cache/resources/voice-states.ts
vendored
@ -1,4 +1,4 @@
|
||||
import type { GatewayVoiceState } from '../../common';
|
||||
import type { GatewayVoiceState } from 'discord-api-types/v10';
|
||||
import { GuildBasedResource } from './default/guild-based';
|
||||
|
||||
export class VoiceStates extends GuildBasedResource<VoiceStateResource> {
|
||||
|
@ -2,7 +2,7 @@ import type { ComponentCallback, ListenerOptions, ModalSubmitCallback } from '..
|
||||
import { LimitedCollection } from '../collection';
|
||||
import type { UsingClient } from '../commands';
|
||||
import { BaseHandler, magicImport, type Logger, type OnFailCallback } from '../common';
|
||||
import type { ComponentInteraction, ModalSubmitInteraction } from '../structures';
|
||||
import type { ComponentInteraction, ModalSubmitInteraction, StringSelectMenuInteraction } from '../structures';
|
||||
import { ComponentCommand, InteractionCommandType, ModalCommand } from './command';
|
||||
import { ComponentContext } from './componentcontext';
|
||||
|
||||
@ -54,7 +54,15 @@ export class ComponentHandler extends BaseHandler {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
createComponentCollector(messageId: string, options: ListenerOptions = {}) {
|
||||
createComponentCollector(
|
||||
messageId: string,
|
||||
options: ListenerOptions = {},
|
||||
): {
|
||||
run<
|
||||
T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction,
|
||||
>(customId: string | string[] | RegExp, callback: ComponentCallback<T>): any;
|
||||
stop(reason?: string): any;
|
||||
} {
|
||||
this.values.set(messageId, {
|
||||
components: [],
|
||||
options,
|
||||
@ -85,6 +93,7 @@ export class ComponentHandler extends BaseHandler {
|
||||
});
|
||||
|
||||
return {
|
||||
//@ts-expect-error generic
|
||||
run: this.values.get(messageId)!.__run,
|
||||
stop: (reason?: string) => {
|
||||
this.deleteValue(messageId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user