Skip to content

Commit

Permalink
Lint, add recent props to toJSON()
Browse files Browse the repository at this point in the history
  • Loading branch information
abalabahaha committed Apr 4, 2021
1 parent 39dd05f commit ff8d901
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 22 deletions.
28 changes: 14 additions & 14 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2522,31 +2522,31 @@ class Client extends EventEmitter {

toJSON(props = []) {
return Base.prototype.toJSON.call(this, [
"options",
"requestHandler",
"ready",
"application",
"bot",
"startTime",
"lastConnect",
"channelGuildMap",
"shards",
"gatewayURL",
"groupChannels",
"guilds",
"guildShardMap",
"lastConnect",
"lastReconnectDelay",
"notes",
"options",
"presence",
"privateChannelMap",
"privateChannels",
"guildShardMap",
"unavailableGuilds",
"ready",
"reconnectAttempts",
"relationships",
"users",
"presence",
"requestHandler",
"shards",
"startTime",
"unavailableGuilds",
"userGuildSettings",
"users",
"userSettings",
"notes",
"voiceConnections",
"lastReconnectDelay",
"reconnectAttempts",
"application",
...props
]);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const User = require("../structures/User");
const Invite = require("../structures/Invite");
const Constants = require("../Constants");

let WebSocket = typeof window !== "undefined" ? require("../util/BrowserWebSocket") : require("ws");
const WebSocket = typeof window !== "undefined" ? require("../util/BrowserWebSocket") : require("ws");

let EventEmitter;
try {
Expand Down Expand Up @@ -141,7 +141,7 @@ class Shard extends EventEmitter {
try {
if(options.reconnect && this.sessionID) {
if(this.ws.readyState === WebSocket.OPEN) {
this.ws.close(4901, "Eris: reconnect")
this.ws.close(4901, "Eris: reconnect");
} else {
this.emit("debug", `Terminating websocket (state: ${this.ws.readyState})`, this.id);
this.ws.terminate();
Expand Down
1 change: 1 addition & 0 deletions lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ class Guild extends Base {
"vanityURL",
"verificationLevel",
"voiceStates",
"welcomeScreen",
"widgetChannelID",
"widgetEnabled",
...props
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/GuildAuditLogEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class GuildAuditLogEntry extends Base {
if(data.options.channel_id) {
this.channel = guild.channels.get(data.options.channel_id);
if(data.options.message_id) {
this.message = this.channel.messages.get(data.options.message_id) || {id: data.options.message_id};
this.message = this.channel && this.channel.messages.get(data.options.message_id) || {id: data.options.message_id};
}
}
if(data.options.delete_member_days) {
Expand Down
2 changes: 2 additions & 0 deletions lib/structures/GuildIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ class GuildIntegration extends Base {
toJSON(props = []) {
return super.toJSON([
"account",
"application",
"enabled",
"enableEmoticons",
"expireBehavior",
"expireGracePeriod",
"name",
"revoked",
"roleID",
"subscriberCount",
"syncedAt",
Expand Down
3 changes: 2 additions & 1 deletion lib/structures/Member.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const VoiceState = require("./VoiceState");
* @prop {Number} joinedAt Timestamp of when the member joined the guild
* @prop {String} mention A string that mentions the member
* @prop {String?} nick The server nickname of the member
* @prop {Boolean} [pending] Whether the member has passed the guild's Membership Screening requirements
* @prop {Boolean?} pending Whether the member has passed the guild's Membership Screening requirements
* @prop {Permission} permission [DEPRECATED] The guild-wide permissions of the member. Use Member#permissions instead
* @prop {Permission} permissions The guild-wide permissions of the member
* @prop {Number} premiumSince Timestamp of when the member boosted the guild
Expand Down Expand Up @@ -231,6 +231,7 @@ class Member extends Base {
"game",
"joinedAt",
"nick",
"pending",
"premiumSince",
"roles",
"status",
Expand Down
5 changes: 2 additions & 3 deletions lib/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ class Message extends Base {
this._client.emit("error", new Error("MESSAGE_CREATE but no message author:\n" + JSON.stringify(data, null, 2)));
}
if(data.referenced_message) {
const channel = data.referenced_message.guild_id
? this._client.guilds.get(data.referenced_message.guild_id).channels.get(data.referenced_message.channel_id)
: this._client.privateChannels.get(data.referenced_message.channel_id);
const channel = this._client.getChannel(data.referenced_message.channel_id);
if(channel) {
this.referencedMessage = channel.messages.update(data.referenced_message, this._client);
} else {
Expand Down Expand Up @@ -472,6 +470,7 @@ class Message extends Base {
"reactions",
"referencedMesssage",
"roleMentions",
"stickers",
"timestamp",
"tts",
"type",
Expand Down
7 changes: 7 additions & 0 deletions lib/structures/StageChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ class StageChannel extends VoiceChannel {
this.topic = data.topic;
}
}

toJSON(props = []) {
return super.toJSON([
"topic",
...props
]);
}
}

module.exports = StageChannel;
2 changes: 2 additions & 0 deletions lib/structures/VoiceChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class VoiceChannel extends GuildChannel {
toJSON(props = []) {
return super.toJSON([
"bitrate",
"rtcRegion",
"userLimit",
"videoQualityMode",
"voiceMembers",
...props
]);
Expand Down
1 change: 1 addition & 0 deletions lib/structures/VoiceState.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class VoiceState extends Base {
"channelID",
"deaf",
"mute",
"requestToSpeakTimestamp",
"selfDeaf",
"selfMute",
"selfStream",
Expand Down
2 changes: 1 addition & 1 deletion lib/voice/VoiceConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Piper = require("./Piper");
const VoiceDataStream = require("./VoiceDataStream");
const {createOpus} = require("../util/Opus");

let WebSocket = typeof window !== "undefined" ? require("../util/BrowserWebSocket") : require("ws");
const WebSocket = typeof window !== "undefined" ? require("../util/BrowserWebSocket") : require("ws");

let EventEmitter;
try {
Expand Down

0 comments on commit ff8d901

Please sign in to comment.