Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,31 @@ const classSortCommon = {
{
kind: "get",
sort: "alphabetical",
static: false
static: false,
private: false
}
],
"alphabetical-methods": [
{
type: "method",
sort: "alphabetical",
static: false
static: false,
private: false
}
],
"alphabetical-properties": [
{
type: "property",
sort: "alphabetical",
static: false
static: false,
private: false
}
],
"alphabetical-private-properties": [
{
type: "property",
sort: "alphabetical",
static: false,
private: true
}
],
Expand Down Expand Up @@ -209,7 +213,6 @@ export default ts.config(
{
after: true,
overrides: {
catch: {after: false},
for: {after: false},
if: {after: false},
switch: {after: false},
Expand All @@ -221,7 +224,12 @@ export default ts.config(
"error",
"never"
],
"@stylistic/space-before-function-paren": "off"
"@stylistic/space-before-function-paren": ["error", {
anonymous: "never",
named: "never",
asyncArrow: "always",
catch: "never"
}]
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const VoiceState = require("./structures/VoiceState");
let EventEmitter;
try {
EventEmitter = require("eventemitter3");
} catch{
} catch {
EventEmitter = require("node:events");
}
let Erlpack;
try {
Erlpack = require("erlpack");
} catch{ // eslint-disable no-empty
} catch { // eslint-disable no-empty
}

const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
Expand Down
8 changes: 4 additions & 4 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ const WebSocket = typeof window !== "undefined" ? require("../util/BrowserWebSoc
let EventEmitter;
try {
EventEmitter = require("eventemitter3");
} catch{
} catch {
EventEmitter = require("node:events").EventEmitter;
}
let Erlpack;
try {
Erlpack = require("erlpack");
} catch{ // eslint-disable no-empty
} catch { // eslint-disable no-empty
}
let ZlibSync;
try {
ZlibSync = require("zlib-sync");
} catch{
} catch {
try {
ZlibSync = require("pako");
} catch{ // eslint-disable no-empty
} catch { // eslint-disable no-empty
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/gateway/ShardManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ const Constants = require("../Constants");
let ZlibSync;
try {
ZlibSync = require("zlib-sync");
} catch{
} catch {
try {
ZlibSync = require("pako");
} catch{ // eslint-disable no-empty
} catch { // eslint-disable no-empty
}
}
class ShardManager extends Collection {
#client;
buckets = new Map();
connectQueue = [];
connectTimeout = null;
#client;

constructor(client, options = {}) {
super(Shard);
Expand Down
3 changes: 2 additions & 1 deletion lib/rest/RequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ const Zlib = require("node:zlib");
* Handles API requests
*/
class RequestHandler {
#client;
globalBlock = false;
ratelimits = {};
readyQueue = [];
userAgent = `DiscordBot (https://github.com/projectdysnomia/dysnomia, ${require("../../package.json").version})`;
#client;

constructor(client, options) {
this.options = Object.assign({
agent: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const SoundboardSound = require("./SoundboardSound");
* @extends Base
*/
class Guild extends Base {
#client;
/**
* Collection of Channels in the guild
* @type {Collection<GuildChannel>}
Expand Down Expand Up @@ -61,6 +60,7 @@ class Guild extends Base {
* @type {Collection<VoiceState>}
*/
voiceStates = new Collection(VoiceState);
#client;

/**
* Timestamp of the guild's creation
Expand Down
11 changes: 6 additions & 5 deletions lib/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ const InteractionMetadata = require("./InteractionMetadata");
* @extends Base
*/
class Message extends Base {
/**
* A collection of attachments
* @type {Collection<Attachment>}
*/
attachments = new Collection(Attachment);
/**
* Timestamp of message creation
* @member {Number} Message#createdAt
Expand All @@ -23,11 +28,7 @@ class Message extends Base {
*/
#channelMentions;
#client;
/**
* A collection of attachments
* @type {Collection<Attachment>}
*/
attachments = new Collection(Attachment);

constructor(data, client) {
super(data.id);
this.#client = client;
Expand Down
3 changes: 1 addition & 2 deletions lib/structures/PrivateChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ const User = require("./User");
* @extends Channel
*/
class PrivateChannel extends Channel {
#client;

/**
* The recipients of this private channel
* @type {Collection<User>}
*/
recipients = new Collection(User);
#client;

constructor(data, client) {
super(data);
Expand Down
2 changes: 1 addition & 1 deletion lib/util/BrowserWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Base = require("../structures/Base");
let EventEmitter;
try {
EventEmitter = require("eventemitter3");
} catch{
} catch {
EventEmitter = require("node:events").EventEmitter;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/util/Bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const Base = require("../structures/Base");
* Handle ratelimiting something
*/
class Bucket {
#queue = [];
/**
* Timestamp of last token clearing
* @type {Number}
Expand All @@ -23,6 +22,7 @@ class Bucket {
* @type {Number}
*/
tokens = 0;
#queue = [];
/**
* Construct a Bucket
* @param {Number} tokenLimit The max number of tokens the bucket can consume per interval
Expand Down
4 changes: 2 additions & 2 deletions lib/util/Opus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ module.exports.createOpus = function createOpus(samplingRate, channels, bitrate)
if(!NativeOpus && !OpusScript) {
try {
NativeOpus = require("@discordjs/opus");
} catch{
} catch {
try {
OpusScript = require("opusscript");
} catch{ // eslint-disable no-empty
} catch { // eslint-disable no-empty
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/util/SequentialBucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const Base = require("../structures/Base");
* TODO: add latencyref
*/
class SequentialBucket {
#queue = [];
/**
* Whether the queue is being processed
* @type {Boolean}
Expand All @@ -19,6 +18,7 @@ class SequentialBucket {
* @type {Number}
*/
reset = 0;
#queue = [];
/**
* How many tokens the bucket has left in the current interval
* @member {Number} SequentialBucket#remaining
Expand Down
10 changes: 5 additions & 5 deletions lib/voice/Piper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const WebmOpusTransformer = require("./streams/WebmOpusTransformer");
let EventEmitter;
try {
EventEmitter = require("eventemitter3");
} catch{
} catch {
EventEmitter = require("node:events").EventEmitter;
}

Expand All @@ -45,15 +45,15 @@ function webGetter(link, depth = 8) {
}

class Piper extends EventEmitter {
encoding = false;
libopus = true;
opus = null;
volumeLevel = 1;
#dataPacketMax = 30;
#dataPacketMin = 15;
#dataPackets = [];
#endStream;
#retransformer = [];
encoding = false;
libopus = true;
opus = null;
volumeLevel = 1;

constructor(converterCommand, opusFactory) {
super();
Expand Down
4 changes: 2 additions & 2 deletions lib/voice/SharedStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {createOpus} = require("../util/Opus");
let EventEmitter;
try {
EventEmitter = require("eventemitter3");
} catch{
} catch {
EventEmitter = require("node:events").EventEmitter;
}

Expand All @@ -19,7 +19,6 @@ try {
* @extends EventEmitter
*/
class SharedStream extends EventEmitter {
#send;
bitrate = 64_000;
channels = 2;
/**
Expand All @@ -40,6 +39,7 @@ class SharedStream extends EventEmitter {
*/
speaking = false;
voiceConnections = new Collection(VoiceConnection);
#send;

constructor() {
super();
Expand Down
Loading