fix: Client#acceptInvite
This commit is contained in:
parent
1bf89d9b5e
commit
6000184db3
@ -535,7 +535,7 @@ class Client extends BaseClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join this Guild using this invite (fast)
|
* Join this Guild using this invite
|
||||||
* @param {InviteResolvable} invite Invite code or URL
|
* @param {InviteResolvable} invite Invite code or URL
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
* @example
|
* @example
|
||||||
@ -544,9 +544,16 @@ class Client extends BaseClient {
|
|||||||
async acceptInvite(invite) {
|
async acceptInvite(invite) {
|
||||||
const code = DataResolver.resolveInviteCode(invite);
|
const code = DataResolver.resolveInviteCode(invite);
|
||||||
if (!code) throw new Error('INVITE_RESOLVE_CODE');
|
if (!code) throw new Error('INVITE_RESOLVE_CODE');
|
||||||
if (invite instanceof Invite) {
|
const i = await this.fetchInvite(code);
|
||||||
await invite.acceptInvite();
|
if (this.guilds.cache.has(i.guild?.id)) return;
|
||||||
} else {
|
/*
|
||||||
|
{
|
||||||
|
location: 'Desktop Invite Modal',
|
||||||
|
location_guild_id: i.guild?.id,
|
||||||
|
location_channel_id: i.channelId,
|
||||||
|
location_channel_type: typeof i.channel.type == 'number' ? i.channel.type : ChannelTypes[i.channel.type],
|
||||||
|
}
|
||||||
|
*/
|
||||||
await this.api.invites(code).post({
|
await this.api.invites(code).post({
|
||||||
DiscordContext: { location: 'Markdown Link' },
|
DiscordContext: { location: 'Markdown Link' },
|
||||||
data: {
|
data: {
|
||||||
@ -554,7 +561,6 @@ class Client extends BaseClient {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redeem nitro from code or url.
|
* Redeem nitro from code or url.
|
||||||
|
@ -363,7 +363,7 @@ class RequestHandler {
|
|||||||
// Retry the request after a captcha is solved
|
// Retry the request after a captcha is solved
|
||||||
this.manager.client.emit(
|
this.manager.client.emit(
|
||||||
DEBUG,
|
DEBUG,
|
||||||
`Hit a captcha while executing a request. Solving captcha ...
|
`Hit a captcha while executing a request (${data.captcha_key.join(', ')})
|
||||||
Method : ${request.method}
|
Method : ${request.method}
|
||||||
Path : ${request.path}
|
Path : ${request.path}
|
||||||
Route : ${request.route}
|
Route : ${request.route}
|
||||||
|
Loading…
Reference in New Issue
Block a user