mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
feat: use rest,flow,cache
instead of force
in GuildMember#voice
This commit is contained in:
parent
d779c95514
commit
c6d470b329
@ -25,11 +25,11 @@
|
|||||||
"@changesets/cli": "^2.27.11",
|
"@changesets/cli": "^2.27.11",
|
||||||
"@commitlint/cli": "^19.6.1",
|
"@commitlint/cli": "^19.6.1",
|
||||||
"@commitlint/config-conventional": "^19.6.0",
|
"@commitlint/config-conventional": "^19.6.0",
|
||||||
"@types/node": "^22.10.5",
|
"@types/node": "^22.10.7",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^15.3.0",
|
"lint-staged": "^15.4.1",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
"vitest": "^2.1.8"
|
"vitest": "^3.0.2"
|
||||||
},
|
},
|
||||||
"homepage": "https://seyfert.dev",
|
"homepage": "https://seyfert.dev",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
637
pnpm-lock.yaml
generated
637
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -241,9 +241,7 @@ export class MemberShorter extends BaseShorter {
|
|||||||
return this.client.cache.presences?.get(memberId);
|
return this.client.cache.presences?.get(memberId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async voice(guildId: string, memberId: '@me', force?: boolean): Promise<VoiceStateStructure>;
|
async voice(guildId: string, memberId: (string & {}) | '@me', force = false): Promise<VoiceStateStructure> {
|
||||||
async voice(guildId: string, memberId: string, force?: boolean): Promise<VoiceStateStructure>;
|
|
||||||
async voice(guildId: string, memberId: (string & {}) | '@me', force = false) {
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
const state = await this.client.cache.voiceStates?.get(memberId, guildId);
|
const state = await this.client.cache.voiceStates?.get(memberId, guildId);
|
||||||
if (state) return state;
|
if (state) return state;
|
||||||
|
@ -94,8 +94,18 @@ export class BaseGuildMember extends DiscordBase {
|
|||||||
return this.client.members.presence(this.id);
|
return this.client.members.presence(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
voice(force = false): Promise<VoiceStateStructure> {
|
voice(mode?: 'rest' | 'flow'): Promise<VoiceStateStructure>;
|
||||||
return this.client.members.voice(this.guildId, this.id, force);
|
voice(mode: 'cache'): ReturnCache<VoiceStateStructure | undefined>;
|
||||||
|
voice(mode: 'cache' | 'rest' | 'flow' = 'flow') {
|
||||||
|
switch (mode) {
|
||||||
|
case 'cache':
|
||||||
|
return (
|
||||||
|
this.client.cache.voiceStates?.get(this.id, this.guildId) ||
|
||||||
|
(this.client.cache.adapter.isAsync ? (Promise.resolve() as any) : undefined)
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return this.client.members.voice(this.guildId, this.id, mode === 'rest');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toString() {
|
toString() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user