New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

devland.js

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devland.js - npm Package Compare versions

Comparing version 1.1.23 to 1.1.24

2

package.json

@@ -12,3 +12,3 @@ {

"name": "devland.js",
"version": "1.1.23",
"version": "1.1.24",
"description": "A powerful API wrapper for the Discord API designed for modern bots",

@@ -15,0 +15,0 @@ "main": "index.js",

@@ -12,96 +12,98 @@ const Client = require('../../client/client')

run: async (client, d) => {
const data = d.d
let guild = client.guilds.get(data.guild_id) || await client.rest.get(client._ENDPOINTS.SERVERS(data.guild_id))
if (!guild) {
// gestion message par mp
} else {
client.messages.map(msg => {
if(msg.channelId === data.id) client.messages.delete(msg.id)
})
if (typeof client.options.channelsLifeTime === "number" && client.options.channelsLifeTime > 0) {
if(!(guild instanceof Guild)) guild = new Guild(client, guild)
if (data.type === 0) { // text channel
let channel = client.textChannels.get(data.id)
channel.guild = guild
if(channel.parent_id){
let category = client.categoryChannels.get(channel.parent_id)
if(category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
try {
const data = d.d
let guild = client.guilds.get(data.guild_id) || await client.rest.get(client._ENDPOINTS.SERVERS(data.guild_id))
if (!guild) {
// gestion message par mp
} else {
client.messages.map(msg => {
if (msg.channelId === data.id) client.messages.delete(msg.id)
})
if (typeof client.options.channelsLifeTime === "number" && client.options.channelsLifeTime > 0) {
if (!(guild instanceof Guild)) guild = new Guild(client, guild)
if (data.type === 0) { // text channel
let channel = client.textChannels.get(data.id)
channel.guild = guild
if (channel.parent_id) {
let category = client.categoryChannels.get(channel.parent_id)
if (category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
}
}
}
client.emit('channelDelete', channel)
client.emit('channelDeleteText', channel)
client.textChannels.delete(data.id)
} else if (data.type === 2) { // voice channel
let channel = client.voiceChannels.get(data.id)
channel.guild = guild
if(channel.parent_id){
let category = client.categoryChannels.get(channel.parent_id)
if(category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
client.emit('channelDelete', channel)
client.emit('channelDeleteText', channel)
client.textChannels.delete(data.id)
} else if (data.type === 2) { // voice channel
let channel = client.voiceChannels.get(data.id)
channel.guild = guild
if (channel.parent_id) {
let category = client.categoryChannels.get(channel.parent_id)
if (category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
}
}
}
client.emit('channelDelete', channel)
client.emit('channelDeleteVoice', channel)
client.voiceChannels.delete(data.id)
} else if (data.type === 4) { // category channel
let channel = client.categoryChannels.get(data.id)
let newChannel = new CategoryChannel(client, guild, channel)
client.emit('channelDelete', newChannel)
client.emit('channelDeleteCategory', newChannel)
client.categoryChannels.delete(data.id)
} else if (data.type === 5){ // announcement channel
let channel = client.announcementChannels.get(data.id)
channel.guild = guild
if(channel.parent_id){
let category = client.categoryChannels.get(channel.parent_id)
if(category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
client.emit('channelDelete', channel)
client.emit('channelDeleteVoice', channel)
client.voiceChannels.delete(data.id)
} else if (data.type === 4) { // category channel
let channel = client.categoryChannels.get(data.id)
let newChannel = new CategoryChannel(client, guild, channel)
client.emit('channelDelete', newChannel)
client.emit('channelDeleteCategory', newChannel)
client.categoryChannels.delete(data.id)
} else if (data.type === 5) { // announcement channel
let channel = client.announcementChannels.get(data.id)
channel.guild = guild
if (channel.parent_id) {
let category = client.categoryChannels.get(channel.parent_id)
if (category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
}
}
}
client.emit('channelDelete', channel)
client.emit('channelDeleteAnnouncement', channel)
client.announcementChannels.delete(data.id)
} else if (data.type === 13){ // stage channel
let channel = client.stageChannels.get(data.id)
channel.guild = guild
if(channel.parent_id){
let category = client.categoryChannels.get(channel.parent_id)
if(category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
client.emit('channelDelete', channel)
client.emit('channelDeleteAnnouncement', channel)
client.announcementChannels.delete(data.id)
} else if (data.type === 13) { // stage channel
let channel = client.stageChannels.get(data.id)
channel.guild = guild
if (channel.parent_id) {
let category = client.categoryChannels.get(channel.parent_id)
if (category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
}
}
}
client.emit('channelDelete', channel)
client.emit('channelDeleteStage', channel)
client.stageChannels.delete(data.id)
} else if (data.type === 15){ // forum channel
let channel = client.forumChannels.get(data.id)
channel.guild = guild
if(channel.parent_id){
let category = client.categoryChannels.get(channel.parent_id)
if(category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
client.emit('channelDelete', channel)
client.emit('channelDeleteStage', channel)
client.stageChannels.delete(data.id)
} else if (data.type === 15) { // forum channel
let channel = client.forumChannels.get(data.id)
channel.guild = guild
if (channel.parent_id) {
let category = client.categoryChannels.get(channel.parent_id)
if (category) {
category.childrens = category.childrens.filter(id => id !== channel.id)
client.categoryChannels.set(category.id, category)
}
}
client.emit('channelDelete', channel)
client.emit('channelDeleteForum', channel)
client.forumChannels.delete(data.id)
}
} else {
let channel = { error: "Enable the guilds cache to get the old guild data", id: data.id, data_is_available: false }
client.emit('channelDelete', channel)
client.emit('channelDeleteForum', channel)
client.forumChannels.delete(data.id)
if (data.type === 0) client.emit('channelDeleteText', channel)
else if (data.type === 2) client.emit('channelDeleteVoice', channel)
else if (data.type === 4) client.emit('channelDeleteCategory', channel)
else if (data.type === 5) client.emit('channelDeleteAnnouncement', channel)
else if (data.type === 13) client.emit('channelDeleteStage', channel)
else if (data.type === 15) client.emit('channelDeleteForum', channel)
}
} else {
let channel = { error: "Enable the guilds cache to get the old guild data", id: data.id, data_is_available: false }
client.emit('channelDelete', channel)
if (data.type === 0) client.emit('channelDeleteText', channel)
else if (data.type === 2) client.emit('channelDeleteVoice', channel)
else if (data.type === 4) client.emit('channelDeleteCategory', channel)
else if (data.type === 5) client.emit('channelDeleteAnnouncement', channel)
else if (data.type === 13) client.emit('channelDeleteStage', channel)
else if (data.type === 15) client.emit('channelDeleteForum', channel)
}
}
} catch (err) { }
}
}

@@ -13,2 +13,3 @@ const Client = require('../client/client')

const Invite = require('./Invite')
const CategoryChannel = require('./CategoryChannel')
module.exports = class AnnouncementChannel {

@@ -357,5 +358,3 @@ /**

topic: this.topic,
bitrate: this.bitrate,
user_limit: this.userLimit,
rate_limit_per_user: this.rateLimitPerUser,
rate_limit_per_user: this.rate_limit_per_user,
position: this.position,

@@ -370,10 +369,4 @@ permission_overwrites: this.permission_overwrites.map(perm => {

}),
parent_id: this.parentId || this.parent_id,
nsfw: this.nsfw,
rtc_region: this.rtcRegion,
video_quality_mode: this.videoQualityMode,
default_auto_archive_duration: this.defaultAutoArchiveDuration,
default_reaction_emoji: this.defaultReactionEmoji,
available_tags: this.availableTags,
default_sort_order: this.defaultSortOrder,
parent_id: this.parent_id,
nsfw: this.nsfw
}

@@ -477,3 +470,3 @@ if (reason) data['reason'] = reason

if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value"))
if(typeof options.avatar !== "undefined") options.avatar = await DataResolver.resolveImage(options.avatar)
if (typeof options.avatar !== "undefined") options.avatar = await DataResolver.resolveImage(options.avatar)
this.client.rest.post(this.client._ENDPOINTS.CHANNEL_WEBHOOKS(this.id), options).then(res => {

@@ -499,28 +492,28 @@ resolve(new Webhook(this.client, this.client.guilds.get(this.guildId) || this.guild, res))

createCollector(options = {}){
if(typeof options !== "object") throw new TypeError("You must provide options for the collector")
if(typeof options.count !== "undefined"){
if(typeof options.count !== "number") throw new TypeError("The count must be a number")
createCollector(options = {}) {
if (typeof options !== "object") throw new TypeError("You must provide options for the collector")
if (typeof options.count !== "undefined") {
if (typeof options.count !== "number") throw new TypeError("The count must be a number")
}
if(typeof options.type !== "undefined"){
if(typeof options.type !== "string") throw new TypeError("The type must be a string")
if (typeof options.type !== "undefined") {
if (typeof options.type !== "string") throw new TypeError("The type must be a string")
options.type = options.type.toLowerCase()
if(!["message", "component"].includes(options.type)) throw new TypeError("Invalid collector type (message or component)")
if (!["message", "component"].includes(options.type)) throw new TypeError("Invalid collector type (message or component)")
}
if(typeof options.time !== "undefined"){
if(typeof options.time !== "number") throw new TypeError("The time must be a number")
if (typeof options.time !== "undefined") {
if (typeof options.time !== "number") throw new TypeError("The time must be a number")
}
if(typeof options.componentType !== "undefined"){
if(typeof options.componentType !== "number") throw new TypeError("The componentType must be a number")
if(options.componentType < 1 || options.componentType > 8) throw new TypeError("Invalid componentType for the collector")
if (typeof options.componentType !== "undefined") {
if (typeof options.componentType !== "number") throw new TypeError("The componentType must be a number")
if (options.componentType < 1 || options.componentType > 8) throw new TypeError("Invalid componentType for the collector")
}
if(typeof options.filter !== "undefined"){
if(typeof options.filter !== "function") throw new TypeError("The filter must be a filter function for the collector, example : 'filter: (collected) => collected.author.id === message.author.id'")
if (typeof options.filter !== "undefined") {
if (typeof options.filter !== "function") throw new TypeError("The filter must be a filter function for the collector, example : 'filter: (collected) => collected.author.id === message.author.id'")
}
let identifier = Date.now()
this.client.collectorCache[identifier] = new Collector(this.client, this.client.guilds.get(this.guildId)||this.guild, null, this.channel, options)
this.client.collectorCache[identifier] = new Collector(this.client, this.client.guilds.get(this.guildId) || this.guild, null, this.channel, options)
this.client.collectorCache[identifier]?.on('end', () => {
delete this.client.collectorCache[identifier]
})
return this.client.collectorCache[identifier]
return this.client.collectorCache[identifier]
}

@@ -558,22 +551,22 @@

async createInvite(options = {}) {
return new Promise(async(resolve, reject) => {
if(typeof options !== 'object') return reject(new TypeError("Create invite options must be object"))
if(typeof options.max_age !== "undefined"){
if(typeof options.max_age !== "number") return reject(new TypeError("Create invite options max_age must be a number"))
if(options.max_age < 0 || options.max_age > 604800) return reject(new TypeError("Create invite options max_age must be between 0 and 604800"))
return new Promise(async (resolve, reject) => {
if (typeof options !== 'object') return reject(new TypeError("Create invite options must be object"))
if (typeof options.max_age !== "undefined") {
if (typeof options.max_age !== "number") return reject(new TypeError("Create invite options max_age must be a number"))
if (options.max_age < 0 || options.max_age > 604800) return reject(new TypeError("Create invite options max_age must be between 0 and 604800"))
}
if(typeof options.max_uses !== "undefined"){
if(typeof options.max_uses !== "number") return reject(new TypeError("Create invite options max_uses must be a number"))
if(options.max_uses < 0 || options.max_uses > 100) return reject(new TypeError("Create invite options max_uses must be between 0 and 100"))
if (typeof options.max_uses !== "undefined") {
if (typeof options.max_uses !== "number") return reject(new TypeError("Create invite options max_uses must be a number"))
if (options.max_uses < 0 || options.max_uses > 100) return reject(new TypeError("Create invite options max_uses must be between 0 and 100"))
}
if(typeof options.temporary !== "undefined"){
if(typeof options.temporary !== "boolean") return reject(new TypeError("Create invite options temporary must be a boolean"))
if (typeof options.temporary !== "undefined") {
if (typeof options.temporary !== "boolean") return reject(new TypeError("Create invite options temporary must be a boolean"))
}
if(typeof options.unique !== "undefined"){
if(typeof options.unique !== "boolean") return reject(new TypeError("Create invite options unique must be a boolean"))
if (typeof options.unique !== "undefined") {
if (typeof options.unique !== "boolean") return reject(new TypeError("Create invite options unique must be a boolean"))
}
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value"))
this.client.rest.post(`${this.client._ENDPOINTS.CHANNEL(this.id)}/invites`, options).then(res => {
return resolve(new Invite(this.client, this.client.guilds.get(this.guildId)||this.guild, res, this))
}).catch(e=>{
return resolve(new Invite(this.client, this.client.guilds.get(this.guildId) || this.guild, res, this))
}).catch(e => {
return reject(new Error(e))

@@ -580,0 +573,0 @@ })

@@ -205,7 +205,2 @@ const Client = require('../client/client')

type: this.type,
topic: this.topic,
bitrate: this.bitrate,
user_limit: this.user_limit,
rate_limit_per_user: this.rateLimitPerUser,
position: this.position,
permission_overwrites: this.permission_overwrites.map(perm => {

@@ -218,11 +213,3 @@ return {

}
}),
parent_id: this.parentId || this.parent_id,
nsfw: this.nsfw,
rtc_region: this.rtcRegion,
video_quality_mode: this.videoQualityMode,
default_auto_archive_duration: this.defaultAutoArchiveDuration,
default_reaction_emoji: this.defaultReactionEmoji,
available_tags: this.availableTags,
default_sort_order: this.defaultSortOrder,
})
}

@@ -229,0 +216,0 @@ if (reason) data['reason'] = reason

@@ -11,2 +11,3 @@ const Client = require('../client/client')

const Invite = require('./Invite')
const CategoryChannel = require('./CategoryChannel')
module.exports = class ForumChannel {

@@ -48,2 +49,3 @@ /**

this.default_forum_layout = data.default_forum_layout
this.default_auto_archive_duration = data.default_auto_archive_duration
this.data_is_available = true

@@ -364,5 +366,3 @@ data.permission_overwrites?.map(perm => {

topic: this.topic,
bitrate: this.bitrate,
user_limit: this.userLimit,
rate_limit_per_user: this.rateLimitPerUser,
rate_limit_per_user: this.rate_limit_per_user,
position: this.position,

@@ -377,10 +377,8 @@ permission_overwrites: this.permission_overwrites.map(perm => {

}),
parent_id: this.parentId || this.parent_id,
parent_id: this.parent_id,
nsfw: this.nsfw,
rtc_region: this.rtcRegion,
video_quality_mode: this.videoQualityMode,
default_auto_archive_duration: this.defaultAutoArchiveDuration,
default_reaction_emoji: this.defaultReactionEmoji,
available_tags: this.availableTags,
default_sort_order: this.defaultSortOrder,
default_auto_archive_duration: this.default_auto_archive_duration,
default_reaction_emoji: this.default_reaction_emoji,
available_tags: this.available_tags,
default_sort_order: this.default_sort_order,
}

@@ -387,0 +385,0 @@ if (reason) data['reason'] = reason

@@ -11,2 +11,3 @@ const Client = require('../client/client')

const Invite = require('./Invite')
const CategoryChannel = require('./CategoryChannel')
module.exports = class StageChannel {

@@ -213,3 +214,3 @@ /**

user_limit: this.user_limit,
rate_limit_per_user: this.rateLimitPerUser,
rate_limit_per_user: this.rate_limit_per_user,
position: this.position,

@@ -224,10 +225,5 @@ permission_overwrites: this.permission_overwrites.map(perm => {

}),
parent_id: this.parentId || this.parent_id,
parent_id: this.parent_id,
nsfw: this.nsfw,
rtc_region: this.rtcRegion,
video_quality_mode: this.videoQualityMode,
default_auto_archive_duration: this.defaultAutoArchiveDuration,
default_reaction_emoji: this.defaultReactionEmoji,
available_tags: this.availableTags,
default_sort_order: this.defaultSortOrder,
rtc_region: this.rtc_region
}

@@ -344,2 +340,209 @@ if (reason) data['reason'] = reason

}
/**
* @typedef {object} MessageOptions
* @property {string} content
* @property {Embed[]} embeds
* @property {boolean} tts
* @property {string} nonce
* @property {'roles'|'users'|'everyone'} allowedMentions
* @property {ActionRow[]} components
*/
/**
* Send a message is the channel
* @param {MessageOptions|string} options
* @returns {Promise<Message>}
*/
async send(options) {
return new Promise(async (resolve, reject) => {
let data = {
content: undefined,
embeds: [],
tts: false,
nonce: undefined,
allowed_mentions: undefined,
components: [],
files: null,
}
if (typeof options === 'string') {
data['content'] = options
this.client.rest.post(this.client._ENDPOINTS.MESSAGES(this.id), data).then(messageData => {
return resolve(new Message(this.client, this.guild, this, messageData))
}).catch(e => {
return reject(new Error(e))
})
} else if (options instanceof Embed) {
data['embeds'].push(options.pack())
this.client.rest.post(this.client._ENDPOINTS.MESSAGES(this.id), data).then(messageData => {
return resolve(new Message(this.client, this.guild, this, messageData))
}).catch(e => {
return reject(new Error(e))
})
} else if (options instanceof ActionRow) {
data['components'].push(options.pack())
let toTestCustomId = []
let alrSeen = {}
data['components']?.map(ar => ar?.components.map(comp => toTestCustomId.push(comp)))
if (toTestCustomId.length > 0) toTestCustomId.filter(comp => comp.custom_id).map(test => {
if (alrSeen[test.custom_id]) return reject(new TypeError("Duplicated custom Id"))
else alrSeen[test.custom_id] = true
})
this.client.rest.post(this.client._ENDPOINTS.MESSAGES(this.id), data).then(messageData => {
return resolve(new Message(this.client, this.guild, this, messageData))
}).catch(e => {
return reject(new Error(e))
})
} else if (typeof options === 'object') {
data['content'] = options['content']
if (Array.isArray(options['embeds'])) options['embeds']?.map(embed_data => data['embeds'].push(embed_data.pack()))
data['tts'] = options['tts']
if (typeof options['tts'] !== "boolean") data['tts'] = false
data['nonce'] = options['nonce']
data['allowed_mentions'] = options['allowedMentions']
if (typeof data['allowed_mentions'] !== 'undefined') {
if (!Array.isArray(data['allowed_mentions'])) data['allowed_mentions'] = undefined
else {
data['allowed_mentions'] = { parse: [...options['allowedMentions']] }
}
}
data['components'] = []
options['components']?.map(comp => {
if (comp instanceof ActionRow) data['components'].push(comp.pack())
else return reject(new TypeError("Invalid component, must be a ActionRow instance"))
})
data['files'] = await Utils.lookForFiles(options.files)
let toTestCustomId = []
let alrSeen = {}
data['components']?.map(ar => ar?.components.map(comp => toTestCustomId.push(comp)))
if (toTestCustomId.length > 0) toTestCustomId.filter(comp => comp.custom_id).map(test => {
if (alrSeen[test.custom_id]) return reject(new TypeError("Duplicated custom Id"))
else alrSeen[test.custom_id] = true
})
this.client.rest.post(this.client._ENDPOINTS.MESSAGES(this.id), data).then(messageData => {
return resolve(new Message(this.client, this.guild, this, messageData))
}).catch(e => {
return reject(new Error(e))
})
} else return reject(new TypeError("Send without any options is not authorized"))
})
}
async fetchMessages(options) {
return new Promise(async (resolve, reject) => {
if (options && typeof options === "string") {
this.client.rest.get(this.client._ENDPOINTS.MESSAGES(this.id, options)).then(data => {
let message = new Message(this.client, this.guild, this, data)
resolve(new Store().set(message.id, message))
if (typeof this.client.options.messagesLifeTime === "number" && this.client.options.messagesLifeTime > 0) {
message.cachedAt = Date.now()
message.expireAt = Date.now() + this.client.options.messagesLifeTime
this.client.messages.set(message.id, message)
}
}).catch(e => {
return reject(new Error(e))
})
} else if (typeof options === "object") {
if (options.limit && typeof options.limit !== "number") return reject(new TypeError("Limit must be a number"))
if (options.limit && options.limit > 100) return reject(new TypeError("The limit can't be more than 100"))
if (options.limit && options.limit < 1) return reject(new TypeError("The limit can't be less than 1"))
if (typeof options.around !== "undefined" && typeof options.around !== "string") return reject(new TypeError("The around value must be a string (message Id)"))
if (typeof options.before !== "undefined" && typeof options.before !== "string") return reject(new TypeError("The before value must be a string (message Id)"))
if (typeof options.after !== "undefined" && typeof options.after !== "string") return reject(new TypeError("The after value must be a string (message Id)"))
let used = 0
if (options.around) used++
if (options.before) used++
if (options.after) used++
if (used > 1) return reject(new TypeError("You can only use one filter (around | before | after)"))
this.client.rest.get(`${this.client._ENDPOINTS.MESSAGES(this.id)}${options.limit ? `?limit=${options.limit}${options.around ? `&around=${options.around}` : `${options.before ? `&before=${options.before}` : `${options.after ? `&after=${options.after}` : ``}`}`}` : `${options.around ? `?around=${options.around}` : `${options.before ? `?before=${options.before}` : `${options.after ? `?after=${options.after}` : ``}`}`}`}`).then(data => {
let cache = new Store()
data.map(message_data => {
let message = new Message(this.client, this.guild, this, message_data)
cache.set(message.id, message)
if (typeof this.client.options.messagesLifeTime === "number" && this.client.options.messagesLifeTime > 0) {
message.cachedAt = Date.now()
message.expireAt = Date.now() + this.client.options.messagesLifeTime
this.client.messages.set(message.id, message)
}
})
return resolve(cache)
}).catch(e => {
return reject(new Error(e))
})
} else if (typeof options === "undefined") {
this.client.rest.get(this.client._ENDPOINTS.MESSAGES(this.id)).then(data => {
let cache = new Store()
data.map(message_data => {
let message = new Message(this.client, this.guild, this, message_data)
cache.set(message.id, message)
if (typeof this.client.options.messagesLifeTime === "number" && this.client.options.messagesLifeTime > 0) {
message.cachedAt = Date.now()
message.expireAt = Date.now() + this.client.options.messagesLifeTime
this.client.messages.set(message.id, message)
}
})
return resolve(cache)
}).catch(e => {
return reject(new Error(e))
})
} else return reject(new TypeError("Invalid fetch messages options provided"))
})
}
createCollector(options = {}) {
if (typeof options !== "object") throw new TypeError("You must provide options for the collector")
if (typeof options.count !== "undefined") {
if (typeof options.count !== "number") throw new TypeError("The count must be a number")
}
if (typeof options.type !== "undefined") {
if (typeof options.type !== "string") throw new TypeError("The type must be a string")
options.type = options.type.toLowerCase()
if (!["message", "component"].includes(options.type)) throw new TypeError("Invalid collector type (message or component)")
}
if (typeof options.time !== "undefined") {
if (typeof options.time !== "number") throw new TypeError("The time must be a number")
}
if (typeof options.componentType !== "undefined") {
if (typeof options.componentType !== "number") throw new TypeError("The componentType must be a number")
if (options.componentType < 1 || options.componentType > 8) throw new TypeError("Invalid componentType for the collector")
}
if (typeof options.filter !== "undefined") {
if (typeof options.filter !== "function") throw new TypeError("The filter must be a filter function for the collector, example : 'filter: (collected) => collected.author.id === message.author.id'")
}
let identifier = Date.now()
this.client.collectorCache[identifier] = new Collector(this.client, this.client.guilds.get(this.guildId) || this.guild, null, this.channel, options)
this.client.collectorCache[identifier]?.on('end', () => {
delete this.client.collectorCache[identifier]
})
return this.client.collectorCache[identifier]
}
awaitMessages(options = {}) {
return new Promise(async (resolve, reject) => {
if (typeof options !== "object") throw new TypeError("You must provide options for the collector")
if (typeof options.count !== "undefined") {
if (typeof options.count !== "number") throw new TypeError("The count must be a number")
}
options.type = "await_message"
if (typeof options.time !== "undefined") {
if (typeof options.time !== "number") throw new TypeError("The time must be a number")
}
if (typeof options.componentType !== "undefined") {
if (typeof options.componentType !== "number") throw new TypeError("The componentType must be a number")
if (options.componentType < 1 || options.componentType > 8) throw new TypeError("Invalid componentType for the collector")
}
if (typeof options.filter !== "undefined") {
if (typeof options.filter !== "function") throw new TypeError("The filter must be a filter function for the collector, example : 'filter: (collected) => collected.author.id === message.author.id'")
}
let identifier = Date.now()
this.client.collectorCache[identifier] = new Collector(this.client, this.client.guilds.get(this.guildId) || this.guild, null, this, options)
this.client.collectorCache[identifier]?.on('end', () => {
delete this.client.collectorCache[identifier]
})
this.client.collectorCache[identifier]?.on('collected', collected => {
resolve(collected)
delete this.client.collectorCache[identifier]
})
})
}
}

@@ -14,2 +14,3 @@ const Client = require('../client/client')

const Invite = require('./Invite')
const CategoryChannel = require('./CategoryChannel')
module.exports = class TextChannel {

@@ -361,5 +362,3 @@ /**

topic: this.topic,
bitrate: this.bitrate,
user_limit: this.userLimit,
rate_limit_per_user: this.rateLimitPerUser,
rate_limit_per_user: this.rate_limit_per_user,
position: this.position,

@@ -374,10 +373,4 @@ permission_overwrites: this.permission_overwrites.map(perm => {

}),
parent_id: this.parentId || this.parent_id,
parent_id: this.parent_id,
nsfw: this.nsfw,
rtc_region: this.rtcRegion,
video_quality_mode: this.videoQualityMode,
default_auto_archive_duration: this.defaultAutoArchiveDuration,
default_reaction_emoji: this.defaultReactionEmoji,
available_tags: this.availableTags,
default_sort_order: this.defaultSortOrder,
}

@@ -384,0 +377,0 @@ if (reason) data['reason'] = reason

@@ -11,2 +11,3 @@ const Client = require('../client/client')

const Invite = require('./Invite')
const CategoryChannel = require('./CategoryChannel')
module.exports = class VoiceChannel {

@@ -45,2 +46,3 @@ /**

this.permission_overwrites = []
this.video_quality_mode = data.video_quality_mode
this.data_is_available = true

@@ -360,3 +362,3 @@ data.permission_overwrites?.map(perm => {

user_limit: this.user_limit,
rate_limit_per_user: this.rateLimitPerUser,
rate_limit_per_user: this.rate_limit_per_user,
position: this.position,

@@ -371,10 +373,7 @@ permission_overwrites: this.permission_overwrites.map(perm => {

}),
parent_id: this.parentId || this.parent_id,
parent_id: this.parent_id,
nsfw: this.nsfw,
rtc_region: this.rtcRegion,
video_quality_mode: this.videoQualityMode,
default_auto_archive_duration: this.defaultAutoArchiveDuration,
default_reaction_emoji: this.defaultReactionEmoji,
available_tags: this.availableTags,
default_sort_order: this.defaultSortOrder,
rtc_region: this.rtc_region,
video_quality_mode: this.video_quality_mode,
}

@@ -381,0 +380,0 @@ if (reason) data['reason'] = reason

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc