mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Added guildChannel.createInvite();
This commit is contained in:
@@ -5,6 +5,7 @@ const getStructure = name => require(`../../structures/${name}`);
|
||||
const User = getStructure('User');
|
||||
const GuildMember = getStructure('GuildMember');
|
||||
const Role = getStructure('Role');
|
||||
const Invite = getStructure('Invite');
|
||||
|
||||
class RESTMethods {
|
||||
constructor(restManager) {
|
||||
@@ -496,6 +497,19 @@ class RESTMethods {
|
||||
getChannelPinnedMessages(channel) {
|
||||
return this.rest.makeRequest('get', `${Constants.Endpoints.channel(channel.id)}/pins`, true);
|
||||
}
|
||||
|
||||
createChannelInvite(channel, options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const payload = {};
|
||||
payload.temporary = options.temporary;
|
||||
payload.max_age = options.maxAge;
|
||||
payload.max_uses = options.maxUses;
|
||||
|
||||
this.rest.makeRequest('post', `${Constants.Endpoints.channelInvites(channel.id)}`, true, payload)
|
||||
.then(invite => resolve(new Invite(this.rest.client, invite)))
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RESTMethods;
|
||||
|
||||
Reference in New Issue
Block a user