fix: send friend req
This commit is contained in:
parent
0abc2f23e2
commit
f9405a33c0
@ -159,14 +159,14 @@ class RelationshipManager {
|
|||||||
/**
|
/**
|
||||||
* Sends a friend request.
|
* Sends a friend request.
|
||||||
* @param {string} username Username of the user to send the request to
|
* @param {string} username Username of the user to send the request to
|
||||||
* @param {number} discriminator Discriminator of the user to send the request to
|
* @param {?number} discriminator Discriminator of the user to send the request to
|
||||||
* @returns {Promise<boolean>}
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
async sendFriendRequest(username, discriminator) {
|
async sendFriendRequest(username, discriminator) {
|
||||||
await this.client.api.users('@me').relationships.post({
|
await this.client.api.users('@me').relationships.post({
|
||||||
data: {
|
data: {
|
||||||
username,
|
username,
|
||||||
discriminator: parseInt(discriminator),
|
discriminator: discriminator == 0 ? null : parseInt(discriminator),
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
'X-Context-Properties': Buffer.from(JSON.stringify({ location: 'Add Friend' }), 'utf8').toString('base64'),
|
'X-Context-Properties': Buffer.from(JSON.stringify({ location: 'Add Friend' }), 'utf8').toString('base64'),
|
||||||
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@ -4410,7 +4410,7 @@ export class RelationshipManager {
|
|||||||
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<RelationshipTypes>;
|
public fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<RelationshipTypes>;
|
||||||
public deleteFriend(user: UserResolvable): Promise<boolean>;
|
public deleteFriend(user: UserResolvable): Promise<boolean>;
|
||||||
public deleteBlocked(user: UserResolvable): Promise<boolean>;
|
public deleteBlocked(user: UserResolvable): Promise<boolean>;
|
||||||
public sendFriendRequest(username: string, discriminator: number): Promise<boolean>;
|
public sendFriendRequest(username: string, discriminator?: number): Promise<boolean>;
|
||||||
public cancelFriendRequest(user: UserResolvable): Promise<boolean>;
|
public cancelFriendRequest(user: UserResolvable): Promise<boolean>;
|
||||||
public addFriend(user: UserResolvable): Promise<boolean>;
|
public addFriend(user: UserResolvable): Promise<boolean>;
|
||||||
public addBlocked(user: UserResolvable): Promise<boolean>;
|
public addBlocked(user: UserResolvable): Promise<boolean>;
|
||||||
|
Loading…
Reference in New Issue
Block a user