eris
Advanced tools
Comparing version 0.8.5 to 0.8.6
@@ -203,3 +203,2 @@ declare module "eris" { | ||
ImageFormats: string[]; | ||
ImageSizes: number[]; | ||
GatewayOPCodes: {[key: string]: number}; | ||
@@ -516,2 +515,3 @@ GATEWAY_VERSION: number; | ||
public leaveVoiceChannel(channelID: string): void; | ||
public closeVoiceConnection(guildID: string): void; | ||
public editAFK(afk: boolean): void; | ||
@@ -1044,2 +1044,3 @@ public editStatus(status?: string, game?: GamePresence): void; | ||
public getVoiceRegions(): Promise<VoiceRegion[]>; | ||
public leaveVoiceChannel(): void; | ||
public editRole(roleID: string, options: RoleOptions): Promise<Role>; | ||
@@ -1375,3 +1376,3 @@ public deleteRole(roleID: string): Promise<void>; | ||
public constructor(data: BaseData, client: Client); | ||
public dynamicIconURL(format?: string, size?: number): string; | ||
public dynamicAvatarURL(format?: string, size?: number): string; | ||
public getDMChannel(): Promise<PrivateChannel>; | ||
@@ -1378,0 +1379,0 @@ public addRelationship(block?: boolean): Promise<void>; |
@@ -359,5 +359,12 @@ "use strict"; | ||
} | ||
if(this.commands[label]) { | ||
var lowercaseCommand = label.toLowerCase(); | ||
if(this.commands[label] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) { | ||
throw new Error("You have already registered a command for " + label); | ||
} | ||
// Aliases are not deleted when deleting commands | ||
var command = this.commandAliases[label]; // Just to make the following if statement less messy | ||
lowercaseCommand = this.commandAliases[label.toLowerCase()]; | ||
if(this.commands[command] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) { | ||
throw new Error(`Alias ${label} already registered`); | ||
} | ||
options = options || {}; | ||
@@ -372,8 +379,32 @@ options.defaultSubcommandOptions = options.defaultSubcommandOptions || {}; | ||
label = options.caseInsensitive === true ? label.toLowerCase() : label; | ||
this.commands[label] = new Command(label, generator, options); | ||
if(this.commands[label]) { | ||
throw new Error("You have already registered a command for " + label); | ||
} | ||
command = this.commandAliases[label]; | ||
if(this.commands[command]) { | ||
throw new Error(`Alias ${command} already registered`); | ||
} | ||
if(options.aliases) { | ||
options.aliases.forEach((alias) => { | ||
lowercaseCommand = alias.toLowerCase(); | ||
if(this.commands[alias] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) { | ||
throw new Error("You have already registered a command for alias " + alias); | ||
} | ||
command = this.commandAliases[alias]; | ||
lowercaseCommand = this.commandAliases[alias.toLowerCase()]; | ||
if(this.commands[command] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) { | ||
throw new Error(`Alias ${alias} already registered`); | ||
} | ||
alias = options.caseInsensitive === true ? alias.toLowerCase() : alias; | ||
if(this.commands[alias]) { | ||
throw new Error("You have already registered a command for alias " + alias); | ||
} | ||
command = this.commandAliases[alias]; | ||
if(this.commands[command]) { | ||
throw new Error(`Alias ${alias} already registered`); | ||
} | ||
this.commandAliases[alias] = label; | ||
}); | ||
} | ||
this.commands[label] = new Command(label, generator, options); | ||
return this.commands[label]; | ||
@@ -380,0 +411,0 @@ } |
@@ -18,10 +18,2 @@ "use strict"; | ||
module.exports.ImageSizes = [ | ||
128, | ||
256, | ||
512, | ||
1024, | ||
2048 | ||
]; | ||
module.exports.GatewayOPCodes = { | ||
@@ -112,3 +104,21 @@ EVENT: 0, | ||
"%user% hopped into the server. Kangaroo!!", | ||
"%user% just showed up. Hold my beer." | ||
"%user% just showed up. Hold my beer.", | ||
"Challenger approaching - %user% has appeared!", | ||
"It's a bird! It's a plane! Nevermind, it's just %user%.", | ||
"It's %user%! Praise the sun! \\[T]/", | ||
"Never gonna give %user% up. Never gonna let %user% down.", | ||
"Ha! %user% has joined! You activated my trap card!", | ||
"Cheers, love! %user%'s here!", | ||
"Hey! Listen! %user% has joined!", | ||
"We've been expecting you %user%", | ||
"It's dangerous to go alone, take %user%!", | ||
"%user% has joined the server! It's super effective!", | ||
"Cheers, love! %user% is here!", | ||
"%user% is here, as the prophecy foretold.", | ||
"%user% has arrived. Party's over.", | ||
"Ready player %user%", | ||
"%user% is here to kick butt and chew bubblegum. And %user% is all out of gum.", | ||
"Hello. Is it %user% you're looking for?", | ||
"%user% has joined. Stay a while and listen!", | ||
"Roses are red, violets are blue, %user% joined this server with you" | ||
]; | ||
@@ -115,0 +125,0 @@ |
@@ -50,5 +50,2 @@ "use strict"; | ||
} | ||
if(~route.indexOf("/reactions/:id")) { // PUT/DELETE one/all reactions is shared across the entire account | ||
route = "/channels/:id/messages/:id/reactions"; | ||
} | ||
return route; | ||
@@ -55,0 +52,0 @@ } |
@@ -81,3 +81,3 @@ "use strict"; | ||
} | ||
if(!size || !~Constants.ImageSizes.indexOf(size)) { | ||
if(size < 16 || size > 1024 || (size & (size - 1))) { | ||
size = this._client.options.defaultImageSize; | ||
@@ -84,0 +84,0 @@ } |
@@ -163,3 +163,3 @@ "use strict"; | ||
} | ||
if(!size || !~Constants.ImageSizes.indexOf(size)) { | ||
if(size < 16 || size > 1024 || (size & (size - 1))) { | ||
size = this.shard.client.options.defaultImageSize; | ||
@@ -325,2 +325,9 @@ } | ||
/** | ||
* Leaves the voice channel in this guild | ||
*/ | ||
leaveVoiceChannel() { | ||
this.shard.client.closeVoiceConnection.call(this.shard.client, this.id); | ||
} | ||
/** | ||
* Edit the guild role | ||
@@ -327,0 +334,0 @@ * @arg {String} roleID The ID of the role |
@@ -131,2 +131,13 @@ "use strict"; | ||
cleanContent = cleanContent.replace(/<(:\w+:)[0-9]+>/g, "$1"); | ||
var authorName = this.author.username; | ||
if(this.channel.guild) { | ||
var member = this.channel.guild.members.get(this.author.id); | ||
if(member && member.nick) { | ||
authorName = member.nick; | ||
} | ||
} | ||
cleanContent = cleanContent.replace(new RegExp(`<@!?${this.author.id}>`, "g"), "@" + authorName); | ||
if(this.mentions) { | ||
@@ -133,0 +144,0 @@ this.mentions.forEach((mention) => { |
@@ -9,3 +9,3 @@ "use strict"; | ||
* @prop {String} id The ID of the overwrite | ||
* @prop {String} type The type of the overwrite, either "user" or "role" | ||
* @prop {String} type The type of the overwrite, either "member" or "role" | ||
*/ | ||
@@ -28,2 +28,2 @@ class PermissionOverwrite extends Permission { | ||
module.exports = PermissionOverwrite; | ||
module.exports = PermissionOverwrite; |
@@ -74,7 +74,7 @@ "use strict"; | ||
} | ||
if(!format || !~Constants.ImageFormats.indexOf(format.toLowerCase())) { | ||
format = this.avatar.startsWith("a_") ? "gif" : this._client.options.defaultImageFormat; | ||
} | ||
if(!size || !~Constants.ImageSizes.indexOf(size)) { | ||
if(size < 16 || size > 1024 || (size & (size - 1))) { | ||
size = this._client.options.defaultImageSize; | ||
@@ -81,0 +81,0 @@ } |
@@ -11,2 +11,3 @@ "use strict"; | ||
this._remainder = null; | ||
this._bitstream = null; | ||
} | ||
@@ -28,2 +29,4 @@ | ||
var bitstream = buffer.readUInt32BE(buffer._index + 14); | ||
buffer._index += 26; | ||
@@ -64,9 +67,10 @@ | ||
this.emit("debug", segment.toString()); | ||
} else { | ||
} else if(bitstream === this._bitstream) { | ||
this.push(segment); | ||
} | ||
} else if(byte === "OpusHead") { | ||
this._bitstream = bitstream; | ||
this.emit("debug", (this.head = segment.toString())); | ||
} else { | ||
this.emit("error", new Error("Invalid codec: " + byte)); | ||
this.emit("debug", "Invalid codec: " + byte); | ||
} | ||
@@ -76,2 +80,8 @@ } | ||
_final() { | ||
if(!this._bitstream) { | ||
this.emit("error", new Error("No Opus stream was found")); | ||
} | ||
} | ||
_transform(chunk, enc, cb) { | ||
@@ -78,0 +88,0 @@ if(this._remainder) { |
{ | ||
"name": "eris", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"description": "A NodeJS Discord library", | ||
@@ -30,3 +30,3 @@ "main": "./index.js", | ||
"dependencies": { | ||
"ws": "^3.3.2" | ||
"ws": "^5.2.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "optionalDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
532967
11825
+ Addedws@5.2.3(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedultron@1.1.1(transitive)
- Removedws@3.3.3(transitive)
Updatedws@^5.2.0