fix: typings errors
This commit is contained in:
parent
62ca21baf0
commit
cb0fd060a1
2 changed files with 72 additions and 43 deletions
|
@ -78,7 +78,7 @@ class Player extends EventEmitter<PlayerEvents> {
|
||||||
|
|
||||||
if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId) {
|
if (oldState.channelId && newState.channelId && oldState.channelId !== newState.channelId) {
|
||||||
if (queue?.connection && newState.member.id === newState.guild.me.id) queue.connection.channel = newState.channel;
|
if (queue?.connection && newState.member.id === newState.guild.me.id) queue.connection.channel = newState.channel;
|
||||||
if (newState.member.id === newState.guild.me.id || newState.member.id !== newState.guild.me.id && oldState.channelId === queue.connection.channel.id) {
|
if (newState.member.id === newState.guild.me.id || (newState.member.id !== newState.guild.me.id && oldState.channelId === queue.connection.channel.id)) {
|
||||||
if (!Util.isVoiceEmpty(queue.connection.channel)) return;
|
if (!Util.isVoiceEmpty(queue.connection.channel)) return;
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
if (!Util.isVoiceEmpty(queue.connection.channel)) return;
|
if (!Util.isVoiceEmpty(queue.connection.channel)) return;
|
||||||
|
@ -137,6 +137,7 @@ class Player extends EventEmitter<PlayerEvents> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a queue for a guild if not available, else returns existing queue
|
* Creates a queue for a guild if not available, else returns existing queue
|
||||||
|
|
28
src/types/EventEmitter.d.ts
vendored
Normal file
28
src/types/EventEmitter.d.ts
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
declare module "tiny-typed-emitter" {
|
||||||
|
export type ListenerSignature<L> = {
|
||||||
|
[E in keyof L]: (...args: any[]) => any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DefaultListener = {
|
||||||
|
[k: string]: (...args: any[]) => any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class TypedEmitter<L extends ListenerSignature<L> = DefaultListener> {
|
||||||
|
static defaultMaxListeners: number;
|
||||||
|
addListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
prependListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
prependOnceListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
removeListener<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
removeAllListeners(event?: keyof L): this;
|
||||||
|
once<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
on<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
off<U extends keyof L>(event: U, listener: L[U]): this;
|
||||||
|
emit<U extends keyof L>(event: U, ...args: Parameters<L[U]>): boolean;
|
||||||
|
eventNames<U extends keyof L>(): U[];
|
||||||
|
listenerCount(type: keyof L): number;
|
||||||
|
listeners<U extends keyof L>(type: U): L[U][];
|
||||||
|
rawListeners<U extends keyof L>(type: U): L[U][];
|
||||||
|
getMaxListeners(): number;
|
||||||
|
setMaxListeners(n: number): this;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue