forked from SudhanPlayz/discordjs-activity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
38 lines (34 loc) · 1.07 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const { Structures, Invite, Client } = require('discord.js');
/**
* @param {Client} client
*/
module.exports = (client) => {
// if no client specified
if(!client || !client instanceof Client) throw new Error('INVALID_CLIENT: No Client/Invalid Client Provided.')
// extend voice channel to add activity invite function
Structures.extend('VoiceChannel', VoiceChannel => {
return class EpicVoiceChannel extends VoiceChannel {
constructor(client, data) {
super(client, data);
}
/**
* Creates Activity Invite in the voice channel
* @param {string} ApplicationID - Application ID
* @returns {Invite}
*/
activityInvite(ApplicationID){
return this.client.api.channels(this.id).invites.post({
data: {
max_age: 86400,
max_uses: 0,
target_application_id: ApplicationID,
target_type: 2,
temporary: false,
validate: null
},
}).then(invite => new Invite(this.client, invite))
}
}
});
}
// The End.