devland.js
Advanced tools
Comparing version 1.1.29 to 1.1.30
@@ -12,3 +12,3 @@ { | ||
"name": "devland.js", | ||
"version": "1.1.29", | ||
"version": "1.1.30", | ||
"description": "A powerful API wrapper for the Discord API designed for modern bots", | ||
@@ -15,0 +15,0 @@ "main": "index.js", |
const Client = require('../../client/client') | ||
const { Guild, TextChannel, Message, DmChannel, Member, User, VoiceChannel, AnnouncementChannel, Thread, StageChannel, ForumChannel } = require('../../models') | ||
const MessageFlags = require('../../util/BitFieldManagement/MessageFlags') | ||
module.exports = { | ||
@@ -4,0 +5,0 @@ name: 'messageUpdate', |
@@ -312,2 +312,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -328,2 +329,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -350,2 +352,3 @@ if (time === null) time = 0 | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -469,2 +472,3 @@ if (time === null) time = 0 | ||
if (options.name.length < 1 || options.name.length > 80) return reject(new TypeError("Create webhook options name must have a length between 1 and 80")) | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -566,2 +570,3 @@ if (typeof options.avatar !== "undefined") options.avatar = await DataResolver.resolveImage(options.avatar) | ||
} | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -568,0 +573,0 @@ this.client.rest.post(`${this.client._ENDPOINTS.CHANNEL(this.id)}/invites`, options).then(res => { |
@@ -161,2 +161,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -177,2 +178,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -199,2 +201,3 @@ if (time === null) time = 0 | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -201,0 +204,0 @@ if (time === null) time = 0 |
@@ -319,2 +319,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -335,2 +336,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -357,2 +359,3 @@ if (time === null) time = 0 | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -521,2 +524,3 @@ if (time === null) time = 0 | ||
} | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -523,0 +527,0 @@ this.client.rest.post(`${this.client._ENDPOINTS.CHANNEL(this.id)}/invites`, options).then(res => { |
@@ -655,2 +655,3 @@ const Utils = require('../util') | ||
if (!this.features.has("ROLE_ICONS")) options.icon = undefined | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -720,2 +721,3 @@ this.client.rest.post(this.client._ENDPOINTS.ROLES(this.id), options).then(res => { | ||
if (typeof user !== "string") return reject(new TypeError("The user must be a valid User or Member instance or a valid Id")) | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -744,2 +746,3 @@ let member = this.members.get(user) || null | ||
if (typeof user !== "string") return reject(new TypeError("The user must be a valid User or Member instance or a valid Id")) | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -770,2 +773,3 @@ let member = this.members.get(user) || null | ||
if (typeof user !== "string") return reject(new TypeError("The user must be a valid User or Member instance or a valid Id")) | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -827,2 +831,3 @@ this.client.rest.delete(this.client._ENDPOINTS.BANS(this.id, user), { | ||
} | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -829,0 +834,0 @@ this.client.rest.post(this.client._ENDPOINTS.PRUNE(this.id), options).then(() => { |
@@ -33,2 +33,3 @@ const Guild = require('./Guild') | ||
return new Promise(async(resolve, reject) => { | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -35,0 +36,0 @@ this.client.rest.delete(this.client._ENDPOINTS.INTEGRATIONS(this.guildId, this.id), { |
@@ -26,2 +26,3 @@ const Client = require('../client/client') | ||
return new Promise(async (resolve, reject) => { | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -28,0 +29,0 @@ this.client.rest.delete(this.client._ENDPOINTS.INVITES(this.code), { |
@@ -115,2 +115,3 @@ const MemberFlags = require('../util/BitFieldManagement/MemberFlags') | ||
else return reject(new TypeError("Invalid role provided")) | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -149,2 +150,3 @@ data.filter(r => !this.roles.includes(r)).map(r => this.roles.push(r)) | ||
else return reject(new TypeError("Invalid role provided")) | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -198,2 +200,3 @@ this.roles = this.roles.filter(r => !data.includes(r)) | ||
return new Promise(async (resolve, reject) => { | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -211,2 +214,3 @@ this.guild.kickMember(this.id, reason).then(member => { | ||
if (typeof delete_message_seconds !== "undefined" && typeof delete_message_seconds !== "number") return reject(new TypeError("delete_message_seconds must be a number")) | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -213,0 +217,0 @@ this.guild.banMember(this.id, delete_message_seconds, reason).then(member => { |
@@ -331,2 +331,3 @@ const Client = require('../client/client') | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -346,2 +347,3 @@ this.client.rest.put(this.client._ENDPOINTS.CHANNEL(this.channelId) + '/pins/' + this.id, { | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -348,0 +350,0 @@ this.client.rest.delete(this.client._ENDPOINTS.CHANNEL(this.channelId) + '/pins/' + this.id, { |
@@ -65,2 +65,3 @@ const Guild = require('./Guild') | ||
if (!this.guild.features.has("ROLE_ICONS")) options.icon = undefined | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -99,2 +100,3 @@ this.client.rest.patch(this.client._ENDPOINTS.ROLES(this.guildId, this.id), options).then(res => { | ||
return new Promise(async (resolve, reject) => { | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -101,0 +103,0 @@ this.client.rest.delete(this.client._ENDPOINTS.ROLES(this.guildId, this.id), { |
@@ -166,2 +166,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -182,2 +183,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -204,2 +206,3 @@ if (time === null) time = 0 | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -266,2 +269,3 @@ if (time === null) time = 0 | ||
if (typeof options.send_start_notification !== "boolean") options.send_start_notification = false | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -294,2 +298,3 @@ this.client.rest.post(this.client._ENDPOINTS.STAGE(), options).then((res) => { | ||
if (typeof options.privacy_level === "number" && (options.privacy_level < 1 || options.privacy_level > 2)) return reject(new TypeError("The stage start options privacy level must be between 1 and 2")) | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -306,2 +311,3 @@ this.client.rest.patch(this.client._ENDPOINTS.STAGE()+'/'+this.id, options).then((res) => { | ||
return new Promise(async(resolve, reject) => { | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -335,2 +341,3 @@ this.client.rest.delete(this.client._ENDPOINTS.STAGE()+'/'+this.id, { | ||
} | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -337,0 +344,0 @@ this.client.rest.post(`${this.client._ENDPOINTS.CHANNEL(this.id)}/invites`, options).then(res => { |
@@ -316,2 +316,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -332,2 +333,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -354,2 +356,3 @@ if (time === null) time = 0 | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -459,2 +462,3 @@ if (time === null) time = 0 | ||
if (options.name.length < 1 || options.name.length > 80) return reject(new TypeError("Create webhook options name must have a length between 1 and 80")) | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -555,2 +559,3 @@ if (typeof options.avatar !== "undefined") options.avatar = await DataResolver.resolveImage(options.avatar) | ||
} | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -557,0 +562,0 @@ this.client.rest.post(`${this.client._ENDPOINTS.CHANNEL(this.id)}/invites`, options).then(res => { |
@@ -303,2 +303,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -319,2 +320,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -321,0 +323,0 @@ if (time === null) time = 0 |
@@ -313,2 +313,3 @@ const Client = require('../client/client') | ||
} | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -329,2 +330,3 @@ options["reason"] = reason | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -351,2 +353,3 @@ if (time === null) time = 0 | ||
if (reason === null) reason = undefined | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -541,2 +544,3 @@ if (time === null) time = 0 | ||
} | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -543,0 +547,0 @@ this.client.rest.post(`${this.client._ENDPOINTS.CHANNEL(this.id)}/invites`, options).then(res => { |
@@ -40,2 +40,3 @@ const Client = require('../client/client') | ||
if (typeof options.avatar !== "undefined") options.avatar = await DataResolver.resolveImage(options.avatar) | ||
if (options.reason === null) options.reason = undefined | ||
if (typeof options.reason !== "undefined" && typeof options.reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -54,2 +55,3 @@ this.client.rest.patch(this.client._ENDPOINTS.WEBHOOKS(this.id), options).then(res => { | ||
return new Promise(async (resolve, reject) => { | ||
if (reason === null) reason = undefined | ||
if (typeof reason !== "undefined" && typeof reason !== "string") return reject(new TypeError("The reason must be a string or a undefined value")) | ||
@@ -56,0 +58,0 @@ this.client.rest.delete(this.client._ENDPOINTS.WEBHOOKS(this.id), { |
1463752
14194