mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
add lots of group dm features (#1208)
* group dm stuff * minor doc changes
This commit is contained in:
@@ -14,6 +14,7 @@ const Webhook = require('../../structures/Webhook');
|
||||
const UserProfile = require('../../structures/UserProfile');
|
||||
const OAuth2Application = require('../../structures/OAuth2Application');
|
||||
const Channel = require('../../structures/Channel');
|
||||
const GroupDMChannel = require('../../structures/GroupDMChannel');
|
||||
const Guild = require('../../structures/Guild');
|
||||
const VoiceRegion = require('../../structures/VoiceRegion');
|
||||
|
||||
@@ -246,6 +247,23 @@ class RESTMethods {
|
||||
}).then(data => this.client.actions.ChannelCreate.handle(data).channel);
|
||||
}
|
||||
|
||||
createGroupDM(options) {
|
||||
const data = this.client.user.bot ?
|
||||
{ access_tokens: options.accessTokens, nicks: options.nicks } :
|
||||
{ recipients: options.recipients };
|
||||
|
||||
return this.rest.makeRequest('post', Constants.Endpoints.meChannels, true, data)
|
||||
.then(res => new GroupDMChannel(this.client, res));
|
||||
}
|
||||
|
||||
addUserToGroupDM(channel, options) {
|
||||
const data = this.client.user.bot ?
|
||||
{ nick: options.nick, access_token: options.accessToken } :
|
||||
{ recipient: options.id };
|
||||
return this.rest.makeRequest('put', Constants.Endpoints.dmChannelRecipient(channel.id, options.id), true, data)
|
||||
.then(() => channel);
|
||||
}
|
||||
|
||||
getExistingDM(recipient) {
|
||||
return this.client.channels.find(channel =>
|
||||
channel.recipient && channel.recipient.id === recipient.id
|
||||
|
||||
Reference in New Issue
Block a user