feat(RelationshipManager): Add x-context-properties
headers
This commit is contained in:
parent
e6bd66d14b
commit
d1382823fe
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const Buffer = require('node:buffer').Buffer;
|
||||||
const { Collection } = require('@discordjs/collection');
|
const { Collection } = require('@discordjs/collection');
|
||||||
const { GuildMember } = require('../structures/GuildMember');
|
const { GuildMember } = require('../structures/GuildMember');
|
||||||
const { Message } = require('../structures/Message');
|
const { Message } = require('../structures/Message');
|
||||||
@ -125,8 +126,6 @@ class RelationshipManager {
|
|||||||
return this.cache.get(id);
|
return this.cache.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some option .-.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a friend relationship with a client user.
|
* Deletes a friend relationship with a client user.
|
||||||
* @param {UserResolvable} user Target
|
* @param {UserResolvable} user Target
|
||||||
@ -163,6 +162,9 @@ class RelationshipManager {
|
|||||||
username,
|
username,
|
||||||
discriminator: parseInt(discriminator),
|
discriminator: parseInt(discriminator),
|
||||||
},
|
},
|
||||||
|
headers: {
|
||||||
|
'X-Context-Properties': Buffer.from(JSON.stringify({ location: 'Add Friend' }), 'utf8').toString('base64'),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -179,7 +181,11 @@ class RelationshipManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async __cancel(id) {
|
async __cancel(id) {
|
||||||
await this.client.api.users['@me'].relationships[id].delete();
|
await this.client.api.users['@me'].relationships[id].delete({
|
||||||
|
headers: {
|
||||||
|
'X-Context-Properties': Buffer.from(JSON.stringify({ location: 'Friends' }), 'utf8').toString('base64'),
|
||||||
|
},
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +204,9 @@ class RelationshipManager {
|
|||||||
data: {
|
data: {
|
||||||
type: RelationshipTypes.FRIEND,
|
type: RelationshipTypes.FRIEND,
|
||||||
},
|
},
|
||||||
|
headers: {
|
||||||
|
'X-Context-Properties': Buffer.from(JSON.stringify({ location: 'Friends' }), 'utf8').toString('base64'),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -215,6 +224,9 @@ class RelationshipManager {
|
|||||||
data: {
|
data: {
|
||||||
type: RelationshipTypes.BLOCKED,
|
type: RelationshipTypes.BLOCKED,
|
||||||
},
|
},
|
||||||
|
headers: {
|
||||||
|
'X-Context-Properties': Buffer.from(JSON.stringify({ location: 'ContextMenu' }), 'utf8').toString('base64'),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ class ApplicationCommand extends Base {
|
|||||||
/**
|
/**
|
||||||
* The guild this command is part of
|
* The guild this command is part of
|
||||||
* @type {?Guild}
|
* @type {?Guild}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get guild() {
|
get guild() {
|
||||||
return this.client.guilds.resolve(this.guildId);
|
return this.client.guilds.resolve(this.guildId);
|
||||||
|
Loading…
Reference in New Issue
Block a user