From 22ec139a61a6dd6962c46230767ee2a7c79a3eb9 Mon Sep 17 00:00:00 2001 From: Lioness100 Date: Wed, 24 Mar 2021 09:19:00 -0400 Subject: [PATCH 01/10] fix: use `Guild#memberCount` instead of relying on User collection size --- lib/Interface/Clients/DiscordIO.js | 2 ++ lib/Interface/Clients/DiscordJS.js | 8 +++++--- lib/Interface/Clients/Discordie.js | 2 ++ lib/Interface/Clients/Eris.js | 2 ++ lib/Interface/Clients/Paracord.js | 2 ++ lib/Interface/Lists/Arcane.js | 2 ++ lib/Interface/Lists/AstroBotList.js | 2 ++ lib/Interface/Lists/BladeBotList.js | 2 ++ lib/Interface/Lists/Blist.js | 2 ++ lib/Interface/Lists/BotListSpace.js | 2 ++ lib/Interface/Lists/BotsDataBase.js | 2 ++ lib/Interface/Lists/BotsForDiscord.js | 2 ++ lib/Interface/Lists/BotsOnDiscord.js | 2 ++ lib/Interface/Lists/Carbon.js | 2 ++ lib/Interface/Lists/DBots.js | 2 ++ lib/Interface/Lists/DiscordAppsDev.js | 2 ++ lib/Interface/Lists/DiscordBoats.js | 2 ++ lib/Interface/Lists/DiscordBotDirectory.js | 2 ++ lib/Interface/Lists/DiscordBotList.js | 2 ++ lib/Interface/Lists/DiscordBotsCo.js | 2 ++ lib/Interface/Lists/DiscordBotsGG.js | 2 ++ lib/Interface/Lists/DiscordExtremeList.js | 2 ++ lib/Interface/Lists/DiscordLabs.js | 2 ++ lib/Interface/Lists/DiscordListology.js | 2 ++ lib/Interface/Lists/DiscordServices.js | 2 ++ lib/Interface/Lists/Disforge.js | 2 ++ lib/Interface/Lists/GlennBotList.js | 2 ++ lib/Interface/Lists/InfinityBots.js | 9 ++++++--- lib/Interface/Lists/ListMyBots.js | 2 ++ lib/Interface/Lists/ParadiseBots.js | 9 ++++++--- lib/Interface/Lists/SpaceBotsList.js | 2 ++ lib/Interface/Lists/TopCord.js | 2 ++ lib/Interface/Lists/TopGG.js | 2 ++ lib/Interface/Lists/VoidBots.js | 11 +++++++---- lib/Interface/Lists/WonderBotList.js | 2 ++ lib/Interface/Lists/YABL.js | 2 ++ lib/Interface/Poster.js | 12 +++++------- lib/Interface/Service.js | 12 +++++------- lib/Utils/DBotsError.js | 2 ++ src/Interface/Clients/DiscordJS.ts | 14 +++++++++++--- 40 files changed, 111 insertions(+), 30 deletions(-) diff --git a/lib/Interface/Clients/DiscordIO.js b/lib/Interface/Clients/DiscordIO.js index 4b785aaf..3ee3a2f2 100644 --- a/lib/Interface/Clients/DiscordIO.js +++ b/lib/Interface/Clients/DiscordIO.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Clients/DiscordJS.js b/lib/Interface/Clients/DiscordJS.js index f55bb488..cda7f91f 100644 --- a/lib/Interface/Clients/DiscordJS.js +++ b/lib/Interface/Clients/DiscordJS.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); @@ -26,10 +28,10 @@ var DiscordJS = /** @class */ (function (_super) { Object.defineProperty(DiscordJS.prototype, "userCount", { get: function () { var _a, _b, _c, _d, _e; - if (((_b = (_a = this.client.users) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'UserManager') - return (_d = (_c = this.client.users) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.size; + if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'UserManager') + return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.reduce(function (count, guild) { return count + guild.memberCount; }, 0); else - return (_e = this.client.users) === null || _e === void 0 ? void 0 : _e.size; + return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.reduce(function (count, guild) { return count + guild.memberCount; }, 0); }, enumerable: false, configurable: true diff --git a/lib/Interface/Clients/Discordie.js b/lib/Interface/Clients/Discordie.js index c7a6d228..0b5c9fea 100644 --- a/lib/Interface/Clients/Discordie.js +++ b/lib/Interface/Clients/Discordie.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Clients/Eris.js b/lib/Interface/Clients/Eris.js index d55ff602..d3f67608 100644 --- a/lib/Interface/Clients/Eris.js +++ b/lib/Interface/Clients/Eris.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Clients/Paracord.js b/lib/Interface/Clients/Paracord.js index 19b56c60..865b3c9f 100644 --- a/lib/Interface/Clients/Paracord.js +++ b/lib/Interface/Clients/Paracord.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/Arcane.js b/lib/Interface/Lists/Arcane.js index 19e594a9..3b8de6cb 100644 --- a/lib/Interface/Lists/Arcane.js +++ b/lib/Interface/Lists/Arcane.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/AstroBotList.js b/lib/Interface/Lists/AstroBotList.js index 760f0a96..93b4a3d9 100644 --- a/lib/Interface/Lists/AstroBotList.js +++ b/lib/Interface/Lists/AstroBotList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/BladeBotList.js b/lib/Interface/Lists/BladeBotList.js index 47bd3ffc..9031bdf8 100644 --- a/lib/Interface/Lists/BladeBotList.js +++ b/lib/Interface/Lists/BladeBotList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/Blist.js b/lib/Interface/Lists/Blist.js index 5dad1f4c..971ccf82 100644 --- a/lib/Interface/Lists/Blist.js +++ b/lib/Interface/Lists/Blist.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/BotListSpace.js b/lib/Interface/Lists/BotListSpace.js index a396e475..54928077 100644 --- a/lib/Interface/Lists/BotListSpace.js +++ b/lib/Interface/Lists/BotListSpace.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/BotsDataBase.js b/lib/Interface/Lists/BotsDataBase.js index bb01ec1c..e4d08267 100644 --- a/lib/Interface/Lists/BotsDataBase.js +++ b/lib/Interface/Lists/BotsDataBase.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/BotsForDiscord.js b/lib/Interface/Lists/BotsForDiscord.js index eecb21d1..8ffe2f6a 100644 --- a/lib/Interface/Lists/BotsForDiscord.js +++ b/lib/Interface/Lists/BotsForDiscord.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/BotsOnDiscord.js b/lib/Interface/Lists/BotsOnDiscord.js index 3c7f2d34..c8076e43 100644 --- a/lib/Interface/Lists/BotsOnDiscord.js +++ b/lib/Interface/Lists/BotsOnDiscord.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/Carbon.js b/lib/Interface/Lists/Carbon.js index 6007d293..871eb124 100644 --- a/lib/Interface/Lists/Carbon.js +++ b/lib/Interface/Lists/Carbon.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DBots.js b/lib/Interface/Lists/DBots.js index ae6d0b67..fda8b55b 100644 --- a/lib/Interface/Lists/DBots.js +++ b/lib/Interface/Lists/DBots.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordAppsDev.js b/lib/Interface/Lists/DiscordAppsDev.js index ffc121e0..c499051f 100644 --- a/lib/Interface/Lists/DiscordAppsDev.js +++ b/lib/Interface/Lists/DiscordAppsDev.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordBoats.js b/lib/Interface/Lists/DiscordBoats.js index 53113c6c..46b101d4 100644 --- a/lib/Interface/Lists/DiscordBoats.js +++ b/lib/Interface/Lists/DiscordBoats.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordBotDirectory.js b/lib/Interface/Lists/DiscordBotDirectory.js index 6e664288..85f0cac2 100644 --- a/lib/Interface/Lists/DiscordBotDirectory.js +++ b/lib/Interface/Lists/DiscordBotDirectory.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordBotList.js b/lib/Interface/Lists/DiscordBotList.js index 09774d36..b3b75481 100644 --- a/lib/Interface/Lists/DiscordBotList.js +++ b/lib/Interface/Lists/DiscordBotList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordBotsCo.js b/lib/Interface/Lists/DiscordBotsCo.js index 3c50ae76..d56199de 100644 --- a/lib/Interface/Lists/DiscordBotsCo.js +++ b/lib/Interface/Lists/DiscordBotsCo.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordBotsGG.js b/lib/Interface/Lists/DiscordBotsGG.js index ef4c930b..f32a17f9 100644 --- a/lib/Interface/Lists/DiscordBotsGG.js +++ b/lib/Interface/Lists/DiscordBotsGG.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordExtremeList.js b/lib/Interface/Lists/DiscordExtremeList.js index bb875419..5dcdeb1a 100644 --- a/lib/Interface/Lists/DiscordExtremeList.js +++ b/lib/Interface/Lists/DiscordExtremeList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordLabs.js b/lib/Interface/Lists/DiscordLabs.js index e3cfbe97..a5b21dc6 100644 --- a/lib/Interface/Lists/DiscordLabs.js +++ b/lib/Interface/Lists/DiscordLabs.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordListology.js b/lib/Interface/Lists/DiscordListology.js index 95587ec1..da56cd4c 100644 --- a/lib/Interface/Lists/DiscordListology.js +++ b/lib/Interface/Lists/DiscordListology.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/DiscordServices.js b/lib/Interface/Lists/DiscordServices.js index d0cf52d4..d685589a 100644 --- a/lib/Interface/Lists/DiscordServices.js +++ b/lib/Interface/Lists/DiscordServices.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/Disforge.js b/lib/Interface/Lists/Disforge.js index d907495e..76ba5d35 100644 --- a/lib/Interface/Lists/Disforge.js +++ b/lib/Interface/Lists/Disforge.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/GlennBotList.js b/lib/Interface/Lists/GlennBotList.js index 661ffa87..423bf616 100644 --- a/lib/Interface/Lists/GlennBotList.js +++ b/lib/Interface/Lists/GlennBotList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/InfinityBots.js b/lib/Interface/Lists/InfinityBots.js index 50f79125..83b7fabb 100644 --- a/lib/Interface/Lists/InfinityBots.js +++ b/lib/Interface/Lists/InfinityBots.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); @@ -87,9 +89,10 @@ var InfinityBots = /** @class */ (function (_super) { headers: { authorization: token }, - data: __assign({ servers: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) ? { - shards: Util_1.Util.resolveCount(shard.count) - } + data: __assign({ servers: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) + ? { + shards: Util_1.Util.resolveCount(shard.count) + } : {})) }); }; diff --git a/lib/Interface/Lists/ListMyBots.js b/lib/Interface/Lists/ListMyBots.js index 76e3294b..5915f391 100644 --- a/lib/Interface/Lists/ListMyBots.js +++ b/lib/Interface/Lists/ListMyBots.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/ParadiseBots.js b/lib/Interface/Lists/ParadiseBots.js index 7eec9929..da86b136 100644 --- a/lib/Interface/Lists/ParadiseBots.js +++ b/lib/Interface/Lists/ParadiseBots.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); @@ -87,9 +89,10 @@ var ParadiseBots = /** @class */ (function (_super) { headers: { Authorization: token }, - data: __assign({ server_count: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) ? { - shard_count: Util_1.Util.resolveCount(shard.count) - } + data: __assign({ server_count: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) + ? { + shard_count: Util_1.Util.resolveCount(shard.count) + } : {})) }); }; diff --git a/lib/Interface/Lists/SpaceBotsList.js b/lib/Interface/Lists/SpaceBotsList.js index 8d5c2b76..a2f5f1b0 100644 --- a/lib/Interface/Lists/SpaceBotsList.js +++ b/lib/Interface/Lists/SpaceBotsList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/TopCord.js b/lib/Interface/Lists/TopCord.js index fab400aa..3011c4b2 100644 --- a/lib/Interface/Lists/TopCord.js +++ b/lib/Interface/Lists/TopCord.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/TopGG.js b/lib/Interface/Lists/TopGG.js index adf53c49..d7eea770 100644 --- a/lib/Interface/Lists/TopGG.js +++ b/lib/Interface/Lists/TopGG.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/VoidBots.js b/lib/Interface/Lists/VoidBots.js index 6d9f26a2..70d5f88f 100644 --- a/lib/Interface/Lists/VoidBots.js +++ b/lib/Interface/Lists/VoidBots.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); @@ -74,10 +76,11 @@ var VoidBots = /** @class */ (function (_super) { method: 'post', url: "/bot/stats/" + Util_1.Util.resolveID(clientID), headers: { Authorization: token }, - data: (shard === null || shard === void 0 ? void 0 : shard.count) ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: Util_1.Util.resolveCount(shard.count) - } + data: (shard === null || shard === void 0 ? void 0 : shard.count) + ? { + server_count: Util_1.Util.resolveCount(serverCount), + shard_count: Util_1.Util.resolveCount(shard.count) + } : { server_count: Util_1.Util.resolveCount(serverCount) } }); }; diff --git a/lib/Interface/Lists/WonderBotList.js b/lib/Interface/Lists/WonderBotList.js index f368c4ec..223377fd 100644 --- a/lib/Interface/Lists/WonderBotList.js +++ b/lib/Interface/Lists/WonderBotList.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Lists/YABL.js b/lib/Interface/Lists/YABL.js index 28743aec..aa52c916 100644 --- a/lib/Interface/Lists/YABL.js +++ b/lib/Interface/Lists/YABL.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/lib/Interface/Poster.js b/lib/Interface/Poster.js index e1559bf2..41b065a7 100644 --- a/lib/Interface/Poster.js +++ b/lib/Interface/Poster.js @@ -1,10 +1,8 @@ "use strict"; -var __spreadArrays = (this && this.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -313,7 +311,7 @@ var Poster = /** @class */ (function () { throw new TypeError('UNSUPPORTED_EVENT', 'run'); for (var _a = 0, _b = this.handlers[event]; _a < _b.length; _a++) { var handler = _b[_a]; - EnsurePromise_1.ensurePromise.apply(void 0, __spreadArrays([handler], args)); + EnsurePromise_1.ensurePromise.apply(void 0, __spreadArray([handler], args)); } }; return Poster; diff --git a/lib/Interface/Service.js b/lib/Interface/Service.js index bb741d27..c66e3478 100644 --- a/lib/Interface/Service.js +++ b/lib/Interface/Service.js @@ -10,12 +10,10 @@ var __assign = (this && this.__assign) || function () { }; return __assign.apply(this, arguments); }; -var __spreadArrays = (this && this.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -53,7 +51,7 @@ var Service = /** @class */ (function () { if (extras === void 0) { extras = []; } if (!key || typeof key !== 'string') return null; - var services = __spreadArrays(Object.values(serviceClasses), extras); + var services = __spreadArray(__spreadArray([], Object.values(serviceClasses)), extras); for (var _i = 0, services_1 = services; _i < services_1.length; _i++) { var service = services_1[_i]; if (!service || !service.aliases || !service.post) diff --git a/lib/Utils/DBotsError.js b/lib/Utils/DBotsError.js index 748ea49c..ef176f59 100644 --- a/lib/Utils/DBotsError.js +++ b/lib/Utils/DBotsError.js @@ -8,6 +8,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); diff --git a/src/Interface/Clients/DiscordJS.ts b/src/Interface/Clients/DiscordJS.ts index 761520f5..d009099d 100644 --- a/src/Interface/Clients/DiscordJS.ts +++ b/src/Interface/Clients/DiscordJS.ts @@ -1,3 +1,4 @@ +import { AnyObject } from '../../Utils/Util' import { Shard } from '../../Utils/Constants' import { ClientFiller } from '../ClientFiller' @@ -7,9 +8,16 @@ import { ClientFiller } from '../ClientFiller' */ export default class DiscordJS extends ClientFiller { get userCount(): number { - if (this.client.users?.constructor?.name === 'UserManager') - return this.client.users?.cache?.size - else return this.client.users?.size + if (this.client.guilds?.constructor?.name === 'UserManager') + return this.client.guilds?.cache?.reduce( + (count: number, guild: AnyObject) => count + guild.memberCount, + 0 + ) + else + return this.client.guilds?.reduce( + (count: number, guild: AnyObject) => count + guild.memberCount, + 0 + ) } get serverCount(): number { From 7871d33a22248cbe3dbb21f224e3a394ace784f7 Mon Sep 17 00:00:00 2001 From: Lioness100 Date: Wed, 24 Mar 2021 09:33:16 -0400 Subject: [PATCH 02/10] fix: forgot to change manager name --- lib/Interface/Clients/DiscordJS.js | 2 +- src/Interface/Clients/DiscordJS.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Interface/Clients/DiscordJS.js b/lib/Interface/Clients/DiscordJS.js index cda7f91f..f0792003 100644 --- a/lib/Interface/Clients/DiscordJS.js +++ b/lib/Interface/Clients/DiscordJS.js @@ -28,7 +28,7 @@ var DiscordJS = /** @class */ (function (_super) { Object.defineProperty(DiscordJS.prototype, "userCount", { get: function () { var _a, _b, _c, _d, _e; - if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'UserManager') + if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.reduce(function (count, guild) { return count + guild.memberCount; }, 0); else return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.reduce(function (count, guild) { return count + guild.memberCount; }, 0); diff --git a/src/Interface/Clients/DiscordJS.ts b/src/Interface/Clients/DiscordJS.ts index d009099d..142d9d2f 100644 --- a/src/Interface/Clients/DiscordJS.ts +++ b/src/Interface/Clients/DiscordJS.ts @@ -8,7 +8,7 @@ import { ClientFiller } from '../ClientFiller' */ export default class DiscordJS extends ClientFiller { get userCount(): number { - if (this.client.guilds?.constructor?.name === 'UserManager') + if (this.client.guilds?.constructor?.name === 'GuildManager') return this.client.guilds?.cache?.reduce( (count: number, guild: AnyObject) => count + guild.memberCount, 0 From be38c1b83e74ca336d8ba1b0d70ed97503562ed5 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Thu, 25 Mar 2021 08:17:58 +0100 Subject: [PATCH 03/10] fix: try to fix merge conflicts --- lib/Interface/ClientFiller.d.ts | 30 -- lib/Interface/ClientFiller.js | 93 ------ lib/Interface/Clients/DiscordIO.d.ts | 13 - lib/Interface/Clients/DiscordIO.js | 76 ----- lib/Interface/Clients/DiscordJS.d.ts | 13 - lib/Interface/Clients/DiscordJS.js | 83 ----- lib/Interface/Clients/Discordie.d.ts | 13 - lib/Interface/Clients/Discordie.js | 75 ----- lib/Interface/Clients/Eris.d.ts | 16 - lib/Interface/Clients/Eris.js | 78 ----- lib/Interface/Clients/Paracord.d.ts | 20 -- lib/Interface/Clients/Paracord.js | 76 ----- lib/Interface/Lists/Arcane.d.ts | 22 -- lib/Interface/Lists/Arcane.js | 93 ------ lib/Interface/Lists/AstroBotList.d.ts | 24 -- lib/Interface/Lists/AstroBotList.js | 95 ------ lib/Interface/Lists/BladeBotList.d.ts | 34 -- lib/Interface/Lists/BladeBotList.js | 106 ------ lib/Interface/Lists/Blist.d.ts | 65 ---- lib/Interface/Lists/Blist.js | 152 --------- lib/Interface/Lists/BotListSpace.d.ts | 58 ---- lib/Interface/Lists/BotListSpace.js | 141 -------- lib/Interface/Lists/BotsDataBase.d.ts | 39 --- lib/Interface/Lists/BotsDataBase.js | 112 ------- lib/Interface/Lists/BotsForDiscord.d.ts | 51 --- lib/Interface/Lists/BotsForDiscord.js | 121 ------- lib/Interface/Lists/BotsOnDiscord.d.ts | 37 --- lib/Interface/Lists/BotsOnDiscord.js | 107 ------- lib/Interface/Lists/Carbon.d.ts | 24 -- lib/Interface/Lists/Carbon.js | 87 ----- lib/Interface/Lists/DBots.d.ts | 34 -- lib/Interface/Lists/DBots.js | 105 ------ lib/Interface/Lists/DiscordAppsDev.d.ts | 41 --- lib/Interface/Lists/DiscordAppsDev.js | 119 ------- lib/Interface/Lists/DiscordBoats.d.ts | 47 --- lib/Interface/Lists/DiscordBoats.js | 118 ------- lib/Interface/Lists/DiscordBotDirectory.d.ts | 30 -- lib/Interface/Lists/DiscordBotDirectory.js | 93 ------ lib/Interface/Lists/DiscordBotList.d.ts | 22 -- lib/Interface/Lists/DiscordBotList.js | 91 ------ lib/Interface/Lists/DiscordBotsCo.d.ts | 28 -- lib/Interface/Lists/DiscordBotsCo.js | 104 ------ lib/Interface/Lists/DiscordBotsGG.d.ts | 55 ---- lib/Interface/Lists/DiscordBotsGG.js | 147 --------- lib/Interface/Lists/DiscordExtremeList.d.ts | 35 -- lib/Interface/Lists/DiscordExtremeList.js | 120 ------- lib/Interface/Lists/DiscordLabs.d.ts | 28 -- lib/Interface/Lists/DiscordLabs.js | 99 ------ lib/Interface/Lists/DiscordListology.d.ts | 45 --- lib/Interface/Lists/DiscordListology.js | 123 ------- lib/Interface/Lists/DiscordServices.d.ts | 45 --- lib/Interface/Lists/DiscordServices.js | 120 ------- lib/Interface/Lists/Disforge.d.ts | 31 -- lib/Interface/Lists/Disforge.js | 101 ------ lib/Interface/Lists/GlennBotList.d.ts | 45 --- lib/Interface/Lists/GlennBotList.js | 121 ------- lib/Interface/Lists/InfinityBots.d.ts | 33 -- lib/Interface/Lists/InfinityBots.js | 119 ------- lib/Interface/Lists/ListMyBots.d.ts | 52 --- lib/Interface/Lists/ListMyBots.js | 122 ------- lib/Interface/Lists/ParadiseBots.d.ts | 28 -- lib/Interface/Lists/ParadiseBots.js | 108 ------- lib/Interface/Lists/SpaceBotsList.d.ts | 29 -- lib/Interface/Lists/SpaceBotsList.js | 95 ------ lib/Interface/Lists/TopCord.d.ts | 32 -- lib/Interface/Lists/TopCord.js | 102 ------ lib/Interface/Lists/TopGG.d.ts | 62 ---- lib/Interface/Lists/TopGG.js | 159 --------- lib/Interface/Lists/VoidBots.d.ts | 44 --- lib/Interface/Lists/VoidBots.js | 134 -------- lib/Interface/Lists/WonderBotList.d.ts | 33 -- lib/Interface/Lists/WonderBotList.js | 110 ------- lib/Interface/Lists/YABL.d.ts | 48 --- lib/Interface/Lists/YABL.js | 137 -------- lib/Interface/Poster.d.ts | 100 ------ lib/Interface/Poster.js | 319 ------------------- lib/Interface/Service.d.ts | 89 ------ lib/Interface/Service.js | 183 ----------- lib/Utils/Constants.d.ts | 111 ------- lib/Utils/Constants.js | 10 - lib/Utils/DBotsError.d.ts | 64 ---- lib/Utils/DBotsError.js | 143 --------- lib/Utils/EnsurePromise.d.ts | 6 - lib/Utils/EnsurePromise.js | 14 - lib/Utils/FormatRequest.d.ts | 27 -- lib/Utils/FormatRequest.js | 36 --- lib/Utils/Util.d.ts | 35 -- lib/Utils/Util.js | 56 ---- lib/index.d.ts | 10 - lib/index.js | 35 -- 90 files changed, 6586 deletions(-) delete mode 100644 lib/Interface/ClientFiller.d.ts delete mode 100644 lib/Interface/ClientFiller.js delete mode 100644 lib/Interface/Clients/DiscordIO.d.ts delete mode 100644 lib/Interface/Clients/DiscordIO.js delete mode 100644 lib/Interface/Clients/DiscordJS.d.ts delete mode 100644 lib/Interface/Clients/DiscordJS.js delete mode 100644 lib/Interface/Clients/Discordie.d.ts delete mode 100644 lib/Interface/Clients/Discordie.js delete mode 100644 lib/Interface/Clients/Eris.d.ts delete mode 100644 lib/Interface/Clients/Eris.js delete mode 100644 lib/Interface/Clients/Paracord.d.ts delete mode 100644 lib/Interface/Clients/Paracord.js delete mode 100644 lib/Interface/Lists/Arcane.d.ts delete mode 100644 lib/Interface/Lists/Arcane.js delete mode 100644 lib/Interface/Lists/AstroBotList.d.ts delete mode 100644 lib/Interface/Lists/AstroBotList.js delete mode 100644 lib/Interface/Lists/BladeBotList.d.ts delete mode 100644 lib/Interface/Lists/BladeBotList.js delete mode 100644 lib/Interface/Lists/Blist.d.ts delete mode 100644 lib/Interface/Lists/Blist.js delete mode 100644 lib/Interface/Lists/BotListSpace.d.ts delete mode 100644 lib/Interface/Lists/BotListSpace.js delete mode 100644 lib/Interface/Lists/BotsDataBase.d.ts delete mode 100644 lib/Interface/Lists/BotsDataBase.js delete mode 100644 lib/Interface/Lists/BotsForDiscord.d.ts delete mode 100644 lib/Interface/Lists/BotsForDiscord.js delete mode 100644 lib/Interface/Lists/BotsOnDiscord.d.ts delete mode 100644 lib/Interface/Lists/BotsOnDiscord.js delete mode 100644 lib/Interface/Lists/Carbon.d.ts delete mode 100644 lib/Interface/Lists/Carbon.js delete mode 100644 lib/Interface/Lists/DBots.d.ts delete mode 100644 lib/Interface/Lists/DBots.js delete mode 100644 lib/Interface/Lists/DiscordAppsDev.d.ts delete mode 100644 lib/Interface/Lists/DiscordAppsDev.js delete mode 100644 lib/Interface/Lists/DiscordBoats.d.ts delete mode 100644 lib/Interface/Lists/DiscordBoats.js delete mode 100644 lib/Interface/Lists/DiscordBotDirectory.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotDirectory.js delete mode 100644 lib/Interface/Lists/DiscordBotList.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotList.js delete mode 100644 lib/Interface/Lists/DiscordBotsCo.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotsCo.js delete mode 100644 lib/Interface/Lists/DiscordBotsGG.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotsGG.js delete mode 100644 lib/Interface/Lists/DiscordExtremeList.d.ts delete mode 100644 lib/Interface/Lists/DiscordExtremeList.js delete mode 100644 lib/Interface/Lists/DiscordLabs.d.ts delete mode 100644 lib/Interface/Lists/DiscordLabs.js delete mode 100644 lib/Interface/Lists/DiscordListology.d.ts delete mode 100644 lib/Interface/Lists/DiscordListology.js delete mode 100644 lib/Interface/Lists/DiscordServices.d.ts delete mode 100644 lib/Interface/Lists/DiscordServices.js delete mode 100644 lib/Interface/Lists/Disforge.d.ts delete mode 100644 lib/Interface/Lists/Disforge.js delete mode 100644 lib/Interface/Lists/GlennBotList.d.ts delete mode 100644 lib/Interface/Lists/GlennBotList.js delete mode 100644 lib/Interface/Lists/InfinityBots.d.ts delete mode 100644 lib/Interface/Lists/InfinityBots.js delete mode 100644 lib/Interface/Lists/ListMyBots.d.ts delete mode 100644 lib/Interface/Lists/ListMyBots.js delete mode 100644 lib/Interface/Lists/ParadiseBots.d.ts delete mode 100644 lib/Interface/Lists/ParadiseBots.js delete mode 100644 lib/Interface/Lists/SpaceBotsList.d.ts delete mode 100644 lib/Interface/Lists/SpaceBotsList.js delete mode 100644 lib/Interface/Lists/TopCord.d.ts delete mode 100644 lib/Interface/Lists/TopCord.js delete mode 100644 lib/Interface/Lists/TopGG.d.ts delete mode 100644 lib/Interface/Lists/TopGG.js delete mode 100644 lib/Interface/Lists/VoidBots.d.ts delete mode 100644 lib/Interface/Lists/VoidBots.js delete mode 100644 lib/Interface/Lists/WonderBotList.d.ts delete mode 100644 lib/Interface/Lists/WonderBotList.js delete mode 100644 lib/Interface/Lists/YABL.d.ts delete mode 100644 lib/Interface/Lists/YABL.js delete mode 100644 lib/Interface/Poster.d.ts delete mode 100644 lib/Interface/Poster.js delete mode 100644 lib/Interface/Service.d.ts delete mode 100644 lib/Interface/Service.js delete mode 100644 lib/Utils/Constants.d.ts delete mode 100644 lib/Utils/Constants.js delete mode 100644 lib/Utils/DBotsError.d.ts delete mode 100644 lib/Utils/DBotsError.js delete mode 100644 lib/Utils/EnsurePromise.d.ts delete mode 100644 lib/Utils/EnsurePromise.js delete mode 100644 lib/Utils/FormatRequest.d.ts delete mode 100644 lib/Utils/FormatRequest.js delete mode 100644 lib/Utils/Util.d.ts delete mode 100644 lib/Utils/Util.js delete mode 100644 lib/index.d.ts delete mode 100644 lib/index.js diff --git a/lib/Interface/ClientFiller.d.ts b/lib/Interface/ClientFiller.d.ts deleted file mode 100644 index 2a6f7d37..00000000 --- a/lib/Interface/ClientFiller.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Library, Shard } from '../Utils/Constants'; -import { AnyObject } from '../Utils/Util'; -/** - * A class that gets certain values from a client. - * @private - */ -export declare class ClientFiller { - /** The client that will be used for the filler. */ - client: AnyObject; - /** - * @param client The client that will be used - */ - constructor(client: object); - /** Gets the amount of users the bot has cached. */ - get userCount(): number | undefined; - /** Gets the amount of servers the bot has cached. */ - get serverCount(): number | undefined; - /** Gets the amount of voice connectinos the bot is using. */ - get voiceConnections(): number | undefined; - /** Gets the client ID (technically the user ID) of the bot. */ - get clientID(): string | undefined; - /** Gets the shard of the bot. */ - get shard(): Shard | undefined; -} -/** - * Gets a client filler from a library. - * @param libraryName The name of the library to get - * @param client The client that the library made - */ -export declare function getClientFiller(libraryName: Library, client: object): ClientFiller; diff --git a/lib/Interface/ClientFiller.js b/lib/Interface/ClientFiller.js deleted file mode 100644 index c4b40b7b..00000000 --- a/lib/Interface/ClientFiller.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getClientFiller = exports.ClientFiller = void 0; -var DBotsError_1 = require("../Utils/DBotsError"); -/** - * A class that gets certain values from a client. - * @private - */ -var ClientFiller = /** @class */ (function () { - /** - * @param client The client that will be used - */ - function ClientFiller(client) { - if (!client || typeof client != 'object') - throw new DBotsError_1.errors.Error('UNKNOWN_CLIENT'); - this.client = client; - } - Object.defineProperty(ClientFiller.prototype, "userCount", { - /** Gets the amount of users the bot has cached. */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "serverCount", { - /** Gets the amount of servers the bot has cached. */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "voiceConnections", { - /** Gets the amount of voice connectinos the bot is using. */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "clientID", { - /** Gets the client ID (technically the user ID) of the bot. */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "shard", { - /** Gets the shard of the bot. */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - return ClientFiller; -}()); -exports.ClientFiller = ClientFiller; -/** - * Gets a client filler from a library. - * @param libraryName The name of the library to get - * @param client The client that the library made - */ -function getClientFiller(libraryName, client) { - if (!client) - throw new Error('No client was provided!'); - switch (libraryName) { - case 'discordie': { - return new (require('./Clients/Discordie') - .default)(client); - } - case 'discord.io': { - return new (require('./Clients/DiscordIO') - .default)(client); - } - case 'discord.js': { - return new (require('./Clients/DiscordJS') - .default)(client); - } - case 'eris': { - return new (require('./Clients/Eris').default)(client); - } - case 'paracord': { - return new (require('./Clients/Paracord').default)(client); - } - default: { - throw new Error("Unknown client '" + libraryName + "'"); - } - } -} -exports.getClientFiller = getClientFiller; diff --git a/lib/Interface/Clients/DiscordIO.d.ts b/lib/Interface/Clients/DiscordIO.d.ts deleted file mode 100644 index aad2c182..00000000 --- a/lib/Interface/Clients/DiscordIO.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Shard } from '../../Utils/Constants'; -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for discord.io clients. - * @private - */ -export default class DiscordIO extends ClientFiller { - get userCount(): number | undefined; - get serverCount(): number | undefined; - get voiceConnections(): number | undefined; - get clientID(): string | undefined; - get shard(): Shard | undefined; -} diff --git a/lib/Interface/Clients/DiscordIO.js b/lib/Interface/Clients/DiscordIO.js deleted file mode 100644 index 3ee3a2f2..00000000 --- a/lib/Interface/Clients/DiscordIO.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for discord.io clients. - * @private - */ -var DiscordIO = /** @class */ (function (_super) { - __extends(DiscordIO, _super); - function DiscordIO() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordIO.prototype, "userCount", { - get: function () { - if (!this.client.users) - return undefined; - return Object.keys(this.client.users).length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "serverCount", { - get: function () { - if (!this.client.servers) - return undefined; - return Object.keys(this.client.servers).length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "voiceConnections", { - get: function () { - if (!this.client._vChannels) - return undefined; - return Object.keys(this.client._vChannels).length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "clientID", { - get: function () { - return this.client.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "shard", { - get: function () { - return this.client._shard - ? { - id: this.client._shard[0], - count: this.client._shard[1] - } - : undefined; - }, - enumerable: false, - configurable: true - }); - return DiscordIO; -}(ClientFiller_1.ClientFiller)); -exports.default = DiscordIO; diff --git a/lib/Interface/Clients/DiscordJS.d.ts b/lib/Interface/Clients/DiscordJS.d.ts deleted file mode 100644 index 140f52ca..00000000 --- a/lib/Interface/Clients/DiscordJS.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Shard } from '../../Utils/Constants'; -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for discord.js clients. - * @private - */ -export default class DiscordJS extends ClientFiller { - get userCount(): number; - get serverCount(): number; - get voiceConnections(): number; - get clientID(): string | undefined; - get shard(): Shard | undefined; -} diff --git a/lib/Interface/Clients/DiscordJS.js b/lib/Interface/Clients/DiscordJS.js deleted file mode 100644 index f0792003..00000000 --- a/lib/Interface/Clients/DiscordJS.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for discord.js clients. - * @private - */ -var DiscordJS = /** @class */ (function (_super) { - __extends(DiscordJS, _super); - function DiscordJS() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordJS.prototype, "userCount", { - get: function () { - var _a, _b, _c, _d, _e; - if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') - return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.reduce(function (count, guild) { return count + guild.memberCount; }, 0); - else - return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.reduce(function (count, guild) { return count + guild.memberCount; }, 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "serverCount", { - get: function () { - var _a, _b, _c, _d, _e; - if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') - return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.size; - else - return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "voiceConnections", { - get: function () { - var _a, _b; - if (this.client.voice) - return ((_a = this.client.voice.broadcasts) === null || _a === void 0 ? void 0 : _a.length) || 0; - else - return (_b = this.client.broadcasts) === null || _b === void 0 ? void 0 : _b.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "shard", { - get: function () { - return this.client.shard - ? { - id: this.client.shard.id, - count: this.client.shard.count - } - : undefined; - }, - enumerable: false, - configurable: true - }); - return DiscordJS; -}(ClientFiller_1.ClientFiller)); -exports.default = DiscordJS; diff --git a/lib/Interface/Clients/Discordie.d.ts b/lib/Interface/Clients/Discordie.d.ts deleted file mode 100644 index 41bb3741..00000000 --- a/lib/Interface/Clients/Discordie.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Shard } from '../../Utils/Constants'; -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for discordie clients. - * @private - */ -export default class Discordie extends ClientFiller { - get userCount(): number; - get serverCount(): number; - get voiceConnections(): number; - get clientID(): string | undefined; - get shard(): Shard | undefined; -} diff --git a/lib/Interface/Clients/Discordie.js b/lib/Interface/Clients/Discordie.js deleted file mode 100644 index 0b5c9fea..00000000 --- a/lib/Interface/Clients/Discordie.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for discordie clients. - * @private - */ -var Discordie = /** @class */ (function (_super) { - __extends(Discordie, _super); - function Discordie() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Discordie.prototype, "userCount", { - get: function () { - var _a; - return (_a = this.client.Guilds) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "serverCount", { - get: function () { - var _a; - return (_a = this.client.Users) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "voiceConnections", { - get: function () { - var _a; - return (_a = this.client.VoiceConnections) === null || _a === void 0 ? void 0 : _a.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.User) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "shard", { - get: function () { - var _a, _b; - return ((_a = this.client.options) === null || _a === void 0 ? void 0 : _a.shardId) && ((_b = this.client.options) === null || _b === void 0 ? void 0 : _b.shardCount) - ? { - id: this.client.options.shardId, - count: this.client.options.shardCount - } - : undefined; - }, - enumerable: false, - configurable: true - }); - return Discordie; -}(ClientFiller_1.ClientFiller)); -exports.default = Discordie; diff --git a/lib/Interface/Clients/Eris.d.ts b/lib/Interface/Clients/Eris.d.ts deleted file mode 100644 index 3d5e3309..00000000 --- a/lib/Interface/Clients/Eris.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for Eris clients. - * @private - */ -export default class Eris extends ClientFiller { - get userCount(): number; - get serverCount(): number; - get voiceConnections(): number; - get clientID(): string | undefined; - /** - * This client does not natively support sharding. - * @private - */ - get shard(): undefined; -} diff --git a/lib/Interface/Clients/Eris.js b/lib/Interface/Clients/Eris.js deleted file mode 100644 index d3f67608..00000000 --- a/lib/Interface/Clients/Eris.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for Eris clients. - * @private - */ -var Eris = /** @class */ (function (_super) { - __extends(Eris, _super); - function Eris() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Eris.prototype, "userCount", { - get: function () { - var _a; - return (_a = this.client.users) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "serverCount", { - get: function () { - var _a; - return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "voiceConnections", { - get: function () { - var _a, _b, _c, _d; - if (((_b = (_a = this.client.voiceConnections) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === - 'VoiceConnectionManager') - return (_c = this.client.voiceConnections) === null || _c === void 0 ? void 0 : _c.size; - else - return Object.keys(((_d = this.client.voiceConnections) === null || _d === void 0 ? void 0 : _d.pendingGuilds) || {}) - .length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "shard", { - /** - * This client does not natively support sharding. - * @private - */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - return Eris; -}(ClientFiller_1.ClientFiller)); -exports.default = Eris; diff --git a/lib/Interface/Clients/Paracord.d.ts b/lib/Interface/Clients/Paracord.d.ts deleted file mode 100644 index 6a73fe51..00000000 --- a/lib/Interface/Clients/Paracord.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for Paracord clients. - * @private - */ -export default class Paracord extends ClientFiller { - get userCount(): number; - get serverCount(): number; - /** - * This client does not yet support voice connections. - * @private - */ - get voiceConnections(): number; - get clientID(): string | undefined; - /** - * This client handles sharding in a way that is not supported by dbots in its current structure. - * @private - */ - get shard(): undefined; -} diff --git a/lib/Interface/Clients/Paracord.js b/lib/Interface/Clients/Paracord.js deleted file mode 100644 index 865b3c9f..00000000 --- a/lib/Interface/Clients/Paracord.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for Paracord clients. - * @private - */ -var Paracord = /** @class */ (function (_super) { - __extends(Paracord, _super); - function Paracord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Paracord.prototype, "userCount", { - get: function () { - var _a; - return (_a = this.client.users) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "serverCount", { - get: function () { - var _a; - return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "voiceConnections", { - /** - * This client does not yet support voice connections. - * @private - */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "shard", { - /** - * This client handles sharding in a way that is not supported by dbots in its current structure. - * @private - */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - return Paracord; -}(ClientFiller_1.ClientFiller)); -exports.default = Paracord; diff --git a/lib/Interface/Lists/Arcane.d.ts b/lib/Interface/Lists/Arcane.d.ts deleted file mode 100644 index d5fee1df..00000000 --- a/lib/Interface/Lists/Arcane.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Arcane Bot Center service. - * @see https://arcane-center.xyz/documentation - */ -export default class Arcane extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; -} diff --git a/lib/Interface/Lists/Arcane.js b/lib/Interface/Lists/Arcane.js deleted file mode 100644 index 3b8de6cb..00000000 --- a/lib/Interface/Lists/Arcane.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Arcane Bot Center service. - * @see https://arcane-center.xyz/documentation - */ -var Arcane = /** @class */ (function (_super) { - __extends(Arcane, _super); - function Arcane() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Arcane, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['arcane', 'arcane-center.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://arcane-center.xyz/src/images/favicons/favicon.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "serviceName", { - /** Service's name. */ - get: function () { - return 'Arcane Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://arcane-center.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://arcane-center.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - Arcane.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, userCount = options.userCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - member_count: Util_1.Util.resolveCount(userCount), - shard_count: shard.count - } - : { - server_count: Util_1.Util.resolveCount(serverCount), - member_count: Util_1.Util.resolveCount(userCount) - } - }); - }; - return Arcane; -}(Service_1.Service)); -exports.default = Arcane; diff --git a/lib/Interface/Lists/AstroBotList.d.ts b/lib/Interface/Lists/AstroBotList.d.ts deleted file mode 100644 index e60c0ea1..00000000 --- a/lib/Interface/Lists/AstroBotList.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Astro Bot List service. - * @see https://botlists.com/api/docs - */ -export default class AstroBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets the stats of this bot. */ - getOwnStats(): Promise>; -} diff --git a/lib/Interface/Lists/AstroBotList.js b/lib/Interface/Lists/AstroBotList.js deleted file mode 100644 index 93b4a3d9..00000000 --- a/lib/Interface/Lists/AstroBotList.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Astro Bot List service. - * @see https://botlists.com/api/docs - */ -var AstroBotList = /** @class */ (function (_super) { - __extends(AstroBotList, _super); - function AstroBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(AstroBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['astrobotlist', 'botlists.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://cdn.bot-list.xyz/7364djcas.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Astro Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botlists.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://botlists.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - AstroBotList.post = function (options) { - var token = options.token, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: '/bot', - headers: { token: token }, - data: { - guild_count: Util_1.Util.resolveCount(serverCount) - } - }); - }; - /** Gets the stats of this bot. */ - AstroBotList.prototype.getOwnStats = function () { - return this._request({ - url: '/bot', - headers: { token: this.token } - }, { - requiresToken: true - }); - }; - return AstroBotList; -}(Service_1.Service)); -exports.default = AstroBotList; diff --git a/lib/Interface/Lists/BladeBotList.d.ts b/lib/Interface/Lists/BladeBotList.d.ts deleted file mode 100644 index 83de9872..00000000 --- a/lib/Interface/Lists/BladeBotList.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the BladeBotList service. - * @see https://docs.bladebotlist.xyz/api/introduction.html - */ -export default class BladeBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Checks whether a user has given a vote to the bot - * @param botId The bot's ID - * @param userID The user's ID - */ - userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/BladeBotList.js b/lib/Interface/Lists/BladeBotList.js deleted file mode 100644 index 9031bdf8..00000000 --- a/lib/Interface/Lists/BladeBotList.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the BladeBotList service. - * @see https://docs.bladebotlist.xyz/api/introduction.html - */ -var BladeBotList = /** @class */ (function (_super) { - __extends(BladeBotList, _super); - function BladeBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BladeBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['bladebotlist', 'bladebotlist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://bladebotlist.xyz/img/logo.svg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'BladeBotList'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://bladebotlist.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://bladebotlist.xyz/api/'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - BladeBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats/", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: shard.count - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - BladeBotList.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Checks whether a user has given a vote to the bot - * @param botId The bot's ID - * @param userID The user's ID - */ - BladeBotList.prototype.userVoted = function (botId, userID) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(botId) + "/votes/" + Util_1.Util.resolveID(userID) - }); - }; - return BladeBotList; -}(Service_1.Service)); -exports.default = BladeBotList; diff --git a/lib/Interface/Lists/Blist.d.ts b/lib/Interface/Lists/Blist.d.ts deleted file mode 100644 index 4a4e0035..00000000 --- a/lib/Interface/Lists/Blist.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Blist service. - * @see https://blist.xyz/docs/ - */ -export default class Blist extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the user's bots listed on this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the user's servers listed on this service. - * @param id The user's ID - */ - getUserServers(id: IDResolvable): Promise>; - /** - * Gets the server listed on this service. - * @param id The server's ID - */ - getServer(id: IDResolvable): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - getBotReviews(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query: Query): string; -} diff --git a/lib/Interface/Lists/Blist.js b/lib/Interface/Lists/Blist.js deleted file mode 100644 index 971ccf82..00000000 --- a/lib/Interface/Lists/Blist.js +++ /dev/null @@ -1,152 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Blist service. - * @see https://blist.xyz/docs/ - */ -var Blist = /** @class */ (function (_super) { - __extends(Blist, _super); - function Blist() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Blist, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['blist', 'blist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://blist.xyz/main_site/staticfiles/main/assets/blist.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "serviceName", { - /** Service's name. */ - get: function () { - return 'Blist'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://blist.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://blist.xyz/api/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - Blist.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'patch', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats/", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: shard.count - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - Blist.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user's bots listed on this service. - * @param id The user's ID - */ - Blist.prototype.getUserBots = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/bots" }); - }; - /** - * Gets the user's servers listed on this service. - * @param id The user's ID - */ - Blist.prototype.getUserServers = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/servers" }); - }; - /** - * Gets the server listed on this service. - * @param id The server's ID - */ - Blist.prototype.getServer = function (id) { - return this._request({ url: "/server/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - Blist.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - Blist.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - Blist.prototype.getBotReviews = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) + "/reviews" }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - Blist.prototype.getWidgetURL = function (id, query) { - var actualQuery = Object.assign({ type: 'normal' }, query); - return this._appendQuery("/bot/" + Util_1.Util.resolveID(id) + "/widget", actualQuery); - }; - return Blist; -}(Service_1.Service)); -exports.default = Blist; diff --git a/lib/Interface/Lists/BotListSpace.d.ts b/lib/Interface/Lists/BotListSpace.d.ts deleted file mode 100644 index 966d8d48..00000000 --- a/lib/Interface/Lists/BotListSpace.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { CountResolvable, IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the botlist.space service. - * @see https://docs.botlist.space/ - */ -export default class BotListSpace extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets the statistics of this service. */ - getStatistics(): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; - /** Gets the bot listed on this service. */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Gets the uptime of a bot listed on this service. - * @param id The bot's ID - */ - getBotUptime(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param style The style of the widget, cannot be zero - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, style?: CountResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/BotListSpace.js b/lib/Interface/Lists/BotListSpace.js deleted file mode 100644 index 54928077..00000000 --- a/lib/Interface/Lists/BotListSpace.js +++ /dev/null @@ -1,141 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the botlist.space service. - * @see https://docs.botlist.space/ - */ -var BotListSpace = /** @class */ (function (_super) { - __extends(BotListSpace, _super); - function BotListSpace() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotListSpace, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botlistspace', 'botlist.space']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://botlist.space/img/android-chrome-512x512.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "serviceName", { - /** Service's name. */ - get: function () { - return 'botlist.space'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botlist.space'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.botlist.space/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotListSpace.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** Gets the statistics of this service. */ - BotListSpace.prototype.getStatistics = function () { - return this._request({ url: '/statistics' }); - }; - /** Gets a list of bots on this service. */ - BotListSpace.prototype.getBots = function () { - return this._request({ url: '/bots' }); - }; - /** Gets the bot listed on this service. */ - BotListSpace.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - BotListSpace.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/upvotes", - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the uptime of a bot listed on this service. - * @param id The bot's ID - */ - BotListSpace.prototype.getBotUptime = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) + "/uptime" }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - BotListSpace.prototype.getUser = function (id) { - return this._request({ url: "/users/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - BotListSpace.prototype.getUserBots = function (id) { - return this._request({ url: "/users/" + Util_1.Util.resolveID(id) + "/bots" }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param style The style of the widget, cannot be zero - * @param query The query string that will be used in the request - */ - BotListSpace.prototype.getWidgetURL = function (id, style, query) { - if (style === void 0) { style = 1; } - if (query === void 0) { query = {}; } - return this._appendQuery("https://api.botlist.space/widget/" + Util_1.Util.resolveID(id) + "/" + Util_1.Util.resolveCount(style), query, false); - }; - return BotListSpace; -}(Service_1.Service)); -exports.default = BotListSpace; diff --git a/lib/Interface/Lists/BotsDataBase.d.ts b/lib/Interface/Lists/BotsDataBase.d.ts deleted file mode 100644 index e1888002..00000000 --- a/lib/Interface/Lists/BotsDataBase.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the BotsDataBase service. - * @see https://docs.botsdatabase.com/ - */ -export default class BotsDataBase extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/BotsDataBase.js b/lib/Interface/Lists/BotsDataBase.js deleted file mode 100644 index e4d08267..00000000 --- a/lib/Interface/Lists/BotsDataBase.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the BotsDataBase service. - * @see https://docs.botsdatabase.com/ - */ -var BotsDataBase = /** @class */ (function (_super) { - __extends(BotsDataBase, _super); - function BotsDataBase() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotsDataBase, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botsdatabase', 'botsdatabase.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://botsdatabase.com/images/icons/favicon-96x96.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "serviceName", { - /** Service's name. */ - get: function () { - return 'BotsDataBase'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botsdatabase.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.botsdatabase.com/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotsDataBase.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { - Authorization: token, - 'Content-Type': 'application/json' - }, - data: { servers: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - BotsDataBase.prototype.getUser = function (id) { - return this._request({ url: "/users/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - BotsDataBase.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - BotsDataBase.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - return BotsDataBase; -}(Service_1.Service)); -exports.default = BotsDataBase; diff --git a/lib/Interface/Lists/BotsForDiscord.d.ts b/lib/Interface/Lists/BotsForDiscord.d.ts deleted file mode 100644 index fdd7dac7..00000000 --- a/lib/Interface/Lists/BotsForDiscord.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Bots For Discord service. - * @see https://docs.botsfordiscord.com/ - */ -export default class BotsForDiscord extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/BotsForDiscord.js b/lib/Interface/Lists/BotsForDiscord.js deleted file mode 100644 index 8ffe2f6a..00000000 --- a/lib/Interface/Lists/BotsForDiscord.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Bots For Discord service. - * @see https://docs.botsfordiscord.com/ - */ -var BotsForDiscord = /** @class */ (function (_super) { - __extends(BotsForDiscord, _super); - function BotsForDiscord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotsForDiscord, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botsfordiscord', 'botsfordiscord.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://botsfordiscord.com/img/manifest/icon-512x512.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "serviceName", { - /** Service's name. */ - get: function () { - return 'Bots For Discord'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botsfordiscord.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://botsfordiscord.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotsForDiscord.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - BotsForDiscord.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - BotsForDiscord.prototype.getBotVotes = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) + "/votes" }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - BotsForDiscord.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - BotsForDiscord.prototype.getUserBots = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/bots" }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - BotsForDiscord.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}); - }; - return BotsForDiscord; -}(Service_1.Service)); -exports.default = BotsForDiscord; diff --git a/lib/Interface/Lists/BotsOnDiscord.d.ts b/lib/Interface/Lists/BotsOnDiscord.d.ts deleted file mode 100644 index 8bc51e48..00000000 --- a/lib/Interface/Lists/BotsOnDiscord.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Bots On Discord service. - * @see https://bots.ondiscord.xyz/info/api - */ -export default class BotsOnDiscord extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Checks whether or not a user has reviewed a bot. - * @param id The bot's ID - * @param userId The user's ID - */ - checkReview(id: IDResolvable, userId: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/BotsOnDiscord.js b/lib/Interface/Lists/BotsOnDiscord.js deleted file mode 100644 index c8076e43..00000000 --- a/lib/Interface/Lists/BotsOnDiscord.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Bots On Discord service. - * @see https://bots.ondiscord.xyz/info/api - */ -var BotsOnDiscord = /** @class */ (function (_super) { - __extends(BotsOnDiscord, _super); - function BotsOnDiscord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotsOnDiscord, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botsondiscord', 'bots.ondiscord.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://bots.ondiscord.xyz/favicon/android-chrome-256x256.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "serviceName", { - /** Service's name. */ - get: function () { - return 'Bots On Discord'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://bots.ondiscord.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://bots.ondiscord.xyz/bot-api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotsOnDiscord.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/guilds", - headers: { Authorization: token }, - data: { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Checks whether or not a user has reviewed a bot. - * @param id The bot's ID - * @param userId The user's ID - */ - BotsOnDiscord.prototype.checkReview = function (id, userId) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/review", - headers: { Authorization: this.token }, - params: { owner: Util_1.Util.resolveID(userId) } - }, { - requiresToken: true - }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - BotsOnDiscord.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("https://bots.ondiscord.xyz/bots/" + Util_1.Util.resolveID(id) + "/embed", query || {}, false); - }; - return BotsOnDiscord; -}(Service_1.Service)); -exports.default = BotsOnDiscord; diff --git a/lib/Interface/Lists/Carbon.d.ts b/lib/Interface/Lists/Carbon.d.ts deleted file mode 100644 index bb6a57a8..00000000 --- a/lib/Interface/Lists/Carbon.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Carbonitex service. - */ -export default class Carbon extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; -} diff --git a/lib/Interface/Lists/Carbon.js b/lib/Interface/Lists/Carbon.js deleted file mode 100644 index 871eb124..00000000 --- a/lib/Interface/Lists/Carbon.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Carbonitex service. - */ -var Carbon = /** @class */ (function (_super) { - __extends(Carbon, _super); - function Carbon() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Carbon, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['carbonitex', 'carbonitex.net', 'carbon']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/7N8ywwr.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "serviceName", { - /** Service's name. */ - get: function () { - return 'Carbonitex'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://www.carbonitex.net/Discord/bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://www.carbonitex.net/discord'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - Carbon.post = function (options) { - var token = options.token, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: '/data/botdata.php', - data: { key: token, servercount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** Gets a list of bots on this service. */ - Carbon.prototype.getBots = function () { - return this._request({ url: '/api/listedbots' }); - }; - return Carbon; -}(Service_1.Service)); -exports.default = Carbon; diff --git a/lib/Interface/Lists/DBots.d.ts b/lib/Interface/Lists/DBots.d.ts deleted file mode 100644 index 12cdb824..00000000 --- a/lib/Interface/Lists/DBots.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the DBots service. - * @see https://docs.dbots.co/ - */ -export default class DBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot's audit logs. - * @param id The bot's ID - */ - getAudit(id: IDResolvable): Promise>; - /** - * Regenerates the bot API token. - * @param id The bot's ID - */ - regenToken(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DBots.js b/lib/Interface/Lists/DBots.js deleted file mode 100644 index fda8b55b..00000000 --- a/lib/Interface/Lists/DBots.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the DBots service. - * @see https://docs.dbots.co/ - */ -var DBots = /** @class */ (function (_super) { - __extends(DBots, _super); - function DBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['dbots', 'dbots.co']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://gblobscdn.gitbook.com/spaces%2F-MO490c2KMEgwyXnbtbV%2Favatar-1607528014691.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'DBots.co'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://dbots.co/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://dbots.co/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot's audit logs. - * @param id The bot's ID - */ - DBots.prototype.getAudit = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/log", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Regenerates the bot API token. - * @param id The bot's ID - */ - DBots.prototype.regenToken = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/keys/regen", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - return DBots; -}(Service_1.Service)); -exports.default = DBots; diff --git a/lib/Interface/Lists/DiscordAppsDev.d.ts b/lib/Interface/Lists/DiscordAppsDev.d.ts deleted file mode 100644 index aa02ba12..00000000 --- a/lib/Interface/Lists/DiscordAppsDev.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { AnyObject, IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Apps service. - * @see https://discordapps.dev/en-GB/posts/docs/api-v2/ - */ -export default class DiscordAppsDev extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; - /** Gets a list of applications on this service. */ - getApps(): Promise>; - /** Gets a list of RPC applications on this service. */ - getRPCApps(): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Updates the bot with the data provided. - * @param id The bot's ID - * @param data The data being posted - */ - updateBot(id: IDResolvable, data: AnyObject): Promise>; -} diff --git a/lib/Interface/Lists/DiscordAppsDev.js b/lib/Interface/Lists/DiscordAppsDev.js deleted file mode 100644 index c499051f..00000000 --- a/lib/Interface/Lists/DiscordAppsDev.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Apps service. - * @see https://discordapps.dev/en-GB/posts/docs/api-v2/ - */ -var DiscordAppsDev = /** @class */ (function (_super) { - __extends(DiscordAppsDev, _super); - function DiscordAppsDev() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordAppsDev, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordappsdev', 'discordapps.dev']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://api.discordapps.dev/img/logo/logo128.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Apps'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordapps.dev'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordapps.dev/api/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DiscordAppsDev.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { bot: { count: Util_1.Util.resolveCount(serverCount) } } - }); - }; - /** Gets a list of bots on this service. */ - DiscordAppsDev.prototype.getBots = function () { - return this._request({ url: '/bots' }); - }; - /** Gets a list of applications on this service. */ - DiscordAppsDev.prototype.getApps = function () { - return this._request({ url: '/apps' }); - }; - /** Gets a list of RPC applications on this service. */ - DiscordAppsDev.prototype.getRPCApps = function () { - return this._request({ url: '/rpc' }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordAppsDev.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Updates the bot with the data provided. - * @param id The bot's ID - * @param data The data being posted - */ - DiscordAppsDev.prototype.updateBot = function (id, data) { - return this._request({ - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token }, - data: data - }, { - requiresToken: true - }); - }; - return DiscordAppsDev; -}(Service_1.Service)); -exports.default = DiscordAppsDev; diff --git a/lib/Interface/Lists/DiscordBoats.d.ts b/lib/Interface/Lists/DiscordBoats.d.ts deleted file mode 100644 index d3ef906d..00000000 --- a/lib/Interface/Lists/DiscordBoats.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Discord Boats service. - * @see https://discord.boats/api/docs - */ -export default class DiscordBoats extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - userVoted(id: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/DiscordBoats.js b/lib/Interface/Lists/DiscordBoats.js deleted file mode 100644 index 46b101d4..00000000 --- a/lib/Interface/Lists/DiscordBoats.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Boats service. - * @see https://discord.boats/api/docs - */ -var DiscordBoats = /** @class */ (function (_super) { - __extends(DiscordBoats, _super); - function DiscordBoats() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBoats, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordboats', 'discord.boats']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discord.boats/android-icon-192x192.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Boats'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discord.boats'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discord.boats/api/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DiscordBoats.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordBoats.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - DiscordBoats.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - DiscordBoats.prototype.userVoted = function (id, userID) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/voted", - params: { id: Util_1.Util.resolveID(userID) } - }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - DiscordBoats.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("/widget/" + Util_1.Util.resolveID(id), query || {}); - }; - return DiscordBoats; -}(Service_1.Service)); -exports.default = DiscordBoats; diff --git a/lib/Interface/Lists/DiscordBotDirectory.d.ts b/lib/Interface/Lists/DiscordBotDirectory.d.ts deleted file mode 100644 index 4c18e86c..00000000 --- a/lib/Interface/Lists/DiscordBotDirectory.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Bot Directory service. - * @see https://botblock.org/lists/discordbotdirectory.net - */ -export default class DiscordBotDirectory extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * The docs for this endopoint exist only in a Discord message. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - */ - getWidgetURL(id: IDResolvable): string; -} diff --git a/lib/Interface/Lists/DiscordBotDirectory.js b/lib/Interface/Lists/DiscordBotDirectory.js deleted file mode 100644 index 85f0cac2..00000000 --- a/lib/Interface/Lists/DiscordBotDirectory.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Bot Directory service. - * @see https://botblock.org/lists/discordbotdirectory.net - */ -var DiscordBotDirectory = /** @class */ (function (_super) { - __extends(DiscordBotDirectory, _super); - function DiscordBotDirectory() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBotDirectory, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotdirectory', 'discordbotdirectory.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordbotdirectory.net/assets/img/logo.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Bot Directory'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordbotdirectory.net'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discordbotdirectory.net/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * The docs for this endopoint exist only in a Discord message. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DiscordBotDirectory.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/auth/stats/" + Util_1.Util.resolveID(clientID), - headers: { authorization: token, 'Content-Type': 'application/json' }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - */ - DiscordBotDirectory.prototype.getWidgetURL = function (id) { - return this._appendQuery("/embed/" + Util_1.Util.resolveID(id), {}); - }; - return DiscordBotDirectory; -}(Service_1.Service)); -exports.default = DiscordBotDirectory; diff --git a/lib/Interface/Lists/DiscordBotList.d.ts b/lib/Interface/Lists/DiscordBotList.d.ts deleted file mode 100644 index ad1ce868..00000000 --- a/lib/Interface/Lists/DiscordBotList.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Discord Bot List service. - * @see https://discordbotlist.com/api-docs - */ -export default class DiscordBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; -} diff --git a/lib/Interface/Lists/DiscordBotList.js b/lib/Interface/Lists/DiscordBotList.js deleted file mode 100644 index b3b75481..00000000 --- a/lib/Interface/Lists/DiscordBotList.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Bot List service. - * @see https://discordbotlist.com/api-docs - */ -var DiscordBotList = /** @class */ (function (_super) { - __extends(DiscordBotList, _super); - function DiscordBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotlist', 'discordbotlist.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordbotlist.com/android-icon-192x192.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordbotlist.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discordbotlist.com/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard, userCount = options.userCount, voiceConnections = options.voiceConnections; - var data = { guilds: Util_1.Util.resolveCount(serverCount) }; - if (shard) - data.shard_id = shard.id; - if (userCount) - data.users = Util_1.Util.resolveCount(userCount); - if (voiceConnections) - data.voice_connections = Util_1.Util.resolveCount(voiceConnections); - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: "Bot " + token }, - data: data - }); - }; - return DiscordBotList; -}(Service_1.Service)); -exports.default = DiscordBotList; diff --git a/lib/Interface/Lists/DiscordBotsCo.d.ts b/lib/Interface/Lists/DiscordBotsCo.d.ts deleted file mode 100644 index cc362812..00000000 --- a/lib/Interface/Lists/DiscordBotsCo.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the DiscordBots.co service. - * @see https://discordbots.co/api-information - */ -export default class DiscordBotsCo extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordBotsCo.js b/lib/Interface/Lists/DiscordBotsCo.js deleted file mode 100644 index d56199de..00000000 --- a/lib/Interface/Lists/DiscordBotsCo.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the DiscordBots.co service. - * @see https://discordbots.co/api-information - */ -var DiscordBotsCo = /** @class */ (function (_super) { - __extends(DiscordBotsCo, _super); - function DiscordBotsCo() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBotsCo, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotsco', 'discordbots.co']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://cdn.discordapp.com/avatars/688927563409522694/17cfd572fd3e2d3285534c12e0f58422.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "serviceName", { - /** Service's name. */ - get: function () { - return 'DiscordBots.co'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordbots.co'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordbots.co/v1/public'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordBotsCo.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { - Authorization: token, - 'Content-Type': 'application/json' - }, - data: shard - ? { - serverCount: Util_1.Util.resolveCount(serverCount), - shardCount: shard.count - } - : { serverCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordBotsCo.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return DiscordBotsCo; -}(Service_1.Service)); -exports.default = DiscordBotsCo; diff --git a/lib/Interface/Lists/DiscordBotsGG.d.ts b/lib/Interface/Lists/DiscordBotsGG.d.ts deleted file mode 100644 index afc66bc1..00000000 --- a/lib/Interface/Lists/DiscordBotsGG.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** The user agent used options for the DiscordBotsGG service */ -export interface DiscordBotsGGUserAgent { - /** The bot's library */ - library: string; - /** The bot ID for the user agent */ - clientID: string; -} -/** - * Represents the Discord Bots service. - * @see https://discord.bots.gg/docs - */ -export default class DiscordBotsGG extends Service { - /** The user agent options for this service */ - private agent; - /** - * @param token The token/key for the service - * @param userAgent The user agent options of the service. Providing this is highly recommended. - */ - constructor(token: string, userAgent?: DiscordBotsGGUserAgent); - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Creates a compliant user agent to use for any API calls to Discord Bots. - * @param botID The ID of the bot that the agent will be identified with - * @param library The library the agent is using - */ - static userAgent(botID: IDResolvable, library?: string): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - * @param sanitized Whether to sanitize descriptions - */ - getBot(id: IDResolvable, sanitized?: boolean): Promise>; - /** - * Gets a list of bots on this service. - * @param query The query string that will be used in the request - */ - getBots(query?: Query): Promise>; -} diff --git a/lib/Interface/Lists/DiscordBotsGG.js b/lib/Interface/Lists/DiscordBotsGG.js deleted file mode 100644 index f32a17f9..00000000 --- a/lib/Interface/Lists/DiscordBotsGG.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -var Constants_1 = require("../../Utils/Constants"); -/** - * Represents the Discord Bots service. - * @see https://discord.bots.gg/docs - */ -var DiscordBotsGG = /** @class */ (function (_super) { - __extends(DiscordBotsGG, _super); - // - /** - * @param token The token/key for the service - * @param userAgent The user agent options of the service. Providing this is highly recommended. - */ - function DiscordBotsGG(token, userAgent) { - var _this = _super.call(this, token) || this; - _this.agent = { - library: (userAgent === null || userAgent === void 0 ? void 0 : userAgent.library) || 'unknown', - clientID: (userAgent === null || userAgent === void 0 ? void 0 : userAgent.clientID) || '000000000000000' - }; - return _this; - } - Object.defineProperty(DiscordBotsGG, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotsgg', 'discord.bots.gg']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://pbs.twimg.com/profile_images/1071582837030060032/kKV-I01n_400x400.jpg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discord.bots.gg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discord.bots.gg/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Creates a compliant user agent to use for any API calls to Discord Bots. - * @param botID The ID of the bot that the agent will be identified with - * @param library The library the agent is using - */ - DiscordBotsGG.userAgent = function (botID, library) { - if (library === void 0) { library = 'unknown'; } - return "dbots-0000/" + Constants_1.Package.version + " (" + library + "; +https://github.com/dbots-pkg/dbots.js) DBots/" + Util_1.Util.resolveID(botID); - }; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordBotsGG.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { - Authorization: token, - 'User-Agent': DiscordBotsGG.userAgent(clientID) - }, - data: shard - ? { - guildCount: Util_1.Util.resolveCount(serverCount), - shardId: shard.id, - shardCount: shard.count - } - : { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - * @param sanitized Whether to sanitize descriptions - */ - DiscordBotsGG.prototype.getBot = function (id, sanitized) { - if (sanitized === void 0) { sanitized = false; } - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id), - headers: { - Authorization: this.token, - 'User-Agent': DiscordBotsGG.userAgent(this.agent.clientID, this.agent.library) - }, - params: { sanitized: sanitized } - }, { - requiresToken: true - }); - }; - /** - * Gets a list of bots on this service. - * @param query The query string that will be used in the request - */ - DiscordBotsGG.prototype.getBots = function (query) { - return this._request({ - url: '/bots', - headers: { - Authorization: this.token, - 'User-Agent': DiscordBotsGG.userAgent(this.agent.clientID, this.agent.library) - }, - params: query - }, { - requiresToken: true - }); - }; - return DiscordBotsGG; -}(Service_1.Service)); -exports.default = DiscordBotsGG; diff --git a/lib/Interface/Lists/DiscordExtremeList.d.ts b/lib/Interface/Lists/DiscordExtremeList.d.ts deleted file mode 100644 index 633de098..00000000 --- a/lib/Interface/Lists/DiscordExtremeList.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Extreme List service. - * @see https://docs.discordextremelist.xyz/ - */ -export default class DiscordExtremeList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets the statistics of this service. */ - getStatistics(): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The bot's ID - */ - getUser(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordExtremeList.js b/lib/Interface/Lists/DiscordExtremeList.js deleted file mode 100644 index 5dcdeb1a..00000000 --- a/lib/Interface/Lists/DiscordExtremeList.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Extreme List service. - * @see https://docs.discordextremelist.xyz/ - */ -var DiscordExtremeList = /** @class */ (function (_super) { - __extends(DiscordExtremeList, _super); - function DiscordExtremeList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordExtremeList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordextremelist', 'discordextremelist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/4KjWg91.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Extreme List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordextremelist.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordextremelist.xyz/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordExtremeList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { - guildCount: Util_1.Util.resolveCount(serverCount), - shardCount: shard ? Util_1.Util.resolveCount(shard.count) : undefined - } - }); - }; - /** Gets the statistics of this service. */ - DiscordExtremeList.prototype.getStatistics = function () { - return this._request({ - url: '/stats', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordExtremeList.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the user listed on this service. - * @param id The bot's ID - */ - DiscordExtremeList.prototype.getUser = function (id) { - return this._request({ - url: "/user/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return DiscordExtremeList; -}(Service_1.Service)); -exports.default = DiscordExtremeList; diff --git a/lib/Interface/Lists/DiscordLabs.d.ts b/lib/Interface/Lists/DiscordLabs.d.ts deleted file mode 100644 index c720ad0a..00000000 --- a/lib/Interface/Lists/DiscordLabs.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Labs service. - * @see https://docs.discordlabs.org/#/api - */ -export default class DiscordLabs extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordLabs.js b/lib/Interface/Lists/DiscordLabs.js deleted file mode 100644 index a5b21dc6..00000000 --- a/lib/Interface/Lists/DiscordLabs.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Labs service. - * @see https://docs.discordlabs.org/#/api - */ -var DiscordLabs = /** @class */ (function (_super) { - __extends(DiscordLabs, _super); - function DiscordLabs() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordLabs, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordlabs', 'discordlabs.org']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://avatars2.githubusercontent.com/u/54491479?v=4'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Labs'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://bots.discordlabs.org/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://bots.discordlabs.org/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordLabs.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - data: shard - ? { - token: token, - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: shard.count - } - : { - token: token, - server_count: Util_1.Util.resolveCount(serverCount) - } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordLabs.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - return DiscordLabs; -}(Service_1.Service)); -exports.default = DiscordLabs; diff --git a/lib/Interface/Lists/DiscordListology.d.ts b/lib/Interface/Lists/DiscordListology.d.ts deleted file mode 100644 index 2e43f206..00000000 --- a/lib/Interface/Lists/DiscordListology.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the DiscordListology service. - * @see https://discordlistology.com/developer/documentation - */ -export default class DiscordListology extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - getBotStats(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - userVotedBot(id: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the guild's stats listed on this service. - * @param id The guild's ID - */ - getGuildStats(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a guild on this service. - * @param id The guild's ID - * @param userID The user's ID - */ - userVotedGuild(id: IDResolvable, userID: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordListology.js b/lib/Interface/Lists/DiscordListology.js deleted file mode 100644 index da56cd4c..00000000 --- a/lib/Interface/Lists/DiscordListology.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the DiscordListology service. - * @see https://discordlistology.com/developer/documentation - */ -var DiscordListology = /** @class */ (function (_super) { - __extends(DiscordListology, _super); - function DiscordListology() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordListology, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordlistology', 'discordlistology.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordlistology.com/idiscord.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "serviceName", { - /** Service's name. */ - get: function () { - return 'DiscordListology'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordlistology.com/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discordlistology.com/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordListology.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - servers: Util_1.Util.resolveCount(serverCount), - shards: shard.count - } - : { servers: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - DiscordListology.prototype.getBotStats = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) + "/stats" }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - DiscordListology.prototype.userVotedBot = function (id, userID) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(userID) + "/hasvoted/" + Util_1.Util.resolveID(id) - }); - }; - /** - * Gets the guild's stats listed on this service. - * @param id The guild's ID - */ - DiscordListology.prototype.getGuildStats = function (id) { - return this._request({ url: "/guilds/" + Util_1.Util.resolveID(id) + "/stats" }); - }; - /** - * Checks whether or not a user has voted for a guild on this service. - * @param id The guild's ID - * @param userID The user's ID - */ - DiscordListology.prototype.userVotedGuild = function (id, userID) { - return this._request({ - url: "/guilds/" + Util_1.Util.resolveID(userID) + "/hasvoted/" + Util_1.Util.resolveID(id) - }); - }; - return DiscordListology; -}(Service_1.Service)); -exports.default = DiscordListology; diff --git a/lib/Interface/Lists/DiscordServices.d.ts b/lib/Interface/Lists/DiscordServices.d.ts deleted file mode 100644 index c83c33b9..00000000 --- a/lib/Interface/Lists/DiscordServices.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** The options to use when posting command info for the DiscordServices service */ -export interface DiscordServicesCommandInfo { - /** The command name including the prefix */ - command: string; - /** The description for your command */ - desc: string; - /** The category of your command */ - category: string; -} -/** - * Represents the Discord Services service. - * @see https://discordservices.net/docs/api - */ -export default class DiscordServices extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Posts news to your bot page - * @param id The bot's ID - * @param title The title of the post - * @param content The content of the post - */ - postNews(id: IDResolvable, title: string, content: string): Promise>; - /** - * Posts commands info to your bot page - * @param id The bot's ID - * @param commands The command info to post - */ - postCommands(id: IDResolvable, commands: DiscordServicesCommandInfo[]): Promise>; -} diff --git a/lib/Interface/Lists/DiscordServices.js b/lib/Interface/Lists/DiscordServices.js deleted file mode 100644 index d685589a..00000000 --- a/lib/Interface/Lists/DiscordServices.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Services service. - * @see https://discordservices.net/docs/api - */ -var DiscordServices = /** @class */ (function (_super) { - __extends(DiscordServices, _super); - function DiscordServices() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordServices, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordservices', 'discordservices.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordservices.net/icon.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Services'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordservices.net'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordservices.net'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordServices.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - servers: Util_1.Util.resolveCount(serverCount), - shards: shard.count - } - : { servers: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Posts news to your bot page - * @param id The bot's ID - * @param title The title of the post - * @param content The content of the post - */ - DiscordServices.prototype.postNews = function (id, title, content) { - return this._request({ - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(id) + "/news", - headers: { Authorization: this.token }, - data: { - title: title, - content: content, - error: false - } - }, { requiresToken: true }); - }; - /** - * Posts commands info to your bot page - * @param id The bot's ID - * @param commands The command info to post - */ - DiscordServices.prototype.postCommands = function (id, commands) { - return this._request({ - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(id) + "/commands", - headers: { Authorization: this.token }, - data: commands - }, { requiresToken: true }); - }; - return DiscordServices; -}(Service_1.Service)); -exports.default = DiscordServices; diff --git a/lib/Interface/Lists/Disforge.d.ts b/lib/Interface/Lists/Disforge.d.ts deleted file mode 100644 index 70c8305f..00000000 --- a/lib/Interface/Lists/Disforge.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Disforge service. - * @see https://disforge.com/developer - */ -export default class Disforge extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Retreives the data shown on the homepage. - */ - getHomepage(): Promise>; - /** - * Retreives statistics about Disforge. - */ - getStats(): Promise>; -} diff --git a/lib/Interface/Lists/Disforge.js b/lib/Interface/Lists/Disforge.js deleted file mode 100644 index 76ba5d35..00000000 --- a/lib/Interface/Lists/Disforge.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Disforge service. - * @see https://disforge.com/developer - */ -var Disforge = /** @class */ (function (_super) { - __extends(Disforge, _super); - function Disforge() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Disforge, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['disforge', 'disforge.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://disforge.com/assets/img/ui/categories/all-bots.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "serviceName", { - /** Service's name. */ - get: function () { - return 'Disforge'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://disforge.com/bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://disforge.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - Disforge.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/botstats/" + Util_1.Util.resolveID(clientID), - headers: { - Authorization: token - }, - data: { - servers: Util_1.Util.resolveCount(serverCount) - } - }); - }; - /** - * Retreives the data shown on the homepage. - */ - Disforge.prototype.getHomepage = function () { - return this._request({ url: "/home" }); - }; - /** - * Retreives statistics about Disforge. - */ - Disforge.prototype.getStats = function () { - return this._request({ url: "/stats" }); - }; - return Disforge; -}(Service_1.Service)); -exports.default = Disforge; diff --git a/lib/Interface/Lists/GlennBotList.d.ts b/lib/Interface/Lists/GlennBotList.d.ts deleted file mode 100644 index c13c5907..00000000 --- a/lib/Interface/Lists/GlennBotList.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Glenn Bot List service. - * @see https://docs.glennbotlist.xyz/ - */ -export default class GlennBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Get a user's profile listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/GlennBotList.js b/lib/Interface/Lists/GlennBotList.js deleted file mode 100644 index 423bf616..00000000 --- a/lib/Interface/Lists/GlennBotList.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Glenn Bot List service. - * @see https://docs.glennbotlist.xyz/ - */ -var GlennBotList = /** @class */ (function (_super) { - __extends(GlennBotList, _super); - function GlennBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(GlennBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['glennbotlist', 'glennbotlist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/8HphUE7.jpg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Glenn Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://glennbotlist.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://glennbotlist.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - GlennBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { - serverCount: Util_1.Util.resolveCount(serverCount), - shardCount: shard ? Util_1.Util.resolveCount(shard.count) : undefined - } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - GlennBotList.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - GlennBotList.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Get a user's profile listed on this service. - * @param id The user's ID - */ - GlennBotList.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - GlennBotList.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("https://glennbotlist.xyz/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}, false); - }; - return GlennBotList; -}(Service_1.Service)); -exports.default = GlennBotList; diff --git a/lib/Interface/Lists/InfinityBots.d.ts b/lib/Interface/Lists/InfinityBots.d.ts deleted file mode 100644 index 7418f98a..00000000 --- a/lib/Interface/Lists/InfinityBots.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Infinity Bots service. - * @see https://docs.infinitybots.xyz - */ -export default class InfinityBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/InfinityBots.js b/lib/Interface/Lists/InfinityBots.js deleted file mode 100644 index 83b7fabb..00000000 --- a/lib/Interface/Lists/InfinityBots.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Infinity Bots service. - * @see https://docs.infinitybots.xyz - */ -var InfinityBots = /** @class */ (function (_super) { - __extends(InfinityBots, _super); - function InfinityBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(InfinityBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['infinitybots', 'infinitybots.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://i.imgur.com/x0LCfAh.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'Infinity Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://infinitybots.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.infinitybots.xyz'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - InfinityBots.post = function (options) { - var clientID = options.clientID, token = options.token, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { - authorization: token - }, - data: __assign({ servers: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) - ? { - shards: Util_1.Util.resolveCount(shard.count) - } - : {})) - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - InfinityBots.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/info" - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - InfinityBots.prototype.getUser = function (id) { - return this._request({ - url: "/user/" + Util_1.Util.resolveID(id) - }); - }; - return InfinityBots; -}(Service_1.Service)); -exports.default = InfinityBots; diff --git a/lib/Interface/Lists/ListMyBots.d.ts b/lib/Interface/Lists/ListMyBots.d.ts deleted file mode 100644 index 103f807d..00000000 --- a/lib/Interface/Lists/ListMyBots.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the List My Bots service. - * @see https://listmybots.com/docs/api - */ -export default class ListMyBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the status widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getStatusWidgetURL(id: IDResolvable, query?: Query): string; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the info about someone's bots. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/ListMyBots.js b/lib/Interface/Lists/ListMyBots.js deleted file mode 100644 index 5915f391..00000000 --- a/lib/Interface/Lists/ListMyBots.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the List My Bots service. - * @see https://listmybots.com/docs/api - */ -var ListMyBots = /** @class */ (function (_super) { - __extends(ListMyBots, _super); - function ListMyBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(ListMyBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['listmybots', 'listmybots.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/5Vm5J7i.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'List My Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://listmybots.com/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://listmybots.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - ListMyBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - ListMyBots.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the status widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - ListMyBots.prototype.getStatusWidgetURL = function (id, query) { - return this._appendQuery("https://listmybots.com/api/bot/" + Util_1.Util.resolveID(id) + "/widget/status", query || {}, false); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - ListMyBots.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the info about someone's bots. - * @param id The user's ID - */ - ListMyBots.prototype.getUserBots = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - ListMyBots.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("https://listmybots.com/api/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}, false); - }; - return ListMyBots; -}(Service_1.Service)); -exports.default = ListMyBots; diff --git a/lib/Interface/Lists/ParadiseBots.d.ts b/lib/Interface/Lists/ParadiseBots.d.ts deleted file mode 100644 index 7707e032..00000000 --- a/lib/Interface/Lists/ParadiseBots.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Paradise Bots service. - * @see https://paradisebots.net/api/v1/docs - */ -export default class ParadiseBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/ParadiseBots.js b/lib/Interface/Lists/ParadiseBots.js deleted file mode 100644 index da86b136..00000000 --- a/lib/Interface/Lists/ParadiseBots.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Paradise Bots service. - * @see https://paradisebots.net/api/v1/docs - */ -var ParadiseBots = /** @class */ (function (_super) { - __extends(ParadiseBots, _super); - function ParadiseBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(ParadiseBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['paradisebots', 'paradisebots.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://i.imgur.com/Df2seyl.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'Paradise Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://paradisebots.net/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://paradisebots.net/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - ParadiseBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { - Authorization: token - }, - data: __assign({ server_count: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) - ? { - shard_count: Util_1.Util.resolveCount(shard.count) - } - : {})) - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - ParadiseBots.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - return ParadiseBots; -}(Service_1.Service)); -exports.default = ParadiseBots; diff --git a/lib/Interface/Lists/SpaceBotsList.d.ts b/lib/Interface/Lists/SpaceBotsList.d.ts deleted file mode 100644 index 070791bd..00000000 --- a/lib/Interface/Lists/SpaceBotsList.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Space Bots List service. - * @see https://spacebots.gitbook.io/tutorial-en/ - */ -export default class SpaceBotsList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/SpaceBotsList.js b/lib/Interface/Lists/SpaceBotsList.js deleted file mode 100644 index a2f5f1b0..00000000 --- a/lib/Interface/Lists/SpaceBotsList.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Space Bots List service. - * @see https://spacebots.gitbook.io/tutorial-en/ - */ -var SpaceBotsList = /** @class */ (function (_super) { - __extends(SpaceBotsList, _super); - function SpaceBotsList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(SpaceBotsList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['spacebotslist', 'space-bot-list.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://cdn.discordapp.com/avatars/546742409409593354/123b9b0a54b45d99627215c7154580af.webp?size=256'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Space Bots List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://space-bot-list.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://space-bot-list.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - SpaceBotsList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, userCount = options.userCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { - guilds: Util_1.Util.resolveCount(serverCount), - users: Util_1.Util.resolveCount(userCount) - } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - SpaceBotsList.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - return SpaceBotsList; -}(Service_1.Service)); -exports.default = SpaceBotsList; diff --git a/lib/Interface/Lists/TopCord.d.ts b/lib/Interface/Lists/TopCord.d.ts deleted file mode 100644 index d0a98103..00000000 --- a/lib/Interface/Lists/TopCord.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the TopCord service. - * @see https://docs.topcord.xyz/#/API - */ -export default class TopCord extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Lists every bot on this service. - */ - getBots(): Promise>; -} diff --git a/lib/Interface/Lists/TopCord.js b/lib/Interface/Lists/TopCord.js deleted file mode 100644 index 3011c4b2..00000000 --- a/lib/Interface/Lists/TopCord.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the TopCord service. - * @see https://docs.topcord.xyz/#/API - */ -var TopCord = /** @class */ (function (_super) { - __extends(TopCord, _super); - function TopCord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(TopCord, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['topcord', 'topcord.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://avatars0.githubusercontent.com/u/69593894?v=4'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "serviceName", { - /** Service's name. */ - get: function () { - return 'TopCord'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://topcord.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.topcord.xyz'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - TopCord.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - guilds: Util_1.Util.resolveCount(serverCount), - shards: shard.count - } - : { guilds: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - TopCord.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Lists every bot on this service. - */ - TopCord.prototype.getBots = function () { - return this._request({ url: "/bots" }); - }; - return TopCord; -}(Service_1.Service)); -exports.default = TopCord; diff --git a/lib/Interface/Lists/TopGG.d.ts b/lib/Interface/Lists/TopGG.d.ts deleted file mode 100644 index 2333d600..00000000 --- a/lib/Interface/Lists/TopGG.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Top.gg service. - * @see https://docs.top.gg/ - */ -export default class TopGG extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). - * @param query The query string that will be used in the request - */ - getBots(query: Query): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - getBotStats(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) - */ - getWidgetURL(id: IDResolvable, query?: Query, smallWidget?: string): string; -} diff --git a/lib/Interface/Lists/TopGG.js b/lib/Interface/Lists/TopGG.js deleted file mode 100644 index d7eea770..00000000 --- a/lib/Interface/Lists/TopGG.js +++ /dev/null @@ -1,159 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Top.gg service. - * @see https://docs.top.gg/ - */ -var TopGG = /** @class */ (function (_super) { - __extends(TopGG, _super); - function TopGG() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(TopGG, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['topgg', 'top.gg']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://top.gg/images/dblnew.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "serviceName", { - /** Service's name. */ - get: function () { - return 'Top.gg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://top.gg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://top.gg/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - TopGG.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_id: shard.id, - shard_count: shard.count - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - TopGG.prototype.getUser = function (id) { - return this._request({ - url: "/users/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). - * @param query The query string that will be used in the request - */ - TopGG.prototype.getBots = function (query) { - return this._request({ url: '/bots', params: query, headers: { Authorization: this.token } }, { requiresToken: true }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - TopGG.prototype.getBot = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - TopGG.prototype.getBotStats = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/stats", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - TopGG.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - TopGG.prototype.userVoted = function (botId, userID) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(botId) + "/check", - params: { userId: Util_1.Util.resolveID(userID) }, - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) - */ - TopGG.prototype.getWidgetURL = function (id, query, smallWidget) { - var subPath = smallWidget ? smallWidget + "/" : ''; - return this._appendQuery("/widget/" + subPath + Util_1.Util.resolveID(id) + ".svg", query || {}); - }; - return TopGG; -}(Service_1.Service)); -exports.default = TopGG; diff --git a/lib/Interface/Lists/VoidBots.d.ts b/lib/Interface/Lists/VoidBots.d.ts deleted file mode 100644 index c4b93623..00000000 --- a/lib/Interface/Lists/VoidBots.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Void Bots service. - * @see https://docs.voidbots.net/ - */ -export default class VoidBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - getBotReviews(id: IDResolvable): Promise>; - /** - * Gets the bot's analytics on this service. - * @param id The bot's ID - */ - getBotAnalytics(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/VoidBots.js b/lib/Interface/Lists/VoidBots.js deleted file mode 100644 index 70d5f88f..00000000 --- a/lib/Interface/Lists/VoidBots.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Void Bots service. - * @see https://docs.voidbots.net/ - */ -var VoidBots = /** @class */ (function (_super) { - __extends(VoidBots, _super); - function VoidBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(VoidBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['voidbots', 'voidbots.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://gblobscdn.gitbook.com/spaces%2F-MFw3t62urLlBeats8UJ%2Favatar-1598748054479.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'Void Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://voidbots.net/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.voidbots.net'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - VoidBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/stats/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: (shard === null || shard === void 0 ? void 0 : shard.count) - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: Util_1.Util.resolveCount(shard.count) - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - VoidBots.prototype.getBot = function (id) { - return this._request({ - url: "/bot/info/" + Util_1.Util.resolveID(id), - headers: { - Authorization: this.token - } - }, { requiresToken: true }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - VoidBots.prototype.userVoted = function (botId, userID) { - return this._request({ - url: "/bot/voted/" + Util_1.Util.resolveID(botId) + "/" + Util_1.Util.resolveID(userID), - headers: { - Authorization: this.token - } - }, { requiresToken: true }); - }; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - VoidBots.prototype.getBotReviews = function (id) { - return this._request({ - url: "/bot/reviews/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the bot's analytics on this service. - * @param id The bot's ID - */ - VoidBots.prototype.getBotAnalytics = function (id) { - return this._request({ - url: "/bot/analytics/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - return VoidBots; -}(Service_1.Service)); -exports.default = VoidBots; diff --git a/lib/Interface/Lists/WonderBotList.d.ts b/lib/Interface/Lists/WonderBotList.d.ts deleted file mode 100644 index efb88847..00000000 --- a/lib/Interface/Lists/WonderBotList.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Wonder Bot List service. - * @see https://api.wonderbotlist.com/en/ - */ -export default class WonderBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/WonderBotList.js b/lib/Interface/Lists/WonderBotList.js deleted file mode 100644 index 223377fd..00000000 --- a/lib/Interface/Lists/WonderBotList.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Wonder Bot List service. - * @see https://api.wonderbotlist.com/en/ - */ -var WonderBotList = /** @class */ (function (_super) { - __extends(WonderBotList, _super); - function WonderBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(WonderBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['wonderbotlist', 'wonderbotlist.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/8Jk3EJg.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Wonder Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://wonderbotlist.com/en'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.wonderbotlist.com/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - WonderBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - params: shard && shard.count - ? { serveurs: Util_1.Util.resolveCount(serverCount), shard: shard.count } - : { serveurs: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - WonderBotList.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - WonderBotList.prototype.getUser = function (id) { - return this._request({ - url: "/user/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return WonderBotList; -}(Service_1.Service)); -exports.default = WonderBotList; diff --git a/lib/Interface/Lists/YABL.d.ts b/lib/Interface/Lists/YABL.d.ts deleted file mode 100644 index 5902a223..00000000 --- a/lib/Interface/Lists/YABL.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the YABL service. - * @see https://yabl.xyz/api - */ -export default class YABL extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Invalidates the token being used in the request. */ - invalidate(): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** Gets 20 random bots from this service. */ - getRandomBots(): Promise>; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; - /** - * Gets a page of bots on this service. - * @param query The query string that will be used in the request - */ - getBotsByPage(query: Query): Promise>; - /** Gets a list of unverified bots on this service. */ - getUnverifiedBots(): Promise>; -} diff --git a/lib/Interface/Lists/YABL.js b/lib/Interface/Lists/YABL.js deleted file mode 100644 index aa52c916..00000000 --- a/lib/Interface/Lists/YABL.js +++ /dev/null @@ -1,137 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the YABL service. - * @see https://yabl.xyz/api - */ -var YABL = /** @class */ (function (_super) { - __extends(YABL, _super); - function YABL() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(YABL, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['yabl', 'yabl.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://i.imgur.com/OFiMern.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "serviceName", { - /** Service's name. */ - get: function () { - return 'Yet Another Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://yabl.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://yabl.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - YABL.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** Invalidates the token being used in the request. */ - YABL.prototype.invalidate = function () { - return this._request({ - url: '/token/invalidate', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - YABL.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** Gets 20 random bots from this service. */ - YABL.prototype.getRandomBots = function () { - return this._request({ url: '/bots' }); - }; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - YABL.prototype.getUserBots = function (id) { - return this._request({ url: "/bots/user/" + Util_1.Util.resolveID(id) }); - }; - /** Gets a list of bots on this service. */ - YABL.prototype.getBots = function () { - return this._request({ - url: '/bots/all', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets a page of bots on this service. - * @param query The query string that will be used in the request - */ - YABL.prototype.getBotsByPage = function (query) { - return this._request({ url: '/bots/page', params: query }); - }; - /** Gets a list of unverified bots on this service. */ - YABL.prototype.getUnverifiedBots = function () { - return this._request({ - url: '/bots/unverified', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return YABL; -}(Service_1.Service)); -exports.default = YABL; diff --git a/lib/Interface/Poster.d.ts b/lib/Interface/Poster.d.ts deleted file mode 100644 index 0e75e028..00000000 --- a/lib/Interface/Poster.d.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { CustomEvent, CustomService, eventHandler, PosterOptions, ServiceKey } from '../Utils/Constants'; -import { Service } from './Service'; -export interface manualPostOptions { - /** The server count to post to the service */ - serverCount: number; - /** The user count to post to the service */ - userCount?: number; - /** The voice connection count to post to the service */ - voiceConnections?: number; -} -/** A class that posts server count to listing site(s). */ -export declare class Poster { - /** The client that will be used to fetch the stats */ - client: PosterOptions['client']; - /** An array of custom services that the poster uses */ - customServices: CustomService[]; - /** The API keys that the poster is using */ - apiKeys: Record; - /** The options the poster was built with */ - readonly options: PosterOptions; - /** The list of event handlers for every custom event */ - handlers: Record; - /** The client filler used in the poster */ - private _clientFiller; - /** Interval that posts to all services */ - private _interval?; - /** - * @constructor - * @param options The options needed to construct the poster - */ - constructor(options: PosterOptions); - /** The client filler used in the poster */ - private get clientFiller(); - /** - * Retrieves the current server count of the client/shard. - * @returns Amount of servers the client/shard is in - */ - getServerCount(): Promise; - /** - * Retrieves the current user count of the client/shard. - * @returns Amount of users the client/shard is connected with - */ - getUserCount(): Promise; - /** - * Retrieves the current voice connection count of the client/shard. - * @returns Number of active voice connections - */ - getVoiceConnections(): Promise; - /** - * Creates an interval that posts to all services. - * @param interval The time (in ms) to reach to post to all {@link Service}s again - * @returns The interval that is responsible for posting - * @emits Poster#autopostSuccess - * @emits Poster#autopostFail - */ - startInterval(interval?: number): number; - /** Destroys the current interval. */ - stopInterval(): void; - /** - * Gets a service, autofilling its API key if the poster has it. - * @param service The service to get - */ - getService(service: ServiceKey): (Service | CustomService) | typeof Service | undefined; - /** - * Posts the current clients server count to a service. - * @param service The service to post to - * @see Poster#postManual - * @returns The result(s) of the post - * @emits Poster#postSuccess - * @emits Poster#postFail - */ - post(service?: ServiceKey | 'all'): Promise; - /** - * Manually posts a server count to a service. - * @param service The service to post to - * @param counts An object containing the tallies of servers, users and voice connections - * @returns The result(s) of the post - */ - postManual(service: ServiceKey | 'all', counts: manualPostOptions): Promise; - /** - * Adds an handler for an event. - * @param event The name of the event to add the handler to - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - addHandler(event: CustomEvent, handler: eventHandler): eventHandler[]; - /** - * Removes an handler for an event. - * @param event The name of the event to remove the handler from - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - removeHandler(event: CustomEvent, handler: eventHandler): eventHandler[]; - /** - * Manually triggers an event with custom arguments. - * @param {CustomEvent} event The name of the event to run the handlers for - * @param {...any} args The arguments to pass to the handlers - */ - runHandlers(event: CustomEvent, ...args: any[]): void; -} diff --git a/lib/Interface/Poster.js b/lib/Interface/Poster.js deleted file mode 100644 index 41b065a7..00000000 --- a/lib/Interface/Poster.js +++ /dev/null @@ -1,319 +0,0 @@ -"use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Poster = void 0; -var Constants_1 = require("../Utils/Constants"); -var EnsurePromise_1 = require("../Utils/EnsurePromise"); -var DBotsError_1 = require("../Utils/DBotsError"); -var ClientFiller_1 = require("./ClientFiller"); -var Service_1 = require("./Service"); -var promise_allsettled_1 = __importDefault(require("promise.allsettled")); -var DBotsError = DBotsError_1.errors.Error, TypeError = DBotsError_1.errors.TypeError; -/** A class that posts server count to listing site(s). */ -var Poster = /** @class */ (function () { - // #endregion - /** - * @constructor - * @param options The options needed to construct the poster - */ - function Poster(options) { - var _a, _b; - if (!options || typeof options !== 'object') - throw new DBotsError('INVALID_POSTER_OPTIONS'); - this.client = options.client; - this._clientFiller = null; - this.customServices = options.customServices || []; - this.apiKeys = options.apiKeys || {}; - this.options = options; - if (typeof options.useSharding !== 'boolean') - options.useSharding = true; - if (!this.client && !options.clientID) - throw new DBotsError('NO_CLIENT_OR_ID'); - if (this.client && !options.clientID) - Object.assign(options, { - clientID: (_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.clientID, - shard: (_b = this.clientFiller) === null || _b === void 0 ? void 0 : _b.shard - }); - if (!options.useSharding) - options.shard = undefined; - this.handlers = {}; - for (var _i = 0, SupportedEvents_1 = Constants_1.SupportedEvents; _i < SupportedEvents_1.length; _i++) { - var event_1 = SupportedEvents_1[_i]; - this.handlers[event_1] = []; - } - } - Object.defineProperty(Poster.prototype, "clientFiller", { - /** The client filler used in the poster */ - get: function () { - return (this._clientFiller || - (this.options.clientLibrary && this.client - ? (this._clientFiller = ClientFiller_1.getClientFiller(this.options.clientLibrary, this.client)) - : undefined)); - }, - enumerable: false, - configurable: true - }); - /** - * Retrieves the current server count of the client/shard. - * @returns Amount of servers the client/shard is in - */ - Poster.prototype.getServerCount = function () { - var _a; - if (this.options.serverCount) - // @ts-expect-error - return EnsurePromise_1.ensurePromise(this.options.serverCount); - if (!this.client) - throw new DBotsError('NO_CLIENT', 'server'); - if (!this.options.clientLibrary) - throw new DBotsError('UNKNOWN_CLIENT', 'server'); - return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.serverCount) || 0); - }; - /** - * Retrieves the current user count of the client/shard. - * @returns Amount of users the client/shard is connected with - */ - Poster.prototype.getUserCount = function () { - var _a; - if (this.options.userCount) - // @ts-expect-error - return EnsurePromise_1.ensurePromise(this.options.userCount); - if (!this.client) - throw new DBotsError('NO_CLIENT', 'user'); - if (!this.options.clientLibrary) - throw new DBotsError('UNKNOWN_CLIENT', 'user'); - return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.userCount) || 0); - }; - /** - * Retrieves the current voice connection count of the client/shard. - * @returns Number of active voice connections - */ - Poster.prototype.getVoiceConnections = function () { - var _a; - if (this.options.voiceConnections) - // @ts-expect-error - return EnsurePromise_1.ensurePromise(this.options.voiceConnections); - if (!this.client) - throw new DBotsError('NO_CLIENT', 'voice connection'); - if (!this.options.clientLibrary) - throw new DBotsError('UNKNOWN_CLIENT', 'voice connection'); - return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.voiceConnections) || 0); - }; - /** - * Creates an interval that posts to all services. - * @param interval The time (in ms) to reach to post to all {@link Service}s again - * @returns The interval that is responsible for posting - * @emits Poster#autopostSuccess - * @emits Poster#autopostFail - */ - Poster.prototype.startInterval = function (interval) { - var _this_1 = this; - if (interval === void 0) { interval = 1800000; } - this._interval && clearTimeout(this._interval); - this._interval = setInterval(function () { - return _this_1.post() - .then(function (result) { - _this_1.runHandlers('autopostSuccess', result); - return result; - }) - .catch(function (error) { return _this_1.runHandlers('autopostFail', error); }); - }, interval); - return this._interval; - }; - /** Destroys the current interval. */ - Poster.prototype.stopInterval = function () { - if (this._interval) - clearTimeout(this._interval); - }; - /** - * Gets a service, autofilling its API key if the poster has it. - * @param service The service to get - */ - Poster.prototype.getService = function (service) { - var _this_1 = this; - var serviceClass = Service_1.Service.get(service, this.customServices); - if (!serviceClass) - return undefined; - var keyName = serviceClass.aliases.find(function (key) { - return Object.keys(_this_1.apiKeys).includes(key); - }); - if (keyName) - return new serviceClass(this.apiKeys[keyName]); - else - return serviceClass; - }; - /** - * Posts the current clients server count to a service. - * @param service The service to post to - * @see Poster#postManual - * @returns The result(s) of the post - * @emits Poster#postSuccess - * @emits Poster#postFail - */ - Poster.prototype.post = function (service) { - if (service === void 0) { service = 'all'; } - var _this = this; - return new Promise(function (resolve, reject) { - return Promise.all([ - _this.getServerCount(), - _this.getUserCount(), - _this.getVoiceConnections() - ]) - .then(function (_a) { - var serverCount = _a[0], userCount = _a[1], voiceConnections = _a[2]; - _this - .postManual(service, { serverCount: serverCount, userCount: userCount, voiceConnections: voiceConnections }) - .then(resolve) - .catch(reject); - }) - .catch(reject); - }); - }; - /** - * Manually posts a server count to a service. - * @param service The service to post to - * @param counts An object containing the tallies of servers, users and voice connections - * @returns The result(s) of the post - */ - Poster.prototype.postManual = function (service, counts) { - var _this_1 = this; - var serverCount = counts.serverCount, userCount = counts.userCount, voiceConnections = counts.voiceConnections; - if (!service) - service = 'all'; - if (!this.apiKeys && !this.options.post) - return Promise.reject(new DBotsError('NO_API_KEYS')); - if (service === 'custom') - // @ts-expect-error - return EnsurePromise_1.ensurePromise( - // @ts-expect-error - this.options.post, this.options.clientID, serverCount, this.options.shard); - if (service === 'all') { - var services = Object.keys(this.apiKeys); - if (this.options.post) - services.push('custom'); - return promise_allsettled_1.default - .call(Promise, services.map(function (k) { - return _this_1.postManual(k, { serverCount: serverCount, userCount: userCount, voiceConnections: voiceConnections }); - })) - .then(function (requests) { - var _a, _b; - var rejected = [], hostnames = []; - for (var _i = 0, requests_1 = requests; _i < requests_1.length; _i++) { - var r = requests_1[_i]; - if (r.status == 'rejected') { - rejected.push(r); - // @ts-expect-error - if ((_b = (_a = r.reason) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.url) { - // @ts-expect-error - var hostname = new URL(r.reason.config.url).hostname; - if (hostname && !hostnames.includes(hostname)) - hostnames.push(hostname); - } - else - hostnames.push('???'); - } - } - if (rejected.length > 0) { - var msg = rejected.length + " request" + (rejected.length == 1 ? '' : 's') + " have been rejected.\n"; - if (hostnames.length > 0) - msg += "Failing hostnames: " + hostnames.join(', ') + "\n"; - msg += 'Please check the error from the following responses.\n'; - msg += rejected - .map(function (rej) { - var reason = rej.reason || rej; - return reason && - typeof reason == 'object' && - !(reason instanceof Error) - ? JSON.stringify(reason, null, 2) - : reason.toString(); - }) - .join('\n'); - throw new DBotsError('GENERIC', msg); - } - else { - // @ts-expect-error - return requests.map(function (r) { return r.value; }); - } - }); - } - if (!Object.keys(this.apiKeys).includes(service)) - return Promise.reject(new DBotsError('SERVICE_NO_KEY', service)); - var serviceClass = Service_1.Service.get(service, this.customServices); - if (!serviceClass) - return Promise.reject(new TypeError('INVALID_SERVICE', service)); - return new Promise(function (resolve, reject) { - serviceClass - .post({ - token: _this_1.apiKeys[service], - clientID: _this_1.options.clientID || '', - shard: _this_1.options.shard, - serverCount: serverCount, - userCount: userCount, - voiceConnections: voiceConnections - }) - .then(function (result) { - _this_1.runHandlers('postSuccess', result); - resolve(result); - }) - .catch(function (error) { - _this_1.runHandlers('postFail', error); - reject(error); - }); - }); - }; - /** - * Adds an handler for an event. - * @param event The name of the event to add the handler to - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - Poster.prototype.addHandler = function (event, handler) { - if (!Constants_1.SupportedEvents.includes(event)) - throw new TypeError('UNSUPPORTED_EVENT', 'add'); - if (typeof handler != 'function') - throw new DBotsError('HANDLER_INVALID'); - this.handlers[event].push(handler); - return this.handlers[event]; - }; - /** - * Removes an handler for an event. - * @param event The name of the event to remove the handler from - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - Poster.prototype.removeHandler = function (event, handler) { - if (!Constants_1.SupportedEvents.includes(event)) - throw new TypeError('UNSUPPORTED_EVENT', 'remove'); - if (typeof handler != 'function') - throw new DBotsError('HANDLER_INVALID'); - var index = this.handlers[event].indexOf(handler); - if (index >= 0) - this.handlers[event].splice(index, 1); - return this.handlers[event]; - }; - /** - * Manually triggers an event with custom arguments. - * @param {CustomEvent} event The name of the event to run the handlers for - * @param {...any} args The arguments to pass to the handlers - */ - Poster.prototype.runHandlers = function (event) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - if (!Constants_1.SupportedEvents.includes(event)) - throw new TypeError('UNSUPPORTED_EVENT', 'run'); - for (var _a = 0, _b = this.handlers[event]; _a < _b.length; _a++) { - var handler = _b[_a]; - EnsurePromise_1.ensurePromise.apply(void 0, __spreadArray([handler], args)); - } - }; - return Poster; -}()); -exports.Poster = Poster; diff --git a/lib/Interface/Service.d.ts b/lib/Interface/Service.d.ts deleted file mode 100644 index b77a743b..00000000 --- a/lib/Interface/Service.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { RequestForm } from '../Utils/FormatRequest'; -import { CustomService, Query, Shard } from '../Utils/Constants'; -import { CountResolvable, IDResolvable } from '../Utils/Util'; -/** Options provided when sending a service request */ -export interface ServiceRequestOptions { - /** Whether the request requires a token */ - requiresToken?: boolean; - /** Whether to prepend the service's base API url */ - appendBaseURL?: boolean; -} -/** Options provided when posting to a service */ -export interface ServicePostOptions { - /** The Authorization token for the request */ - token: string; - /** The client ID that the request will post for */ - clientID: IDResolvable; - /** The amount of servers that the client is in */ - serverCount: CountResolvable; - /** The amount of users that the client cached */ - userCount: CountResolvable; - /** The number of voice connections */ - voiceConnections?: CountResolvable; - /** The shard the request is representing */ - shard?: Shard; -} -/** Represents a basic service. */ -export declare class Service { - /** - * The token that will be used for the service. - * @private - */ - token: string; - /** - * @param token The token/key for the service - */ - constructor(token: string); - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Gets a service from a key. - * @param key The name of the service to get - * @param extras An array of {@link CustomService}s to include - */ - static get(key: string, extras?: CustomService[]): typeof Service | null; - /** Gets every loaded service. */ - static getAll(): Record; - /** - * Posts statistics to this service. - * Internally, this is supposed to be used in extended classes. - * @param form The request form - * @param appendBaseURL Whether to append the service's base API url - * @private - */ - static _post(form: RequestForm, appendBaseURL?: boolean): Promise>; - /** - * Sends a request for the service interface. - * @param form The request form - * @param options The options of this request - * @private - */ - _request(form: RequestForm, options?: ServiceRequestOptions): Promise>; - /** - * Appends query string to a URL. - * @param url The URL to modify - * @param query The query to append - * @param appendBaseURL Whether to prepend the service's base API url - * @returns The modified URL - * @private - */ - _appendQuery(url: string, query: Query, appendBaseURL?: boolean): string; - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** - * The logo URL, used only for documentation. - * @private - */ - static get logoURL(): string; - /** - * Service's name, used only for documentation. - * @private - */ - static get serviceName(): string; - /** - * The website URL, used only for documentation. - * @private - */ - static get websiteURL(): string; - static post(options: ServicePostOptions): ReturnType; -} diff --git a/lib/Interface/Service.js b/lib/Interface/Service.js deleted file mode 100644 index c66e3478..00000000 --- a/lib/Interface/Service.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Service = void 0; -var FormatRequest_1 = require("../Utils/FormatRequest"); -var DBotsError_1 = require("../Utils/DBotsError"); -var Error = DBotsError_1.errors.Error; -// @ts-expect-error -var buildURL_1 = __importDefault(require("axios/lib/helpers/buildURL")); -var Util_1 = require("../Utils/Util"); -/** Represents a basic service. */ -var Service = /** @class */ (function () { - /** - * @param token The token/key for the service - */ - function Service(token) { - this.token = token; - } - Object.defineProperty(Service, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return ''; - }, - enumerable: false, - configurable: true - }); - /** - * Gets a service from a key. - * @param key The name of the service to get - * @param extras An array of {@link CustomService}s to include - */ - Service.get = function (key, extras) { - if (extras === void 0) { extras = []; } - if (!key || typeof key !== 'string') - return null; - var services = __spreadArray(__spreadArray([], Object.values(serviceClasses)), extras); - for (var _i = 0, services_1 = services; _i < services_1.length; _i++) { - var service = services_1[_i]; - if (!service || !service.aliases || !service.post) - continue; - if (service.aliases.includes(key.toLowerCase())) - return service; - } - return null; - }; - /** Gets every loaded service. */ - Service.getAll = function () { - return serviceClasses; - }; - /** - * Posts statistics to this service. - * Internally, this is supposed to be used in extended classes. - * @param form The request form - * @param appendBaseURL Whether to append the service's base API url - * @private - */ - Service._post = function (form, appendBaseURL) { - if (appendBaseURL === void 0) { appendBaseURL = true; } - try { - this.serviceName; - } - catch (_a) { - return Promise.reject(new Error('CALLED_FROM_BASE')); - } - if (this.baseURL && appendBaseURL) - form.url = this.baseURL + form.url; - return FormatRequest_1.formatRequest(form); - }; - /** - * Sends a request for the service interface. - * @param form The request form - * @param options The options of this request - * @private - */ - Service.prototype._request = function (form, options) { - if (options === void 0) { options = {}; } - var _a = options.requiresToken, requiresToken = _a === void 0 ? false : _a, _b = options.appendBaseURL, appendBaseURL = _b === void 0 ? true : _b; - if (requiresToken && !this.token) - return Promise.reject(new Error('REQUIRES_TOKEN')); - Util_1.assert(this.constructor); - return FormatRequest_1.formatRequest(__assign(__assign({}, form), { url: (this.constructor.baseURL && appendBaseURL - ? this.constructor.baseURL - : '') + form.url })); - }; - /** - * Appends query string to a URL. - * @param url The URL to modify - * @param query The query to append - * @param appendBaseURL Whether to prepend the service's base API url - * @returns The modified URL - * @private - */ - Service.prototype._appendQuery = function (url, query, appendBaseURL) { - if (appendBaseURL === void 0) { appendBaseURL = true; } - Util_1.assert(this.constructor); - if (this.constructor.baseURL && appendBaseURL) - url = this.constructor.baseURL + url; - return buildURL_1.default(url, query); - }; - Object.defineProperty(Service, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Service, "logoURL", { - /** - * The logo URL, used only for documentation. - * @private - */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Service, "serviceName", { - /** - * Service's name, used only for documentation. - * @private - */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Service, "websiteURL", { - /** - * The website URL, used only for documentation. - * @private - */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Service.post = function (options // eslint-disable-line @typescript-eslint/no-unused-vars - ) { - throw 'This is just a placeholder method, it should not be called'; - }; - return Service; -}()); -exports.Service = Service; -// Service loading -var serviceClasses = {}; -var usingNode = typeof process != 'undefined' && process.release.name == 'node'; -if (!usingNode) { - serviceClasses = require('../../.tmp/services-list'); -} -else { - var path_1 = eval('require')('path'); - var fs = eval('require')('fs'); - var listsDir_1 = path_1.join(__dirname, './Lists'); - fs.readdirSync(listsDir_1).forEach(function (fileName) { - if (fileName.endsWith('.d.ts')) - return; - var listClass = require(path_1.join(listsDir_1, fileName)).default; - if (listClass) - serviceClasses[path_1.parse(fileName).name] = listClass; - }); -} diff --git a/lib/Utils/Constants.d.ts b/lib/Utils/Constants.d.ts deleted file mode 100644 index b40d348b..00000000 --- a/lib/Utils/Constants.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { PromiseResolvable } from './EnsurePromise'; -/** Options for a poster. */ -export interface PosterOptions { - /** - * An object that pairs a {@link ServiceKey} with their token - * @default {} - */ - apiKeys?: Record; - /** - * The client that a supported {@link Library} uses to manage the Discord application. - * Requires {@link #clientLibrary} to be present - */ - client?: object; - /** - * The client ID used for posting to a {@link Service}. - * Automatically filled in when {@link #client} is present - */ - clientID?: string; - /** The library that the client is based on */ - clientLibrary?: Library; - /** - * The function to use when posting to a server that uses the client ID, the amount of servers, and a {@link Shard}. - * This will be used when the {@link ServiceKey} is `custom` - */ - post?: PromiseResolvable; - /** The shard data for using different methods of posting to services */ - shard?: Shard; - /** The function to use when retrieving the amount of servers a client/shard is in, using the client as a parameter */ - serverCount?: PromiseResolvable; - /** The function to use when retrieving the amount of users a client/shard is connected with, using the client as a parameter */ - userCount?: PromiseResolvable; - /** The function to use when retrieving the number of active voice connections, using the client as a parameter */ - voiceConnections?: PromiseResolvable; - /** - * The custom services that the poster will use - * @default [] - */ - customServices?: CustomService[]; - /** - * Whether or not to use a {@link Service}s sharding methods when posting - * @default true - */ - useSharding?: boolean; -} -/** A shard that is used when posting to services. */ -export interface Shard { - count?: number; - id?: number; -} -/** The object that is given to {@link Service}s and {@link CustomService}s in order to send requests to them. */ -export interface PostRequestData { - /** The Authorization token for the request */ - token: string; - /** The client ID that the request will post for */ - clientID?: string; - /** The amount of servers that the client is in */ - serverCount?: number; - /** The amount of users that the client cached */ - userCount?: number; - /** The amount of voice connections the client has */ - voiceConnections?: number; - /** The shard the request is representing */ - shard?: Shard; -} -/** An object with all query parameters */ -export declare type Query = Record; -/** - * A mock of a {@link Service} that only consists of the nessessities for a poster to use it. - * When you're passing your custom services to method in this package, remmeber to use pass the actual service class, not an instance of it. - * @example - * class MyCustomService { - * static get aliases() { - * return ['a', 'string', 'array'] // string[] - * } - * - * static post() { - * return yourCustomPostMethod() // Promise - * } - * } - */ -export declare type CustomService = any; -/** - * A {@link Service} key supported by the package. - * This can also includes keys from {@link CustomService}s and can be `custom` if a {@link Poster} has a custom post function. - * @see {@link https://dbots.js.org/#/docs/main/master/general/services} - */ -export declare type ServiceKey = string; -/** - * A library supported by the package. Here are the available libraries: - * * discord.js - * * discord.io - * * discordie - * * eris - * * paracord - */ -export declare type Library = 'discord.js' | 'discord.io' | 'discordie' | 'eris' | 'paracord'; -/** - * Type of function to set for handlers - * @param result The result(s) of the post - */ -export declare type eventHandler = (result: object | object[]) => void; -/** - * An event that can be added an handler for. These are the available events: - * * autopostSuccess - * * autopostFail - * * postSuccess - * * postFail - */ -export declare type CustomEvent = 'autopostSuccess' | 'autopostFail' | 'postSuccess' | 'postFail'; -export declare const SupportedEvents: CustomEvent[]; -export declare const Package: any; diff --git a/lib/Utils/Constants.js b/lib/Utils/Constants.js deleted file mode 100644 index 2c49005a..00000000 --- a/lib/Utils/Constants.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Package = exports.SupportedEvents = void 0; -exports.SupportedEvents = [ - 'autopostSuccess', - 'autopostFail', - 'postSuccess', - 'postFail' -]; -exports.Package = require('../../package.json'); diff --git a/lib/Utils/DBotsError.d.ts b/lib/Utils/DBotsError.d.ts deleted file mode 100644 index 1b421f16..00000000 --- a/lib/Utils/DBotsError.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// -export declare const codeSymbol: unique symbol; -export declare const messages: Map<"INVALID_POSTER_OPTIONS" | "NO_CLIENT_OR_ID" | "UNKNOWN_CLIENT" | "NO_CLIENT" | "NO_API_KEYS" | "SERVICE_NO_KEY" | "INVALID_SERVICE" | "HANDLER_INVALID" | "UNSUPPORTED_EVENT" | "CALLED_FROM_BASE" | "REQUIRES_TOKEN" | "POSTING_UNSUPPORTED" | "INVALID_ID" | "INVALID_COUNT" | "COUNT_NEGATIVE" | "GENERIC", string | ((...args: any[]) => string)>; -/** - * Register an error code and message. - * @param sym Unique name for the error - * @param val Value of the error - */ -export declare function register(sym: errorKey, val: any): void; -declare type errorKey = keyof typeof messageObject; -declare const messageObject: { - INVALID_POSTER_OPTIONS: string; - NO_CLIENT_OR_ID: string; - UNKNOWN_CLIENT: (count_name: string) => string; - NO_CLIENT: (count_name: string) => string; - NO_API_KEYS: string; - SERVICE_NO_KEY: (service: string) => string; - INVALID_SERVICE: (service: string) => string; - HANDLER_INVALID: string; - UNSUPPORTED_EVENT: (action: string) => string; - CALLED_FROM_BASE: string; - REQUIRES_TOKEN: string; - POSTING_UNSUPPORTED: (service: string) => string; - INVALID_ID: string; - INVALID_COUNT: string; - COUNT_NEGATIVE: string; - GENERIC: (err: string) => string; -}; -export declare const errors: { - Error: { - new (key: errorKey, ...args: any[]): { - readonly name: string; - readonly code: any; - message: string; - stack?: string | undefined; - }; - captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - stackTraceLimit: number; - }; - TypeError: { - new (key: errorKey, ...args: any[]): { - readonly name: string; - readonly code: any; - message: string; - stack?: string | undefined; - }; - captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - stackTraceLimit: number; - }; - RangeError: { - new (key: errorKey, ...args: any[]): { - readonly name: string; - readonly code: any; - message: string; - stack?: string | undefined; - }; - captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - stackTraceLimit: number; - }; -}; -export {}; diff --git a/lib/Utils/DBotsError.js b/lib/Utils/DBotsError.js deleted file mode 100644 index ef176f59..00000000 --- a/lib/Utils/DBotsError.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; -// Taken from Discord.JS's way of making errors -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.errors = exports.register = exports.messages = exports.codeSymbol = void 0; -exports.codeSymbol = Symbol('code'); -exports.messages = new Map(); -// This is just a mock class to make docs work -/** - * Extend an error of some sort into a DBotsError. - * @param {string} key Error key - * @param {any[]} args Arguments to pass for util format or as function args - * @extends Error - * @private - */ -var DBotsError = /** @class */ (function (_super) { - __extends(DBotsError, _super); - function DBotsError() { - var _this = _super.call(this) || this; - _this.name = ''; - _this.code = ''; - return _this; - } - return DBotsError; -}(Error)); -/** - * Extend an error of some sort into a DBotsError. - * @param Base Base error to extend - * @returns The resulting class (as a class, not an instance) - */ -function makeDbotsError(Base) { - return /** @class */ (function (_super) { - __extends(DBotsError, _super); - function DBotsError(key) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var _this = _super.call(this, message(key, args)) || this; - // @ts-expect-error - _this[exports.codeSymbol] = key; - if (Error.captureStackTrace) - Error.captureStackTrace(_this, DBotsError); - return _this; - } - Object.defineProperty(DBotsError.prototype, "name", { - get: function () { - // @ts-expect-error - return _super.prototype.name + " [" + this[exports.codeSymbol] + "]"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBotsError.prototype, "code", { - get: function () { - // @ts-expect-error - return this[exports.codeSymbol]; - }, - enumerable: false, - configurable: true - }); - return DBotsError; - }(Base)); -} -/** - * Format the message for an error. - * @param key Error key - * @param args Arguments to pass for util format or as function args - * @returns Formatted string - */ -function message(key, args) { - if (typeof key !== 'string') - throw new Error('Error message key must be a string'); - var msg = exports.messages.get(key); - if (!['string', 'function'].includes(typeof msg)) - throw new Error("An invalid error message key was used: " + key + "."); - if (typeof msg === 'function') - return msg.apply(void 0, args); - if (args === undefined || args.length === 0) - return msg; - args.unshift(msg); - return String.apply(void 0, args); -} -/** - * Register an error code and message. - * @param sym Unique name for the error - * @param val Value of the error - */ -function register(sym, val) { - exports.messages.set(sym, typeof val === 'function' ? val : String(val)); -} -exports.register = register; -var messageObject = { - INVALID_POSTER_OPTIONS: 'An object is required a parameter to construct a poster.', - NO_CLIENT_OR_ID: 'clientID must be defined when client is non-existant.', - UNKNOWN_CLIENT: function (count_name) { - return "Can't retrieve " + count_name + " count from non-existant client."; - }, - NO_CLIENT: function (count_name) { - return "Can't retrieve " + count_name + " count from unknown client."; - }, - NO_API_KEYS: "Can't post with a poster that has no API keys.", - SERVICE_NO_KEY: function (service) { - return "Can't post to \"" + service + "\" without an API key."; - }, - INVALID_SERVICE: function (service) { return "\"" + service + "\" is an invalid service."; }, - HANDLER_INVALID: 'Given handler is not a PromiseResolvable.', - UNSUPPORTED_EVENT: function (action) { - return "Can't " + action + " handler for an unsupported event."; - }, - CALLED_FROM_BASE: 'This function needs to be called by an extended class.', - REQUIRES_TOKEN: 'This endpoint requires a token.', - POSTING_UNSUPPORTED: function (service) { - return "The service " + service + " does not support posting."; - }, - INVALID_ID: 'An invalid ID was given.', - INVALID_COUNT: 'An invalid countable number was given.', - COUNT_NEGATIVE: 'A countable number cannot be negative.', - GENERIC: function (err) { return err; } -}; -for (var _i = 0, _a = Object.entries(messageObject); _i < _a.length; _i++) { - var _b = _a[_i], name_1 = _b[0], message_1 = _b[1]; - register(name_1, message_1); -} -exports.errors = { - Error: makeDbotsError(Error), - TypeError: makeDbotsError(TypeError), - RangeError: makeDbotsError(RangeError) -}; diff --git a/lib/Utils/EnsurePromise.d.ts b/lib/Utils/EnsurePromise.d.ts deleted file mode 100644 index d62edb27..00000000 --- a/lib/Utils/EnsurePromise.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { eventHandler } from './Constants'; -/** A generic string callback */ -export declare type stringCallback = (...args: any[]) => string; -/** Data that can be resolved to give a string. This can either be a Function or a Promise. */ -export declare type PromiseResolvable = stringCallback | eventHandler | Promise; -export declare function ensurePromise(func: ((...args: any[]) => T) | Promise, ...args: any[]): Promise | undefined; diff --git a/lib/Utils/EnsurePromise.js b/lib/Utils/EnsurePromise.js deleted file mode 100644 index 316eb18e..00000000 --- a/lib/Utils/EnsurePromise.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ensurePromise = void 0; -function ensurePromise(func) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - if (typeof func === 'function') - return new Promise(function (resolve) { return resolve(func.apply(void 0, args)); }); - else if (func instanceof Promise) - return func; -} -exports.ensurePromise = ensurePromise; diff --git a/lib/Utils/FormatRequest.d.ts b/lib/Utils/FormatRequest.d.ts deleted file mode 100644 index 25ad72f5..00000000 --- a/lib/Utils/FormatRequest.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { AxiosRequestConfig, AxiosResponse } from 'axios'; -/** - * The response from the axios call - * @see {@link https://github.com/axios/axios#response-schema} - */ -export { AxiosResponse } from 'axios'; -/** - * @private - */ -export interface RequestForm { - /** The method to use */ - method?: AxiosRequestConfig['method']; - /** The URL for the request */ - url: string; - /** The headers to append to the request */ - headers?: Record; - /** The data to send with the request, if the method allows it */ - data?: Record; - /** The query parameters for the request */ - params?: Record; -} -/** - * Returns a request. - * @param opts An object containing the config for the request: only basic properties are documented, but all [Axios](https://github.com/axios/axios#request-config) parameters are valid - * @returns The request - */ -export declare function formatRequest(options: RequestForm): Promise; diff --git a/lib/Utils/FormatRequest.js b/lib/Utils/FormatRequest.js deleted file mode 100644 index 4e856a89..00000000 --- a/lib/Utils/FormatRequest.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.formatRequest = void 0; -var axios_1 = __importDefault(require("axios")); -var Constants_1 = require("./Constants"); -/** - * Returns a request. - * @param opts An object containing the config for the request: only basic properties are documented, but all [Axios](https://github.com/axios/axios#request-config) parameters are valid - * @returns The request - */ -function formatRequest(options) { - var opts = options; - if (!opts.method) - opts.method = 'get'; - // This is no longer needed, because the types enforce the correct properties - // if (opts.body) { - // opts.data = opts.body - // delete opts.body - // } - // if (opts.query) { - // opts.params = opts.query - // delete opts.query - // } - var userAgent = "dbots (https://github.com/dbots-pkg/dbots.js " + Constants_1.Package.version + ") Node.js/" + process.version; - if (!opts.headers) - opts.headers = { - 'User-Agent': userAgent - }; - else if (!opts.headers['User-Agent']) - opts.headers['User-Agent'] = userAgent; - return axios_1.default(opts); -} -exports.formatRequest = formatRequest; diff --git a/lib/Utils/Util.d.ts b/lib/Utils/Util.d.ts deleted file mode 100644 index c0bceba8..00000000 --- a/lib/Utils/Util.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Data that can be resolved to give a Discord ID, this can be: - * * A string - * * A number - * * Any value with an `id` key - */ -export declare type IDResolvable = string | number | Record<'id', string>; -/** - * Data that can be resolved to give a finite and positive integer. - * This can include any value that can be parsed into an integer. - */ -export declare type CountResolvable = any; -/** Just a utility type representing an object */ -export declare type AnyObject = Record; -/** - * Enforces a type on its argument - * @private - */ -export declare function assert(value: any): asserts value is T; -/** - * Contains various general-purpose utility methods. - */ -export declare class Util { - constructor(); - /** - * Resolves data into a Discord ID. - * @param data The data to resolve - */ - static resolveID(data: IDResolvable): string; - /** - * Resolves data into a countable number that is finite and positive. - * @param data The data to resolve - */ - static resolveCount(data: CountResolvable): number; -} diff --git a/lib/Utils/Util.js b/lib/Utils/Util.js deleted file mode 100644 index b6dd923c..00000000 --- a/lib/Utils/Util.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Util = exports.assert = void 0; -var DBotsError_1 = require("./DBotsError"); -var DBotsError = DBotsError_1.errors.Error, RangeError = DBotsError_1.errors.RangeError, TypeError = DBotsError_1.errors.TypeError; -/** - * Enforces a type on its argument - * @private - */ -function assert(value) { } -exports.assert = assert; -/** - * Contains various general-purpose utility methods. - */ -var Util = /** @class */ (function () { - function Util() { - throw new Error("The " + this.constructor.name + " class may not be instantiated."); - } - /** - * Resolves data into a Discord ID. - * @param data The data to resolve - */ - Util.resolveID = function (data) { - if (typeof data === 'undefined' || data === null) - throw new DBotsError('INVALID_ID'); - var id = null; - if (typeof data === 'string') - id = data; - else if (typeof data === 'number') - id = String(data); - else if (typeof data === 'object' && - Object.prototype.hasOwnProperty.call(data, 'id') && - typeof data.id !== 'object') - return Util.resolveID(data.id); - else - throw new DBotsError('INVALID_ID'); - if (/^\d{17,19}$/.test(id)) - return id; - else - throw new DBotsError('INVALID_ID'); - }; - /** - * Resolves data into a countable number that is finite and positive. - * @param data The data to resolve - */ - Util.resolveCount = function (data) { - var count = parseInt(data); - if (isNaN(count)) - throw new TypeError('INVALID_COUNT'); - else if (count < 0) - throw new RangeError('COUNT_NEGATIVE'); - return count; - }; - return Util; -}()); -exports.Util = Util; diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index 626f0ebb..00000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Service } from './Interface/Service'; -export { Poster } from './Interface/Poster'; -export * as Constants from './Utils/Constants'; -export * as DBotsError from './Utils/DBotsError'; -export { ensurePromise } from './Utils/EnsurePromise'; -export { formatRequest } from './Utils/FormatRequest'; -export * as Util from './Utils/Util'; -export { Service }; -export declare const getService: typeof Service.get; -export declare const serviceClasses: Record; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index eb1bd8cc..00000000 --- a/lib/index.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.serviceClasses = exports.getService = exports.Service = exports.Util = exports.formatRequest = exports.ensurePromise = exports.DBotsError = exports.Constants = exports.Poster = void 0; -var Service_1 = require("./Interface/Service"); -Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return Service_1.Service; } }); -var Poster_1 = require("./Interface/Poster"); -Object.defineProperty(exports, "Poster", { enumerable: true, get: function () { return Poster_1.Poster; } }); -exports.Constants = __importStar(require("./Utils/Constants")); -exports.DBotsError = __importStar(require("./Utils/DBotsError")); -var EnsurePromise_1 = require("./Utils/EnsurePromise"); -Object.defineProperty(exports, "ensurePromise", { enumerable: true, get: function () { return EnsurePromise_1.ensurePromise; } }); -var FormatRequest_1 = require("./Utils/FormatRequest"); -Object.defineProperty(exports, "formatRequest", { enumerable: true, get: function () { return FormatRequest_1.formatRequest; } }); -exports.Util = __importStar(require("./Utils/Util")); -exports.getService = Service_1.Service.get; -exports.serviceClasses = Service_1.Service.getAll(); From 331257298e18c75029fa62e1f60da0b1b1fa1b7e Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Thu, 25 Mar 2021 09:04:00 +0100 Subject: [PATCH 04/10] test(Poster): fix tests for new discord.js client filler --- package-lock.json | 13 +++++++++++++ package.json | 1 + tests/Interface/Poster.test.ts | 21 ++++++++++++++++----- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f1a74d5..8af7a49d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "promise.allsettled": "^1.0.2" }, "devDependencies": { + "@discordjs/collection": "^0.1.6", "@types/jest": "^26.0.15", "@types/node": "^14.0.5", "@types/promise.allsettled": "^1.0.3", @@ -536,6 +537,12 @@ "node": ">=0.1.95" } }, + "node_modules/@discordjs/collection": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", + "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==", + "dev": true + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz", @@ -12352,6 +12359,12 @@ "minimist": "^1.2.0" } }, + "@discordjs/collection": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", + "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==", + "dev": true + }, "@discoveryjs/json-ext": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz", diff --git a/package.json b/package.json index 33651b56..7fcf1f39 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "promise.allsettled": "^1.0.2" }, "devDependencies": { + "@discordjs/collection": "^0.1.6", "@types/jest": "^26.0.15", "@types/node": "^14.0.5", "@types/promise.allsettled": "^1.0.3", diff --git a/tests/Interface/Poster.test.ts b/tests/Interface/Poster.test.ts index ae198321..31630bee 100644 --- a/tests/Interface/Poster.test.ts +++ b/tests/Interface/Poster.test.ts @@ -1,3 +1,4 @@ +import Collection from '@discordjs/collection' import * as PosterModule from '../../src/Interface/Poster' import { Service } from '../../src/Interface/Service' import TopGG from '../../src/Interface/Lists/TopGG' @@ -6,6 +7,11 @@ import { PosterOptions } from '../../src/Utils/Constants' describe('Poster module', () => { describe('Poster class', () => { const { Poster } = PosterModule + const fakeClientGuilds = new Collection( + Array(123) + .fill('a') + .map((_value, index) => [index, { memberCount: 2 }]) as [number, any][] + ) describe('constructor', () => { it('should throw when instatiated without options', () => { @@ -109,12 +115,17 @@ describe('Poster module', () => { expect(fn).toHaveBeenCalled() }) - it('should use the clientFiller', () => { + it('should use the clientFiller', (done) => { const p = new Poster({ - client: { users: { size: 123 } }, + client: { guilds: fakeClientGuilds }, clientLibrary: 'discord.js' }) - expect(p.getUserCount()).resolves.toBe(123) + p.getUserCount() + .then((res) => { + expect(res).toBe(123 * 2) + done() + }) + .catch(() => done.fail()) }) it('should default to 0', () => { @@ -219,7 +230,7 @@ describe('Poster module', () => { describe('post method', () => { const p = new Poster({ client: { - guilds: { size: 123 }, + guilds: fakeClientGuilds, users: { size: 456 }, broadcasts: { size: 789 } }, @@ -242,7 +253,7 @@ describe('Poster module', () => { await p.post('service') expect(p.postManual).toHaveBeenLastCalledWith('service', { serverCount: 123, - userCount: 456, + userCount: 123 * 2, voiceConnections: 789 }) }) From 0bd64121ba4b6451d0d58e93cdcfe37d57fdc680 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Thu, 25 Mar 2021 09:54:26 -0500 Subject: [PATCH 05/10] fix: Use member count for all client fillers --- lib/Interface/ClientFiller.d.ts | 30 ++ lib/Interface/ClientFiller.js | 93 ++++++ lib/Interface/Clients/DiscordIO.d.ts | 13 + lib/Interface/Clients/DiscordIO.js | 79 +++++ lib/Interface/Clients/DiscordJS.d.ts | 13 + lib/Interface/Clients/DiscordJS.js | 83 +++++ lib/Interface/Clients/Discordie.d.ts | 13 + lib/Interface/Clients/Discordie.js | 75 +++++ lib/Interface/Clients/Eris.d.ts | 16 + lib/Interface/Clients/Eris.js | 78 +++++ lib/Interface/Clients/Paracord.d.ts | 20 ++ lib/Interface/Clients/Paracord.js | 75 +++++ lib/Interface/Lists/Arcane.d.ts | 22 ++ lib/Interface/Lists/Arcane.js | 93 ++++++ lib/Interface/Lists/AstroBotList.d.ts | 24 ++ lib/Interface/Lists/AstroBotList.js | 95 ++++++ lib/Interface/Lists/BladeBotList.d.ts | 34 ++ lib/Interface/Lists/BladeBotList.js | 106 ++++++ lib/Interface/Lists/Blist.d.ts | 65 ++++ lib/Interface/Lists/Blist.js | 152 +++++++++ lib/Interface/Lists/BotListSpace.d.ts | 58 ++++ lib/Interface/Lists/BotListSpace.js | 141 ++++++++ lib/Interface/Lists/BotsDataBase.d.ts | 39 +++ lib/Interface/Lists/BotsDataBase.js | 112 +++++++ lib/Interface/Lists/BotsForDiscord.d.ts | 51 +++ lib/Interface/Lists/BotsForDiscord.js | 121 +++++++ lib/Interface/Lists/BotsOnDiscord.d.ts | 37 +++ lib/Interface/Lists/BotsOnDiscord.js | 107 +++++++ lib/Interface/Lists/Carbon.d.ts | 24 ++ lib/Interface/Lists/Carbon.js | 87 +++++ lib/Interface/Lists/DBots.d.ts | 34 ++ lib/Interface/Lists/DBots.js | 105 ++++++ lib/Interface/Lists/DiscordAppsDev.d.ts | 41 +++ lib/Interface/Lists/DiscordAppsDev.js | 119 +++++++ lib/Interface/Lists/DiscordBoats.d.ts | 47 +++ lib/Interface/Lists/DiscordBoats.js | 118 +++++++ lib/Interface/Lists/DiscordBotDirectory.d.ts | 30 ++ lib/Interface/Lists/DiscordBotDirectory.js | 93 ++++++ lib/Interface/Lists/DiscordBotList.d.ts | 22 ++ lib/Interface/Lists/DiscordBotList.js | 91 ++++++ lib/Interface/Lists/DiscordBotsCo.d.ts | 28 ++ lib/Interface/Lists/DiscordBotsCo.js | 104 ++++++ lib/Interface/Lists/DiscordBotsGG.d.ts | 55 ++++ lib/Interface/Lists/DiscordBotsGG.js | 147 +++++++++ lib/Interface/Lists/DiscordExtremeList.d.ts | 35 ++ lib/Interface/Lists/DiscordExtremeList.js | 120 +++++++ lib/Interface/Lists/DiscordLabs.d.ts | 28 ++ lib/Interface/Lists/DiscordLabs.js | 99 ++++++ lib/Interface/Lists/DiscordListology.d.ts | 45 +++ lib/Interface/Lists/DiscordListology.js | 123 +++++++ lib/Interface/Lists/DiscordServices.d.ts | 45 +++ lib/Interface/Lists/DiscordServices.js | 120 +++++++ lib/Interface/Lists/Disforge.d.ts | 31 ++ lib/Interface/Lists/Disforge.js | 101 ++++++ lib/Interface/Lists/GlennBotList.d.ts | 45 +++ lib/Interface/Lists/GlennBotList.js | 121 +++++++ lib/Interface/Lists/InfinityBots.d.ts | 33 ++ lib/Interface/Lists/InfinityBots.js | 119 +++++++ lib/Interface/Lists/ListMyBots.d.ts | 52 +++ lib/Interface/Lists/ListMyBots.js | 122 +++++++ lib/Interface/Lists/ParadiseBots.d.ts | 28 ++ lib/Interface/Lists/ParadiseBots.js | 108 +++++++ lib/Interface/Lists/SpaceBotsList.d.ts | 29 ++ lib/Interface/Lists/SpaceBotsList.js | 95 ++++++ lib/Interface/Lists/TopCord.d.ts | 32 ++ lib/Interface/Lists/TopCord.js | 102 ++++++ lib/Interface/Lists/TopGG.d.ts | 62 ++++ lib/Interface/Lists/TopGG.js | 159 +++++++++ lib/Interface/Lists/VoidBots.d.ts | 44 +++ lib/Interface/Lists/VoidBots.js | 134 ++++++++ lib/Interface/Lists/WonderBotList.d.ts | 33 ++ lib/Interface/Lists/WonderBotList.js | 110 +++++++ lib/Interface/Lists/YABL.d.ts | 48 +++ lib/Interface/Lists/YABL.js | 137 ++++++++ lib/Interface/Poster.d.ts | 100 ++++++ lib/Interface/Poster.js | 319 +++++++++++++++++++ lib/Interface/Service.d.ts | 89 ++++++ lib/Interface/Service.js | 183 +++++++++++ lib/Utils/Constants.d.ts | 111 +++++++ lib/Utils/Constants.js | 10 + lib/Utils/DBotsError.d.ts | 64 ++++ lib/Utils/DBotsError.js | 143 +++++++++ lib/Utils/EnsurePromise.d.ts | 6 + lib/Utils/EnsurePromise.js | 14 + lib/Utils/FormatRequest.d.ts | 27 ++ lib/Utils/FormatRequest.js | 36 +++ lib/Utils/Util.d.ts | 35 ++ lib/Utils/Util.js | 56 ++++ lib/index.d.ts | 10 + lib/index.js | 35 ++ src/Interface/ClientFiller.ts | 2 +- src/Interface/Clients/DiscordIO.ts | 10 +- src/Interface/Clients/Discordie.ts | 8 +- src/Interface/Clients/Eris.ts | 6 +- src/Interface/Clients/Paracord.ts | 6 +- 95 files changed, 6613 insertions(+), 7 deletions(-) create mode 100644 lib/Interface/ClientFiller.d.ts create mode 100644 lib/Interface/ClientFiller.js create mode 100644 lib/Interface/Clients/DiscordIO.d.ts create mode 100644 lib/Interface/Clients/DiscordIO.js create mode 100644 lib/Interface/Clients/DiscordJS.d.ts create mode 100644 lib/Interface/Clients/DiscordJS.js create mode 100644 lib/Interface/Clients/Discordie.d.ts create mode 100644 lib/Interface/Clients/Discordie.js create mode 100644 lib/Interface/Clients/Eris.d.ts create mode 100644 lib/Interface/Clients/Eris.js create mode 100644 lib/Interface/Clients/Paracord.d.ts create mode 100644 lib/Interface/Clients/Paracord.js create mode 100644 lib/Interface/Lists/Arcane.d.ts create mode 100644 lib/Interface/Lists/Arcane.js create mode 100644 lib/Interface/Lists/AstroBotList.d.ts create mode 100644 lib/Interface/Lists/AstroBotList.js create mode 100644 lib/Interface/Lists/BladeBotList.d.ts create mode 100644 lib/Interface/Lists/BladeBotList.js create mode 100644 lib/Interface/Lists/Blist.d.ts create mode 100644 lib/Interface/Lists/Blist.js create mode 100644 lib/Interface/Lists/BotListSpace.d.ts create mode 100644 lib/Interface/Lists/BotListSpace.js create mode 100644 lib/Interface/Lists/BotsDataBase.d.ts create mode 100644 lib/Interface/Lists/BotsDataBase.js create mode 100644 lib/Interface/Lists/BotsForDiscord.d.ts create mode 100644 lib/Interface/Lists/BotsForDiscord.js create mode 100644 lib/Interface/Lists/BotsOnDiscord.d.ts create mode 100644 lib/Interface/Lists/BotsOnDiscord.js create mode 100644 lib/Interface/Lists/Carbon.d.ts create mode 100644 lib/Interface/Lists/Carbon.js create mode 100644 lib/Interface/Lists/DBots.d.ts create mode 100644 lib/Interface/Lists/DBots.js create mode 100644 lib/Interface/Lists/DiscordAppsDev.d.ts create mode 100644 lib/Interface/Lists/DiscordAppsDev.js create mode 100644 lib/Interface/Lists/DiscordBoats.d.ts create mode 100644 lib/Interface/Lists/DiscordBoats.js create mode 100644 lib/Interface/Lists/DiscordBotDirectory.d.ts create mode 100644 lib/Interface/Lists/DiscordBotDirectory.js create mode 100644 lib/Interface/Lists/DiscordBotList.d.ts create mode 100644 lib/Interface/Lists/DiscordBotList.js create mode 100644 lib/Interface/Lists/DiscordBotsCo.d.ts create mode 100644 lib/Interface/Lists/DiscordBotsCo.js create mode 100644 lib/Interface/Lists/DiscordBotsGG.d.ts create mode 100644 lib/Interface/Lists/DiscordBotsGG.js create mode 100644 lib/Interface/Lists/DiscordExtremeList.d.ts create mode 100644 lib/Interface/Lists/DiscordExtremeList.js create mode 100644 lib/Interface/Lists/DiscordLabs.d.ts create mode 100644 lib/Interface/Lists/DiscordLabs.js create mode 100644 lib/Interface/Lists/DiscordListology.d.ts create mode 100644 lib/Interface/Lists/DiscordListology.js create mode 100644 lib/Interface/Lists/DiscordServices.d.ts create mode 100644 lib/Interface/Lists/DiscordServices.js create mode 100644 lib/Interface/Lists/Disforge.d.ts create mode 100644 lib/Interface/Lists/Disforge.js create mode 100644 lib/Interface/Lists/GlennBotList.d.ts create mode 100644 lib/Interface/Lists/GlennBotList.js create mode 100644 lib/Interface/Lists/InfinityBots.d.ts create mode 100644 lib/Interface/Lists/InfinityBots.js create mode 100644 lib/Interface/Lists/ListMyBots.d.ts create mode 100644 lib/Interface/Lists/ListMyBots.js create mode 100644 lib/Interface/Lists/ParadiseBots.d.ts create mode 100644 lib/Interface/Lists/ParadiseBots.js create mode 100644 lib/Interface/Lists/SpaceBotsList.d.ts create mode 100644 lib/Interface/Lists/SpaceBotsList.js create mode 100644 lib/Interface/Lists/TopCord.d.ts create mode 100644 lib/Interface/Lists/TopCord.js create mode 100644 lib/Interface/Lists/TopGG.d.ts create mode 100644 lib/Interface/Lists/TopGG.js create mode 100644 lib/Interface/Lists/VoidBots.d.ts create mode 100644 lib/Interface/Lists/VoidBots.js create mode 100644 lib/Interface/Lists/WonderBotList.d.ts create mode 100644 lib/Interface/Lists/WonderBotList.js create mode 100644 lib/Interface/Lists/YABL.d.ts create mode 100644 lib/Interface/Lists/YABL.js create mode 100644 lib/Interface/Poster.d.ts create mode 100644 lib/Interface/Poster.js create mode 100644 lib/Interface/Service.d.ts create mode 100644 lib/Interface/Service.js create mode 100644 lib/Utils/Constants.d.ts create mode 100644 lib/Utils/Constants.js create mode 100644 lib/Utils/DBotsError.d.ts create mode 100644 lib/Utils/DBotsError.js create mode 100644 lib/Utils/EnsurePromise.d.ts create mode 100644 lib/Utils/EnsurePromise.js create mode 100644 lib/Utils/FormatRequest.d.ts create mode 100644 lib/Utils/FormatRequest.js create mode 100644 lib/Utils/Util.d.ts create mode 100644 lib/Utils/Util.js create mode 100644 lib/index.d.ts create mode 100644 lib/index.js diff --git a/lib/Interface/ClientFiller.d.ts b/lib/Interface/ClientFiller.d.ts new file mode 100644 index 00000000..733dcc26 --- /dev/null +++ b/lib/Interface/ClientFiller.d.ts @@ -0,0 +1,30 @@ +import { Library, Shard } from '../Utils/Constants'; +import { AnyObject } from '../Utils/Util'; +/** + * A class that gets certain values from a client. + * @private + */ +export declare class ClientFiller { + /** The client that will be used for the filler. */ + client: AnyObject; + /** + * @param client The client that will be used + */ + constructor(client: object); + /** Gets the amount of users the bot can reach. */ + get userCount(): number | undefined; + /** Gets the amount of servers the bot has cached. */ + get serverCount(): number | undefined; + /** Gets the amount of voice connectinos the bot is using. */ + get voiceConnections(): number | undefined; + /** Gets the client ID (technically the user ID) of the bot. */ + get clientID(): string | undefined; + /** Gets the shard of the bot. */ + get shard(): Shard | undefined; +} +/** + * Gets a client filler from a library. + * @param libraryName The name of the library to get + * @param client The client that the library made + */ +export declare function getClientFiller(libraryName: Library, client: object): ClientFiller; diff --git a/lib/Interface/ClientFiller.js b/lib/Interface/ClientFiller.js new file mode 100644 index 00000000..09cdd7bb --- /dev/null +++ b/lib/Interface/ClientFiller.js @@ -0,0 +1,93 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getClientFiller = exports.ClientFiller = void 0; +var DBotsError_1 = require("../Utils/DBotsError"); +/** + * A class that gets certain values from a client. + * @private + */ +var ClientFiller = /** @class */ (function () { + /** + * @param client The client that will be used + */ + function ClientFiller(client) { + if (!client || typeof client != 'object') + throw new DBotsError_1.errors.Error('UNKNOWN_CLIENT'); + this.client = client; + } + Object.defineProperty(ClientFiller.prototype, "userCount", { + /** Gets the amount of users the bot can reach. */ + get: function () { + return 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ClientFiller.prototype, "serverCount", { + /** Gets the amount of servers the bot has cached. */ + get: function () { + return 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ClientFiller.prototype, "voiceConnections", { + /** Gets the amount of voice connectinos the bot is using. */ + get: function () { + return 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ClientFiller.prototype, "clientID", { + /** Gets the client ID (technically the user ID) of the bot. */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ClientFiller.prototype, "shard", { + /** Gets the shard of the bot. */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + return ClientFiller; +}()); +exports.ClientFiller = ClientFiller; +/** + * Gets a client filler from a library. + * @param libraryName The name of the library to get + * @param client The client that the library made + */ +function getClientFiller(libraryName, client) { + if (!client) + throw new Error('No client was provided!'); + switch (libraryName) { + case 'discordie': { + return new (require('./Clients/Discordie') + .default)(client); + } + case 'discord.io': { + return new (require('./Clients/DiscordIO') + .default)(client); + } + case 'discord.js': { + return new (require('./Clients/DiscordJS') + .default)(client); + } + case 'eris': { + return new (require('./Clients/Eris').default)(client); + } + case 'paracord': { + return new (require('./Clients/Paracord').default)(client); + } + default: { + throw new Error("Unknown client '" + libraryName + "'"); + } + } +} +exports.getClientFiller = getClientFiller; diff --git a/lib/Interface/Clients/DiscordIO.d.ts b/lib/Interface/Clients/DiscordIO.d.ts new file mode 100644 index 00000000..6426dc3d --- /dev/null +++ b/lib/Interface/Clients/DiscordIO.d.ts @@ -0,0 +1,13 @@ +import { Shard } from '../../Utils/Constants'; +import { ClientFiller } from '../ClientFiller'; +/** + * Represents the client filler for discord.io clients. + * @private + */ +export default class DiscordIO extends ClientFiller { + get userCount(): any; + get serverCount(): number | undefined; + get voiceConnections(): number | undefined; + get clientID(): string | undefined; + get shard(): Shard | undefined; +} diff --git a/lib/Interface/Clients/DiscordIO.js b/lib/Interface/Clients/DiscordIO.js new file mode 100644 index 00000000..ee8a037e --- /dev/null +++ b/lib/Interface/Clients/DiscordIO.js @@ -0,0 +1,79 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ClientFiller_1 = require("../ClientFiller"); +/** + * Represents the client filler for discord.io clients. + * @private + */ +var DiscordIO = /** @class */ (function (_super) { + __extends(DiscordIO, _super); + function DiscordIO() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordIO.prototype, "userCount", { + get: function () { + var _this = this; + if (!this.client.servers) + return undefined; + return Object.keys(this.client.servers) + .map(function (id) { return _this.client.servers[id]; }) + .reduce(function (count, guild) { return count + guild.member_count; }, 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordIO.prototype, "serverCount", { + get: function () { + if (!this.client.servers) + return undefined; + return Object.keys(this.client.servers).length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordIO.prototype, "voiceConnections", { + get: function () { + if (!this.client._vChannels) + return undefined; + return Object.keys(this.client._vChannels).length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordIO.prototype, "clientID", { + get: function () { + return this.client.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordIO.prototype, "shard", { + get: function () { + return this.client._shard + ? { + id: this.client._shard[0], + count: this.client._shard[1] + } + : undefined; + }, + enumerable: false, + configurable: true + }); + return DiscordIO; +}(ClientFiller_1.ClientFiller)); +exports.default = DiscordIO; diff --git a/lib/Interface/Clients/DiscordJS.d.ts b/lib/Interface/Clients/DiscordJS.d.ts new file mode 100644 index 00000000..140f52ca --- /dev/null +++ b/lib/Interface/Clients/DiscordJS.d.ts @@ -0,0 +1,13 @@ +import { Shard } from '../../Utils/Constants'; +import { ClientFiller } from '../ClientFiller'; +/** + * Represents the client filler for discord.js clients. + * @private + */ +export default class DiscordJS extends ClientFiller { + get userCount(): number; + get serverCount(): number; + get voiceConnections(): number; + get clientID(): string | undefined; + get shard(): Shard | undefined; +} diff --git a/lib/Interface/Clients/DiscordJS.js b/lib/Interface/Clients/DiscordJS.js new file mode 100644 index 00000000..f0792003 --- /dev/null +++ b/lib/Interface/Clients/DiscordJS.js @@ -0,0 +1,83 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ClientFiller_1 = require("../ClientFiller"); +/** + * Represents the client filler for discord.js clients. + * @private + */ +var DiscordJS = /** @class */ (function (_super) { + __extends(DiscordJS, _super); + function DiscordJS() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordJS.prototype, "userCount", { + get: function () { + var _a, _b, _c, _d, _e; + if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') + return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.reduce(function (count, guild) { return count + guild.memberCount; }, 0); + else + return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.reduce(function (count, guild) { return count + guild.memberCount; }, 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordJS.prototype, "serverCount", { + get: function () { + var _a, _b, _c, _d, _e; + if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') + return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.size; + else + return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordJS.prototype, "voiceConnections", { + get: function () { + var _a, _b; + if (this.client.voice) + return ((_a = this.client.voice.broadcasts) === null || _a === void 0 ? void 0 : _a.length) || 0; + else + return (_b = this.client.broadcasts) === null || _b === void 0 ? void 0 : _b.size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordJS.prototype, "clientID", { + get: function () { + var _a; + return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordJS.prototype, "shard", { + get: function () { + return this.client.shard + ? { + id: this.client.shard.id, + count: this.client.shard.count + } + : undefined; + }, + enumerable: false, + configurable: true + }); + return DiscordJS; +}(ClientFiller_1.ClientFiller)); +exports.default = DiscordJS; diff --git a/lib/Interface/Clients/Discordie.d.ts b/lib/Interface/Clients/Discordie.d.ts new file mode 100644 index 00000000..41bb3741 --- /dev/null +++ b/lib/Interface/Clients/Discordie.d.ts @@ -0,0 +1,13 @@ +import { Shard } from '../../Utils/Constants'; +import { ClientFiller } from '../ClientFiller'; +/** + * Represents the client filler for discordie clients. + * @private + */ +export default class Discordie extends ClientFiller { + get userCount(): number; + get serverCount(): number; + get voiceConnections(): number; + get clientID(): string | undefined; + get shard(): Shard | undefined; +} diff --git a/lib/Interface/Clients/Discordie.js b/lib/Interface/Clients/Discordie.js new file mode 100644 index 00000000..9e8bd909 --- /dev/null +++ b/lib/Interface/Clients/Discordie.js @@ -0,0 +1,75 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ClientFiller_1 = require("../ClientFiller"); +/** + * Represents the client filler for discordie clients. + * @private + */ +var Discordie = /** @class */ (function (_super) { + __extends(Discordie, _super); + function Discordie() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Discordie.prototype, "userCount", { + get: function () { + var _a; + return (_a = this.client.Guilds) === null || _a === void 0 ? void 0 : _a.toArray().reduce(function (count, guild) { return count + guild.member_count; }, 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Discordie.prototype, "serverCount", { + get: function () { + var _a; + return (_a = this.client.Guilds) === null || _a === void 0 ? void 0 : _a.size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Discordie.prototype, "voiceConnections", { + get: function () { + var _a; + return (_a = this.client.VoiceConnections) === null || _a === void 0 ? void 0 : _a.length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Discordie.prototype, "clientID", { + get: function () { + var _a; + return (_a = this.client.User) === null || _a === void 0 ? void 0 : _a.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Discordie.prototype, "shard", { + get: function () { + var _a, _b; + return ((_a = this.client.options) === null || _a === void 0 ? void 0 : _a.shardId) && ((_b = this.client.options) === null || _b === void 0 ? void 0 : _b.shardCount) + ? { + id: this.client.options.shardId, + count: this.client.options.shardCount + } + : undefined; + }, + enumerable: false, + configurable: true + }); + return Discordie; +}(ClientFiller_1.ClientFiller)); +exports.default = Discordie; diff --git a/lib/Interface/Clients/Eris.d.ts b/lib/Interface/Clients/Eris.d.ts new file mode 100644 index 00000000..3d5e3309 --- /dev/null +++ b/lib/Interface/Clients/Eris.d.ts @@ -0,0 +1,16 @@ +import { ClientFiller } from '../ClientFiller'; +/** + * Represents the client filler for Eris clients. + * @private + */ +export default class Eris extends ClientFiller { + get userCount(): number; + get serverCount(): number; + get voiceConnections(): number; + get clientID(): string | undefined; + /** + * This client does not natively support sharding. + * @private + */ + get shard(): undefined; +} diff --git a/lib/Interface/Clients/Eris.js b/lib/Interface/Clients/Eris.js new file mode 100644 index 00000000..0c437440 --- /dev/null +++ b/lib/Interface/Clients/Eris.js @@ -0,0 +1,78 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ClientFiller_1 = require("../ClientFiller"); +/** + * Represents the client filler for Eris clients. + * @private + */ +var Eris = /** @class */ (function (_super) { + __extends(Eris, _super); + function Eris() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Eris.prototype, "userCount", { + get: function () { + var _a; + return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.reduce(function (count, guild) { return count + guild.memberCount; }, 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Eris.prototype, "serverCount", { + get: function () { + var _a; + return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Eris.prototype, "voiceConnections", { + get: function () { + var _a, _b, _c, _d; + if (((_b = (_a = this.client.voiceConnections) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === + 'VoiceConnectionManager') + return (_c = this.client.voiceConnections) === null || _c === void 0 ? void 0 : _c.size; + else + return Object.keys(((_d = this.client.voiceConnections) === null || _d === void 0 ? void 0 : _d.pendingGuilds) || {}) + .length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Eris.prototype, "clientID", { + get: function () { + var _a; + return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Eris.prototype, "shard", { + /** + * This client does not natively support sharding. + * @private + */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + return Eris; +}(ClientFiller_1.ClientFiller)); +exports.default = Eris; diff --git a/lib/Interface/Clients/Paracord.d.ts b/lib/Interface/Clients/Paracord.d.ts new file mode 100644 index 00000000..6a73fe51 --- /dev/null +++ b/lib/Interface/Clients/Paracord.d.ts @@ -0,0 +1,20 @@ +import { ClientFiller } from '../ClientFiller'; +/** + * Represents the client filler for Paracord clients. + * @private + */ +export default class Paracord extends ClientFiller { + get userCount(): number; + get serverCount(): number; + /** + * This client does not yet support voice connections. + * @private + */ + get voiceConnections(): number; + get clientID(): string | undefined; + /** + * This client handles sharding in a way that is not supported by dbots in its current structure. + * @private + */ + get shard(): undefined; +} diff --git a/lib/Interface/Clients/Paracord.js b/lib/Interface/Clients/Paracord.js new file mode 100644 index 00000000..5f603478 --- /dev/null +++ b/lib/Interface/Clients/Paracord.js @@ -0,0 +1,75 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var ClientFiller_1 = require("../ClientFiller"); +/** + * Represents the client filler for Paracord clients. + * @private + */ +var Paracord = /** @class */ (function (_super) { + __extends(Paracord, _super); + function Paracord() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Paracord.prototype, "userCount", { + get: function () { + return Array.from(this.client.guilds.values).reduce(function (count, guild) { return count + guild.member_count; }, 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Paracord.prototype, "serverCount", { + get: function () { + var _a; + return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Paracord.prototype, "voiceConnections", { + /** + * This client does not yet support voice connections. + * @private + */ + get: function () { + return 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Paracord.prototype, "clientID", { + get: function () { + var _a; + return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Paracord.prototype, "shard", { + /** + * This client handles sharding in a way that is not supported by dbots in its current structure. + * @private + */ + get: function () { + return undefined; + }, + enumerable: false, + configurable: true + }); + return Paracord; +}(ClientFiller_1.ClientFiller)); +exports.default = Paracord; diff --git a/lib/Interface/Lists/Arcane.d.ts b/lib/Interface/Lists/Arcane.d.ts new file mode 100644 index 00000000..d5fee1df --- /dev/null +++ b/lib/Interface/Lists/Arcane.d.ts @@ -0,0 +1,22 @@ +import { Service, ServicePostOptions } from '../Service'; +/** + * Represents the Arcane Bot Center service. + * @see https://arcane-center.xyz/documentation + */ +export default class Arcane extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; +} diff --git a/lib/Interface/Lists/Arcane.js b/lib/Interface/Lists/Arcane.js new file mode 100644 index 00000000..3b8de6cb --- /dev/null +++ b/lib/Interface/Lists/Arcane.js @@ -0,0 +1,93 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Arcane Bot Center service. + * @see https://arcane-center.xyz/documentation + */ +var Arcane = /** @class */ (function (_super) { + __extends(Arcane, _super); + function Arcane() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Arcane, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['arcane', 'arcane-center.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Arcane, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://arcane-center.xyz/src/images/favicons/favicon.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Arcane, "serviceName", { + /** Service's name. */ + get: function () { + return 'Arcane Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Arcane, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://arcane-center.xyz'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Arcane, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://arcane-center.xyz/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + Arcane.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, userCount = options.userCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: shard + ? { + server_count: Util_1.Util.resolveCount(serverCount), + member_count: Util_1.Util.resolveCount(userCount), + shard_count: shard.count + } + : { + server_count: Util_1.Util.resolveCount(serverCount), + member_count: Util_1.Util.resolveCount(userCount) + } + }); + }; + return Arcane; +}(Service_1.Service)); +exports.default = Arcane; diff --git a/lib/Interface/Lists/AstroBotList.d.ts b/lib/Interface/Lists/AstroBotList.d.ts new file mode 100644 index 00000000..e60c0ea1 --- /dev/null +++ b/lib/Interface/Lists/AstroBotList.d.ts @@ -0,0 +1,24 @@ +import { Service, ServicePostOptions } from '../Service'; +/** + * Represents the Astro Bot List service. + * @see https://botlists.com/api/docs + */ +export default class AstroBotList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** Gets the stats of this bot. */ + getOwnStats(): Promise>; +} diff --git a/lib/Interface/Lists/AstroBotList.js b/lib/Interface/Lists/AstroBotList.js new file mode 100644 index 00000000..93b4a3d9 --- /dev/null +++ b/lib/Interface/Lists/AstroBotList.js @@ -0,0 +1,95 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Astro Bot List service. + * @see https://botlists.com/api/docs + */ +var AstroBotList = /** @class */ (function (_super) { + __extends(AstroBotList, _super); + function AstroBotList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(AstroBotList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['astrobotlist', 'botlists.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AstroBotList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://cdn.bot-list.xyz/7364djcas.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AstroBotList, "serviceName", { + /** Service's name. */ + get: function () { + return 'Astro Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AstroBotList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://botlists.com'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AstroBotList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://botlists.com/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + AstroBotList.post = function (options) { + var token = options.token, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: '/bot', + headers: { token: token }, + data: { + guild_count: Util_1.Util.resolveCount(serverCount) + } + }); + }; + /** Gets the stats of this bot. */ + AstroBotList.prototype.getOwnStats = function () { + return this._request({ + url: '/bot', + headers: { token: this.token } + }, { + requiresToken: true + }); + }; + return AstroBotList; +}(Service_1.Service)); +exports.default = AstroBotList; diff --git a/lib/Interface/Lists/BladeBotList.d.ts b/lib/Interface/Lists/BladeBotList.d.ts new file mode 100644 index 00000000..83de9872 --- /dev/null +++ b/lib/Interface/Lists/BladeBotList.d.ts @@ -0,0 +1,34 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the BladeBotList service. + * @see https://docs.bladebotlist.xyz/api/introduction.html + */ +export default class BladeBotList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Checks whether a user has given a vote to the bot + * @param botId The bot's ID + * @param userID The user's ID + */ + userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/BladeBotList.js b/lib/Interface/Lists/BladeBotList.js new file mode 100644 index 00000000..9031bdf8 --- /dev/null +++ b/lib/Interface/Lists/BladeBotList.js @@ -0,0 +1,106 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the BladeBotList service. + * @see https://docs.bladebotlist.xyz/api/introduction.html + */ +var BladeBotList = /** @class */ (function (_super) { + __extends(BladeBotList, _super); + function BladeBotList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(BladeBotList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['bladebotlist', 'bladebotlist.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BladeBotList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://bladebotlist.xyz/img/logo.svg'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BladeBotList, "serviceName", { + /** Service's name. */ + get: function () { + return 'BladeBotList'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BladeBotList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://bladebotlist.xyz'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BladeBotList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://bladebotlist.xyz/api/'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + BladeBotList.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats/", + headers: { Authorization: token }, + data: shard + ? { + server_count: Util_1.Util.resolveCount(serverCount), + shard_count: shard.count + } + : { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + BladeBotList.prototype.getBot = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + /** + * Checks whether a user has given a vote to the bot + * @param botId The bot's ID + * @param userID The user's ID + */ + BladeBotList.prototype.userVoted = function (botId, userID) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(botId) + "/votes/" + Util_1.Util.resolveID(userID) + }); + }; + return BladeBotList; +}(Service_1.Service)); +exports.default = BladeBotList; diff --git a/lib/Interface/Lists/Blist.d.ts b/lib/Interface/Lists/Blist.d.ts new file mode 100644 index 00000000..4a4e0035 --- /dev/null +++ b/lib/Interface/Lists/Blist.d.ts @@ -0,0 +1,65 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the Blist service. + * @see https://blist.xyz/docs/ + */ +export default class Blist extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the user's bots listed on this service. + * @param id The user's ID + */ + getUserBots(id: IDResolvable): Promise>; + /** + * Gets the user's servers listed on this service. + * @param id The user's ID + */ + getUserServers(id: IDResolvable): Promise>; + /** + * Gets the server listed on this service. + * @param id The server's ID + */ + getServer(id: IDResolvable): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + getBotVotes(id: IDResolvable): Promise>; + /** + * Gets the bot's reviews on this service. + * @param id The bot's ID + */ + getBotReviews(id: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, query: Query): string; +} diff --git a/lib/Interface/Lists/Blist.js b/lib/Interface/Lists/Blist.js new file mode 100644 index 00000000..971ccf82 --- /dev/null +++ b/lib/Interface/Lists/Blist.js @@ -0,0 +1,152 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Blist service. + * @see https://blist.xyz/docs/ + */ +var Blist = /** @class */ (function (_super) { + __extends(Blist, _super); + function Blist() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Blist, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['blist', 'blist.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Blist, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://blist.xyz/main_site/staticfiles/main/assets/blist.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Blist, "serviceName", { + /** Service's name. */ + get: function () { + return 'Blist'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Blist, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://blist.xyz'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Blist, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://blist.xyz/api/v2'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + Blist.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'patch', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats/", + headers: { Authorization: token }, + data: shard + ? { + server_count: Util_1.Util.resolveCount(serverCount), + shard_count: shard.count + } + : { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + Blist.prototype.getUser = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the user's bots listed on this service. + * @param id The user's ID + */ + Blist.prototype.getUserBots = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/bots" }); + }; + /** + * Gets the user's servers listed on this service. + * @param id The user's ID + */ + Blist.prototype.getUserServers = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/servers" }); + }; + /** + * Gets the server listed on this service. + * @param id The server's ID + */ + Blist.prototype.getServer = function (id) { + return this._request({ url: "/server/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + Blist.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + Blist.prototype.getBotVotes = function (id) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id) + "/votes", + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets the bot's reviews on this service. + * @param id The bot's ID + */ + Blist.prototype.getBotReviews = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) + "/reviews" }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + Blist.prototype.getWidgetURL = function (id, query) { + var actualQuery = Object.assign({ type: 'normal' }, query); + return this._appendQuery("/bot/" + Util_1.Util.resolveID(id) + "/widget", actualQuery); + }; + return Blist; +}(Service_1.Service)); +exports.default = Blist; diff --git a/lib/Interface/Lists/BotListSpace.d.ts b/lib/Interface/Lists/BotListSpace.d.ts new file mode 100644 index 00000000..966d8d48 --- /dev/null +++ b/lib/Interface/Lists/BotListSpace.d.ts @@ -0,0 +1,58 @@ +import { Service, ServicePostOptions } from '../Service'; +import { CountResolvable, IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the botlist.space service. + * @see https://docs.botlist.space/ + */ +export default class BotListSpace extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** Gets the statistics of this service. */ + getStatistics(): Promise>; + /** Gets a list of bots on this service. */ + getBots(): Promise>; + /** Gets the bot listed on this service. */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + getBotVotes(id: IDResolvable): Promise>; + /** + * Gets the uptime of a bot listed on this service. + * @param id The bot's ID + */ + getBotUptime(id: IDResolvable): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the user's bots listed for this service. + * @param id The user's ID + */ + getUserBots(id: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param style The style of the widget, cannot be zero + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, style?: CountResolvable, query?: Query): string; +} diff --git a/lib/Interface/Lists/BotListSpace.js b/lib/Interface/Lists/BotListSpace.js new file mode 100644 index 00000000..54928077 --- /dev/null +++ b/lib/Interface/Lists/BotListSpace.js @@ -0,0 +1,141 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the botlist.space service. + * @see https://docs.botlist.space/ + */ +var BotListSpace = /** @class */ (function (_super) { + __extends(BotListSpace, _super); + function BotListSpace() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(BotListSpace, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['botlistspace', 'botlist.space']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotListSpace, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://botlist.space/img/android-chrome-512x512.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotListSpace, "serviceName", { + /** Service's name. */ + get: function () { + return 'botlist.space'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotListSpace, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://botlist.space'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotListSpace, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.botlist.space/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + BotListSpace.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** Gets the statistics of this service. */ + BotListSpace.prototype.getStatistics = function () { + return this._request({ url: '/statistics' }); + }; + /** Gets a list of bots on this service. */ + BotListSpace.prototype.getBots = function () { + return this._request({ url: '/bots' }); + }; + /** Gets the bot listed on this service. */ + BotListSpace.prototype.getBot = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + BotListSpace.prototype.getBotVotes = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/upvotes", + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets the uptime of a bot listed on this service. + * @param id The bot's ID + */ + BotListSpace.prototype.getBotUptime = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) + "/uptime" }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + BotListSpace.prototype.getUser = function (id) { + return this._request({ url: "/users/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the user's bots listed for this service. + * @param id The user's ID + */ + BotListSpace.prototype.getUserBots = function (id) { + return this._request({ url: "/users/" + Util_1.Util.resolveID(id) + "/bots" }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param style The style of the widget, cannot be zero + * @param query The query string that will be used in the request + */ + BotListSpace.prototype.getWidgetURL = function (id, style, query) { + if (style === void 0) { style = 1; } + if (query === void 0) { query = {}; } + return this._appendQuery("https://api.botlist.space/widget/" + Util_1.Util.resolveID(id) + "/" + Util_1.Util.resolveCount(style), query, false); + }; + return BotListSpace; +}(Service_1.Service)); +exports.default = BotListSpace; diff --git a/lib/Interface/Lists/BotsDataBase.d.ts b/lib/Interface/Lists/BotsDataBase.d.ts new file mode 100644 index 00000000..e1888002 --- /dev/null +++ b/lib/Interface/Lists/BotsDataBase.d.ts @@ -0,0 +1,39 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the BotsDataBase service. + * @see https://docs.botsdatabase.com/ + */ +export default class BotsDataBase extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + getBotVotes(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/BotsDataBase.js b/lib/Interface/Lists/BotsDataBase.js new file mode 100644 index 00000000..e4d08267 --- /dev/null +++ b/lib/Interface/Lists/BotsDataBase.js @@ -0,0 +1,112 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the BotsDataBase service. + * @see https://docs.botsdatabase.com/ + */ +var BotsDataBase = /** @class */ (function (_super) { + __extends(BotsDataBase, _super); + function BotsDataBase() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(BotsDataBase, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['botsdatabase', 'botsdatabase.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsDataBase, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://botsdatabase.com/images/icons/favicon-96x96.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsDataBase, "serviceName", { + /** Service's name. */ + get: function () { + return 'BotsDataBase'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsDataBase, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://botsdatabase.com'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsDataBase, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.botsdatabase.com/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + BotsDataBase.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID), + headers: { + Authorization: token, + 'Content-Type': 'application/json' + }, + data: { servers: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + BotsDataBase.prototype.getUser = function (id) { + return this._request({ url: "/users/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + BotsDataBase.prototype.getBot = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + BotsDataBase.prototype.getBotVotes = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/votes", + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + return BotsDataBase; +}(Service_1.Service)); +exports.default = BotsDataBase; diff --git a/lib/Interface/Lists/BotsForDiscord.d.ts b/lib/Interface/Lists/BotsForDiscord.d.ts new file mode 100644 index 00000000..fdd7dac7 --- /dev/null +++ b/lib/Interface/Lists/BotsForDiscord.d.ts @@ -0,0 +1,51 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the Bots For Discord service. + * @see https://docs.botsfordiscord.com/ + */ +export default class BotsForDiscord extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + getBotVotes(id: IDResolvable): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the user's bots listed for this service. + * @param id The user's ID + */ + getUserBots(id: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, query?: Query): string; +} diff --git a/lib/Interface/Lists/BotsForDiscord.js b/lib/Interface/Lists/BotsForDiscord.js new file mode 100644 index 00000000..8ffe2f6a --- /dev/null +++ b/lib/Interface/Lists/BotsForDiscord.js @@ -0,0 +1,121 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Bots For Discord service. + * @see https://docs.botsfordiscord.com/ + */ +var BotsForDiscord = /** @class */ (function (_super) { + __extends(BotsForDiscord, _super); + function BotsForDiscord() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(BotsForDiscord, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['botsfordiscord', 'botsfordiscord.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsForDiscord, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://botsfordiscord.com/img/manifest/icon-512x512.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsForDiscord, "serviceName", { + /** Service's name. */ + get: function () { + return 'Bots For Discord'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsForDiscord, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://botsfordiscord.com'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsForDiscord, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://botsfordiscord.com/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + BotsForDiscord.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + BotsForDiscord.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + BotsForDiscord.prototype.getBotVotes = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) + "/votes" }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + BotsForDiscord.prototype.getUser = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the user's bots listed for this service. + * @param id The user's ID + */ + BotsForDiscord.prototype.getUserBots = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/bots" }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + BotsForDiscord.prototype.getWidgetURL = function (id, query) { + return this._appendQuery("/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}); + }; + return BotsForDiscord; +}(Service_1.Service)); +exports.default = BotsForDiscord; diff --git a/lib/Interface/Lists/BotsOnDiscord.d.ts b/lib/Interface/Lists/BotsOnDiscord.d.ts new file mode 100644 index 00000000..8bc51e48 --- /dev/null +++ b/lib/Interface/Lists/BotsOnDiscord.d.ts @@ -0,0 +1,37 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the Bots On Discord service. + * @see https://bots.ondiscord.xyz/info/api + */ +export default class BotsOnDiscord extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Checks whether or not a user has reviewed a bot. + * @param id The bot's ID + * @param userId The user's ID + */ + checkReview(id: IDResolvable, userId: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, query?: Query): string; +} diff --git a/lib/Interface/Lists/BotsOnDiscord.js b/lib/Interface/Lists/BotsOnDiscord.js new file mode 100644 index 00000000..c8076e43 --- /dev/null +++ b/lib/Interface/Lists/BotsOnDiscord.js @@ -0,0 +1,107 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Bots On Discord service. + * @see https://bots.ondiscord.xyz/info/api + */ +var BotsOnDiscord = /** @class */ (function (_super) { + __extends(BotsOnDiscord, _super); + function BotsOnDiscord() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(BotsOnDiscord, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['botsondiscord', 'bots.ondiscord.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsOnDiscord, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://bots.ondiscord.xyz/favicon/android-chrome-256x256.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsOnDiscord, "serviceName", { + /** Service's name. */ + get: function () { + return 'Bots On Discord'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsOnDiscord, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://bots.ondiscord.xyz'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BotsOnDiscord, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://bots.ondiscord.xyz/bot-api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + BotsOnDiscord.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/guilds", + headers: { Authorization: token }, + data: { guildCount: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Checks whether or not a user has reviewed a bot. + * @param id The bot's ID + * @param userId The user's ID + */ + BotsOnDiscord.prototype.checkReview = function (id, userId) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/review", + headers: { Authorization: this.token }, + params: { owner: Util_1.Util.resolveID(userId) } + }, { + requiresToken: true + }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + BotsOnDiscord.prototype.getWidgetURL = function (id, query) { + return this._appendQuery("https://bots.ondiscord.xyz/bots/" + Util_1.Util.resolveID(id) + "/embed", query || {}, false); + }; + return BotsOnDiscord; +}(Service_1.Service)); +exports.default = BotsOnDiscord; diff --git a/lib/Interface/Lists/Carbon.d.ts b/lib/Interface/Lists/Carbon.d.ts new file mode 100644 index 00000000..bb6a57a8 --- /dev/null +++ b/lib/Interface/Lists/Carbon.d.ts @@ -0,0 +1,24 @@ +import { Service, ServicePostOptions } from '../Service'; +/** + * Represents the Carbonitex service. + */ +export default class Carbon extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** Gets a list of bots on this service. */ + getBots(): Promise>; +} diff --git a/lib/Interface/Lists/Carbon.js b/lib/Interface/Lists/Carbon.js new file mode 100644 index 00000000..871eb124 --- /dev/null +++ b/lib/Interface/Lists/Carbon.js @@ -0,0 +1,87 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Carbonitex service. + */ +var Carbon = /** @class */ (function (_super) { + __extends(Carbon, _super); + function Carbon() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Carbon, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['carbonitex', 'carbonitex.net', 'carbon']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Carbon, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://get.snaz.in/7N8ywwr.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Carbon, "serviceName", { + /** Service's name. */ + get: function () { + return 'Carbonitex'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Carbon, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://www.carbonitex.net/Discord/bots'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Carbon, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://www.carbonitex.net/discord'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + Carbon.post = function (options) { + var token = options.token, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: '/data/botdata.php', + data: { key: token, servercount: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** Gets a list of bots on this service. */ + Carbon.prototype.getBots = function () { + return this._request({ url: '/api/listedbots' }); + }; + return Carbon; +}(Service_1.Service)); +exports.default = Carbon; diff --git a/lib/Interface/Lists/DBots.d.ts b/lib/Interface/Lists/DBots.d.ts new file mode 100644 index 00000000..12cdb824 --- /dev/null +++ b/lib/Interface/Lists/DBots.d.ts @@ -0,0 +1,34 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the DBots service. + * @see https://docs.dbots.co/ + */ +export default class DBots extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot's audit logs. + * @param id The bot's ID + */ + getAudit(id: IDResolvable): Promise>; + /** + * Regenerates the bot API token. + * @param id The bot's ID + */ + regenToken(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/DBots.js b/lib/Interface/Lists/DBots.js new file mode 100644 index 00000000..fda8b55b --- /dev/null +++ b/lib/Interface/Lists/DBots.js @@ -0,0 +1,105 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the DBots service. + * @see https://docs.dbots.co/ + */ +var DBots = /** @class */ (function (_super) { + __extends(DBots, _super); + function DBots() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DBots, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['dbots', 'dbots.co']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DBots, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://gblobscdn.gitbook.com/spaces%2F-MO490c2KMEgwyXnbtbV%2Favatar-1607528014691.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DBots, "serviceName", { + /** Service's name. */ + get: function () { + return 'DBots.co'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DBots, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://dbots.co/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DBots, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://dbots.co/api/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + DBots.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: { guildCount: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot's audit logs. + * @param id The bot's ID + */ + DBots.prototype.getAudit = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/log", + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Regenerates the bot API token. + * @param id The bot's ID + */ + DBots.prototype.regenToken = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/keys/regen", + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + return DBots; +}(Service_1.Service)); +exports.default = DBots; diff --git a/lib/Interface/Lists/DiscordAppsDev.d.ts b/lib/Interface/Lists/DiscordAppsDev.d.ts new file mode 100644 index 00000000..aa02ba12 --- /dev/null +++ b/lib/Interface/Lists/DiscordAppsDev.d.ts @@ -0,0 +1,41 @@ +import { Service, ServicePostOptions } from '../Service'; +import { AnyObject, IDResolvable } from '../../Utils/Util'; +/** + * Represents the Discord Apps service. + * @see https://discordapps.dev/en-GB/posts/docs/api-v2/ + */ +export default class DiscordAppsDev extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** Gets a list of bots on this service. */ + getBots(): Promise>; + /** Gets a list of applications on this service. */ + getApps(): Promise>; + /** Gets a list of RPC applications on this service. */ + getRPCApps(): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Updates the bot with the data provided. + * @param id The bot's ID + * @param data The data being posted + */ + updateBot(id: IDResolvable, data: AnyObject): Promise>; +} diff --git a/lib/Interface/Lists/DiscordAppsDev.js b/lib/Interface/Lists/DiscordAppsDev.js new file mode 100644 index 00000000..c499051f --- /dev/null +++ b/lib/Interface/Lists/DiscordAppsDev.js @@ -0,0 +1,119 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Apps service. + * @see https://discordapps.dev/en-GB/posts/docs/api-v2/ + */ +var DiscordAppsDev = /** @class */ (function (_super) { + __extends(DiscordAppsDev, _super); + function DiscordAppsDev() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordAppsDev, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordappsdev', 'discordapps.dev']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordAppsDev, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://api.discordapps.dev/img/logo/logo128.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordAppsDev, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Apps'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordAppsDev, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordapps.dev'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordAppsDev, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.discordapps.dev/api/v2'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + DiscordAppsDev.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: { bot: { count: Util_1.Util.resolveCount(serverCount) } } + }); + }; + /** Gets a list of bots on this service. */ + DiscordAppsDev.prototype.getBots = function () { + return this._request({ url: '/bots' }); + }; + /** Gets a list of applications on this service. */ + DiscordAppsDev.prototype.getApps = function () { + return this._request({ url: '/apps' }); + }; + /** Gets a list of RPC applications on this service. */ + DiscordAppsDev.prototype.getRPCApps = function () { + return this._request({ url: '/rpc' }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + DiscordAppsDev.prototype.getBot = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + /** + * Updates the bot with the data provided. + * @param id The bot's ID + * @param data The data being posted + */ + DiscordAppsDev.prototype.updateBot = function (id, data) { + return this._request({ + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token }, + data: data + }, { + requiresToken: true + }); + }; + return DiscordAppsDev; +}(Service_1.Service)); +exports.default = DiscordAppsDev; diff --git a/lib/Interface/Lists/DiscordBoats.d.ts b/lib/Interface/Lists/DiscordBoats.d.ts new file mode 100644 index 00000000..d3ef906d --- /dev/null +++ b/lib/Interface/Lists/DiscordBoats.d.ts @@ -0,0 +1,47 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the Discord Boats service. + * @see https://discord.boats/api/docs + */ +export default class DiscordBoats extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param id The bot's ID + * @param userID The user's ID + */ + userVoted(id: IDResolvable, userID: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, query?: Query): string; +} diff --git a/lib/Interface/Lists/DiscordBoats.js b/lib/Interface/Lists/DiscordBoats.js new file mode 100644 index 00000000..46b101d4 --- /dev/null +++ b/lib/Interface/Lists/DiscordBoats.js @@ -0,0 +1,118 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Boats service. + * @see https://discord.boats/api/docs + */ +var DiscordBoats = /** @class */ (function (_super) { + __extends(DiscordBoats, _super); + function DiscordBoats() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordBoats, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordboats', 'discord.boats']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBoats, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://discord.boats/android-icon-192x192.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBoats, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Boats'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBoats, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discord.boats'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBoats, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://discord.boats/api/v2'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + DiscordBoats.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + DiscordBoats.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + DiscordBoats.prototype.getUser = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); + }; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param id The bot's ID + * @param userID The user's ID + */ + DiscordBoats.prototype.userVoted = function (id, userID) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id) + "/voted", + params: { id: Util_1.Util.resolveID(userID) } + }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + DiscordBoats.prototype.getWidgetURL = function (id, query) { + return this._appendQuery("/widget/" + Util_1.Util.resolveID(id), query || {}); + }; + return DiscordBoats; +}(Service_1.Service)); +exports.default = DiscordBoats; diff --git a/lib/Interface/Lists/DiscordBotDirectory.d.ts b/lib/Interface/Lists/DiscordBotDirectory.d.ts new file mode 100644 index 00000000..4c18e86c --- /dev/null +++ b/lib/Interface/Lists/DiscordBotDirectory.d.ts @@ -0,0 +1,30 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Discord Bot Directory service. + * @see https://botblock.org/lists/discordbotdirectory.net + */ +export default class DiscordBotDirectory extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * The docs for this endopoint exist only in a Discord message. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + */ + getWidgetURL(id: IDResolvable): string; +} diff --git a/lib/Interface/Lists/DiscordBotDirectory.js b/lib/Interface/Lists/DiscordBotDirectory.js new file mode 100644 index 00000000..85f0cac2 --- /dev/null +++ b/lib/Interface/Lists/DiscordBotDirectory.js @@ -0,0 +1,93 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Bot Directory service. + * @see https://botblock.org/lists/discordbotdirectory.net + */ +var DiscordBotDirectory = /** @class */ (function (_super) { + __extends(DiscordBotDirectory, _super); + function DiscordBotDirectory() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordBotDirectory, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordbotdirectory', 'discordbotdirectory.net']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotDirectory, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://discordbotdirectory.net/assets/img/logo.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotDirectory, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Bot Directory'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotDirectory, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordbotdirectory.net'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotDirectory, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://discordbotdirectory.net/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * The docs for this endopoint exist only in a Discord message. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + DiscordBotDirectory.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/auth/stats/" + Util_1.Util.resolveID(clientID), + headers: { authorization: token, 'Content-Type': 'application/json' }, + data: { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + */ + DiscordBotDirectory.prototype.getWidgetURL = function (id) { + return this._appendQuery("/embed/" + Util_1.Util.resolveID(id), {}); + }; + return DiscordBotDirectory; +}(Service_1.Service)); +exports.default = DiscordBotDirectory; diff --git a/lib/Interface/Lists/DiscordBotList.d.ts b/lib/Interface/Lists/DiscordBotList.d.ts new file mode 100644 index 00000000..ad1ce868 --- /dev/null +++ b/lib/Interface/Lists/DiscordBotList.d.ts @@ -0,0 +1,22 @@ +import { Service, ServicePostOptions } from '../Service'; +/** + * Represents the Discord Bot List service. + * @see https://discordbotlist.com/api-docs + */ +export default class DiscordBotList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; +} diff --git a/lib/Interface/Lists/DiscordBotList.js b/lib/Interface/Lists/DiscordBotList.js new file mode 100644 index 00000000..b3b75481 --- /dev/null +++ b/lib/Interface/Lists/DiscordBotList.js @@ -0,0 +1,91 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Bot List service. + * @see https://discordbotlist.com/api-docs + */ +var DiscordBotList = /** @class */ (function (_super) { + __extends(DiscordBotList, _super); + function DiscordBotList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordBotList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordbotlist', 'discordbotlist.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://discordbotlist.com/android-icon-192x192.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotList, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordbotlist.com'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://discordbotlist.com/api/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordBotList.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard, userCount = options.userCount, voiceConnections = options.voiceConnections; + var data = { guilds: Util_1.Util.resolveCount(serverCount) }; + if (shard) + data.shard_id = shard.id; + if (userCount) + data.users = Util_1.Util.resolveCount(userCount); + if (voiceConnections) + data.voice_connections = Util_1.Util.resolveCount(voiceConnections); + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: "Bot " + token }, + data: data + }); + }; + return DiscordBotList; +}(Service_1.Service)); +exports.default = DiscordBotList; diff --git a/lib/Interface/Lists/DiscordBotsCo.d.ts b/lib/Interface/Lists/DiscordBotsCo.d.ts new file mode 100644 index 00000000..cc362812 --- /dev/null +++ b/lib/Interface/Lists/DiscordBotsCo.d.ts @@ -0,0 +1,28 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the DiscordBots.co service. + * @see https://discordbots.co/api-information + */ +export default class DiscordBotsCo extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/DiscordBotsCo.js b/lib/Interface/Lists/DiscordBotsCo.js new file mode 100644 index 00000000..d56199de --- /dev/null +++ b/lib/Interface/Lists/DiscordBotsCo.js @@ -0,0 +1,104 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the DiscordBots.co service. + * @see https://discordbots.co/api-information + */ +var DiscordBotsCo = /** @class */ (function (_super) { + __extends(DiscordBotsCo, _super); + function DiscordBotsCo() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordBotsCo, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordbotsco', 'discordbots.co']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsCo, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://cdn.discordapp.com/avatars/688927563409522694/17cfd572fd3e2d3285534c12e0f58422.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsCo, "serviceName", { + /** Service's name. */ + get: function () { + return 'DiscordBots.co'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsCo, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordbots.co'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsCo, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.discordbots.co/v1/public'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordBotsCo.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { + Authorization: token, + 'Content-Type': 'application/json' + }, + data: shard + ? { + serverCount: Util_1.Util.resolveCount(serverCount), + shardCount: shard.count + } + : { serverCount: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + DiscordBotsCo.prototype.getBot = function (id) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + return DiscordBotsCo; +}(Service_1.Service)); +exports.default = DiscordBotsCo; diff --git a/lib/Interface/Lists/DiscordBotsGG.d.ts b/lib/Interface/Lists/DiscordBotsGG.d.ts new file mode 100644 index 00000000..afc66bc1 --- /dev/null +++ b/lib/Interface/Lists/DiscordBotsGG.d.ts @@ -0,0 +1,55 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** The user agent used options for the DiscordBotsGG service */ +export interface DiscordBotsGGUserAgent { + /** The bot's library */ + library: string; + /** The bot ID for the user agent */ + clientID: string; +} +/** + * Represents the Discord Bots service. + * @see https://discord.bots.gg/docs + */ +export default class DiscordBotsGG extends Service { + /** The user agent options for this service */ + private agent; + /** + * @param token The token/key for the service + * @param userAgent The user agent options of the service. Providing this is highly recommended. + */ + constructor(token: string, userAgent?: DiscordBotsGGUserAgent); + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Creates a compliant user agent to use for any API calls to Discord Bots. + * @param botID The ID of the bot that the agent will be identified with + * @param library The library the agent is using + */ + static userAgent(botID: IDResolvable, library?: string): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + * @param sanitized Whether to sanitize descriptions + */ + getBot(id: IDResolvable, sanitized?: boolean): Promise>; + /** + * Gets a list of bots on this service. + * @param query The query string that will be used in the request + */ + getBots(query?: Query): Promise>; +} diff --git a/lib/Interface/Lists/DiscordBotsGG.js b/lib/Interface/Lists/DiscordBotsGG.js new file mode 100644 index 00000000..f32a17f9 --- /dev/null +++ b/lib/Interface/Lists/DiscordBotsGG.js @@ -0,0 +1,147 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +var Constants_1 = require("../../Utils/Constants"); +/** + * Represents the Discord Bots service. + * @see https://discord.bots.gg/docs + */ +var DiscordBotsGG = /** @class */ (function (_super) { + __extends(DiscordBotsGG, _super); + // + /** + * @param token The token/key for the service + * @param userAgent The user agent options of the service. Providing this is highly recommended. + */ + function DiscordBotsGG(token, userAgent) { + var _this = _super.call(this, token) || this; + _this.agent = { + library: (userAgent === null || userAgent === void 0 ? void 0 : userAgent.library) || 'unknown', + clientID: (userAgent === null || userAgent === void 0 ? void 0 : userAgent.clientID) || '000000000000000' + }; + return _this; + } + Object.defineProperty(DiscordBotsGG, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordbotsgg', 'discord.bots.gg']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsGG, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://pbs.twimg.com/profile_images/1071582837030060032/kKV-I01n_400x400.jpg'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsGG, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Bots'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsGG, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discord.bots.gg'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordBotsGG, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://discord.bots.gg/api/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Creates a compliant user agent to use for any API calls to Discord Bots. + * @param botID The ID of the bot that the agent will be identified with + * @param library The library the agent is using + */ + DiscordBotsGG.userAgent = function (botID, library) { + if (library === void 0) { library = 'unknown'; } + return "dbots-0000/" + Constants_1.Package.version + " (" + library + "; +https://github.com/dbots-pkg/dbots.js) DBots/" + Util_1.Util.resolveID(botID); + }; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordBotsGG.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { + Authorization: token, + 'User-Agent': DiscordBotsGG.userAgent(clientID) + }, + data: shard + ? { + guildCount: Util_1.Util.resolveCount(serverCount), + shardId: shard.id, + shardCount: shard.count + } + : { guildCount: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + * @param sanitized Whether to sanitize descriptions + */ + DiscordBotsGG.prototype.getBot = function (id, sanitized) { + if (sanitized === void 0) { sanitized = false; } + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id), + headers: { + Authorization: this.token, + 'User-Agent': DiscordBotsGG.userAgent(this.agent.clientID, this.agent.library) + }, + params: { sanitized: sanitized } + }, { + requiresToken: true + }); + }; + /** + * Gets a list of bots on this service. + * @param query The query string that will be used in the request + */ + DiscordBotsGG.prototype.getBots = function (query) { + return this._request({ + url: '/bots', + headers: { + Authorization: this.token, + 'User-Agent': DiscordBotsGG.userAgent(this.agent.clientID, this.agent.library) + }, + params: query + }, { + requiresToken: true + }); + }; + return DiscordBotsGG; +}(Service_1.Service)); +exports.default = DiscordBotsGG; diff --git a/lib/Interface/Lists/DiscordExtremeList.d.ts b/lib/Interface/Lists/DiscordExtremeList.d.ts new file mode 100644 index 00000000..633de098 --- /dev/null +++ b/lib/Interface/Lists/DiscordExtremeList.d.ts @@ -0,0 +1,35 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Discord Extreme List service. + * @see https://docs.discordextremelist.xyz/ + */ +export default class DiscordExtremeList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** Gets the statistics of this service. */ + getStatistics(): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the user listed on this service. + * @param id The bot's ID + */ + getUser(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/DiscordExtremeList.js b/lib/Interface/Lists/DiscordExtremeList.js new file mode 100644 index 00000000..5dcdeb1a --- /dev/null +++ b/lib/Interface/Lists/DiscordExtremeList.js @@ -0,0 +1,120 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Extreme List service. + * @see https://docs.discordextremelist.xyz/ + */ +var DiscordExtremeList = /** @class */ (function (_super) { + __extends(DiscordExtremeList, _super); + function DiscordExtremeList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordExtremeList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordextremelist', 'discordextremelist.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordExtremeList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://get.snaz.in/4KjWg91.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordExtremeList, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Extreme List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordExtremeList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordextremelist.xyz/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordExtremeList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.discordextremelist.xyz/v2'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordExtremeList.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: { + guildCount: Util_1.Util.resolveCount(serverCount), + shardCount: shard ? Util_1.Util.resolveCount(shard.count) : undefined + } + }); + }; + /** Gets the statistics of this service. */ + DiscordExtremeList.prototype.getStatistics = function () { + return this._request({ + url: '/stats', + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + DiscordExtremeList.prototype.getBot = function (id) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets the user listed on this service. + * @param id The bot's ID + */ + DiscordExtremeList.prototype.getUser = function (id) { + return this._request({ + url: "/user/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + return DiscordExtremeList; +}(Service_1.Service)); +exports.default = DiscordExtremeList; diff --git a/lib/Interface/Lists/DiscordLabs.d.ts b/lib/Interface/Lists/DiscordLabs.d.ts new file mode 100644 index 00000000..c720ad0a --- /dev/null +++ b/lib/Interface/Lists/DiscordLabs.d.ts @@ -0,0 +1,28 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Discord Labs service. + * @see https://docs.discordlabs.org/#/api + */ +export default class DiscordLabs extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/DiscordLabs.js b/lib/Interface/Lists/DiscordLabs.js new file mode 100644 index 00000000..a5b21dc6 --- /dev/null +++ b/lib/Interface/Lists/DiscordLabs.js @@ -0,0 +1,99 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Labs service. + * @see https://docs.discordlabs.org/#/api + */ +var DiscordLabs = /** @class */ (function (_super) { + __extends(DiscordLabs, _super); + function DiscordLabs() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordLabs, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordlabs', 'discordlabs.org']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordLabs, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://avatars2.githubusercontent.com/u/54491479?v=4'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordLabs, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Labs'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordLabs, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://bots.discordlabs.org/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordLabs, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://bots.discordlabs.org/v2'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordLabs.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + data: shard + ? { + token: token, + server_count: Util_1.Util.resolveCount(serverCount), + shard_count: shard.count + } + : { + token: token, + server_count: Util_1.Util.resolveCount(serverCount) + } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + DiscordLabs.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + return DiscordLabs; +}(Service_1.Service)); +exports.default = DiscordLabs; diff --git a/lib/Interface/Lists/DiscordListology.d.ts b/lib/Interface/Lists/DiscordListology.d.ts new file mode 100644 index 00000000..2e43f206 --- /dev/null +++ b/lib/Interface/Lists/DiscordListology.d.ts @@ -0,0 +1,45 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the DiscordListology service. + * @see https://discordlistology.com/developer/documentation + */ +export default class DiscordListology extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot's stats listed on this service. + * @param id The bot's ID + */ + getBotStats(id: IDResolvable): Promise>; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param id The bot's ID + * @param userID The user's ID + */ + userVotedBot(id: IDResolvable, userID: IDResolvable): Promise>; + /** + * Gets the guild's stats listed on this service. + * @param id The guild's ID + */ + getGuildStats(id: IDResolvable): Promise>; + /** + * Checks whether or not a user has voted for a guild on this service. + * @param id The guild's ID + * @param userID The user's ID + */ + userVotedGuild(id: IDResolvable, userID: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/DiscordListology.js b/lib/Interface/Lists/DiscordListology.js new file mode 100644 index 00000000..da56cd4c --- /dev/null +++ b/lib/Interface/Lists/DiscordListology.js @@ -0,0 +1,123 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the DiscordListology service. + * @see https://discordlistology.com/developer/documentation + */ +var DiscordListology = /** @class */ (function (_super) { + __extends(DiscordListology, _super); + function DiscordListology() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordListology, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordlistology', 'discordlistology.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordListology, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://discordlistology.com/idiscord.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordListology, "serviceName", { + /** Service's name. */ + get: function () { + return 'DiscordListology'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordListology, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordlistology.com/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordListology, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://discordlistology.com/api/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordListology.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: shard + ? { + servers: Util_1.Util.resolveCount(serverCount), + shards: shard.count + } + : { servers: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot's stats listed on this service. + * @param id The bot's ID + */ + DiscordListology.prototype.getBotStats = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) + "/stats" }); + }; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param id The bot's ID + * @param userID The user's ID + */ + DiscordListology.prototype.userVotedBot = function (id, userID) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(userID) + "/hasvoted/" + Util_1.Util.resolveID(id) + }); + }; + /** + * Gets the guild's stats listed on this service. + * @param id The guild's ID + */ + DiscordListology.prototype.getGuildStats = function (id) { + return this._request({ url: "/guilds/" + Util_1.Util.resolveID(id) + "/stats" }); + }; + /** + * Checks whether or not a user has voted for a guild on this service. + * @param id The guild's ID + * @param userID The user's ID + */ + DiscordListology.prototype.userVotedGuild = function (id, userID) { + return this._request({ + url: "/guilds/" + Util_1.Util.resolveID(userID) + "/hasvoted/" + Util_1.Util.resolveID(id) + }); + }; + return DiscordListology; +}(Service_1.Service)); +exports.default = DiscordListology; diff --git a/lib/Interface/Lists/DiscordServices.d.ts b/lib/Interface/Lists/DiscordServices.d.ts new file mode 100644 index 00000000..c83c33b9 --- /dev/null +++ b/lib/Interface/Lists/DiscordServices.d.ts @@ -0,0 +1,45 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** The options to use when posting command info for the DiscordServices service */ +export interface DiscordServicesCommandInfo { + /** The command name including the prefix */ + command: string; + /** The description for your command */ + desc: string; + /** The category of your command */ + category: string; +} +/** + * Represents the Discord Services service. + * @see https://discordservices.net/docs/api + */ +export default class DiscordServices extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Posts news to your bot page + * @param id The bot's ID + * @param title The title of the post + * @param content The content of the post + */ + postNews(id: IDResolvable, title: string, content: string): Promise>; + /** + * Posts commands info to your bot page + * @param id The bot's ID + * @param commands The command info to post + */ + postCommands(id: IDResolvable, commands: DiscordServicesCommandInfo[]): Promise>; +} diff --git a/lib/Interface/Lists/DiscordServices.js b/lib/Interface/Lists/DiscordServices.js new file mode 100644 index 00000000..d685589a --- /dev/null +++ b/lib/Interface/Lists/DiscordServices.js @@ -0,0 +1,120 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Discord Services service. + * @see https://discordservices.net/docs/api + */ +var DiscordServices = /** @class */ (function (_super) { + __extends(DiscordServices, _super); + function DiscordServices() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(DiscordServices, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['discordservices', 'discordservices.net']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordServices, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://discordservices.net/icon.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordServices, "serviceName", { + /** Service's name. */ + get: function () { + return 'Discord Services'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordServices, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://discordservices.net'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DiscordServices, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.discordservices.net'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + DiscordServices.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: shard + ? { + servers: Util_1.Util.resolveCount(serverCount), + shards: shard.count + } + : { servers: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Posts news to your bot page + * @param id The bot's ID + * @param title The title of the post + * @param content The content of the post + */ + DiscordServices.prototype.postNews = function (id, title, content) { + return this._request({ + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(id) + "/news", + headers: { Authorization: this.token }, + data: { + title: title, + content: content, + error: false + } + }, { requiresToken: true }); + }; + /** + * Posts commands info to your bot page + * @param id The bot's ID + * @param commands The command info to post + */ + DiscordServices.prototype.postCommands = function (id, commands) { + return this._request({ + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(id) + "/commands", + headers: { Authorization: this.token }, + data: commands + }, { requiresToken: true }); + }; + return DiscordServices; +}(Service_1.Service)); +exports.default = DiscordServices; diff --git a/lib/Interface/Lists/Disforge.d.ts b/lib/Interface/Lists/Disforge.d.ts new file mode 100644 index 00000000..70c8305f --- /dev/null +++ b/lib/Interface/Lists/Disforge.d.ts @@ -0,0 +1,31 @@ +import { Service, ServicePostOptions } from '../Service'; +/** + * Represents the Disforge service. + * @see https://disforge.com/developer + */ +export default class Disforge extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Retreives the data shown on the homepage. + */ + getHomepage(): Promise>; + /** + * Retreives statistics about Disforge. + */ + getStats(): Promise>; +} diff --git a/lib/Interface/Lists/Disforge.js b/lib/Interface/Lists/Disforge.js new file mode 100644 index 00000000..76ba5d35 --- /dev/null +++ b/lib/Interface/Lists/Disforge.js @@ -0,0 +1,101 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Disforge service. + * @see https://disforge.com/developer + */ +var Disforge = /** @class */ (function (_super) { + __extends(Disforge, _super); + function Disforge() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(Disforge, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['disforge', 'disforge.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Disforge, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://disforge.com/assets/img/ui/categories/all-bots.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Disforge, "serviceName", { + /** Service's name. */ + get: function () { + return 'Disforge'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Disforge, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://disforge.com/bots'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Disforge, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://disforge.com/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + Disforge.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/botstats/" + Util_1.Util.resolveID(clientID), + headers: { + Authorization: token + }, + data: { + servers: Util_1.Util.resolveCount(serverCount) + } + }); + }; + /** + * Retreives the data shown on the homepage. + */ + Disforge.prototype.getHomepage = function () { + return this._request({ url: "/home" }); + }; + /** + * Retreives statistics about Disforge. + */ + Disforge.prototype.getStats = function () { + return this._request({ url: "/stats" }); + }; + return Disforge; +}(Service_1.Service)); +exports.default = Disforge; diff --git a/lib/Interface/Lists/GlennBotList.d.ts b/lib/Interface/Lists/GlennBotList.d.ts new file mode 100644 index 00000000..c13c5907 --- /dev/null +++ b/lib/Interface/Lists/GlennBotList.d.ts @@ -0,0 +1,45 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the Glenn Bot List service. + * @see https://docs.glennbotlist.xyz/ + */ +export default class GlennBotList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + getBotVotes(id: IDResolvable): Promise>; + /** + * Get a user's profile listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, query?: Query): string; +} diff --git a/lib/Interface/Lists/GlennBotList.js b/lib/Interface/Lists/GlennBotList.js new file mode 100644 index 00000000..423bf616 --- /dev/null +++ b/lib/Interface/Lists/GlennBotList.js @@ -0,0 +1,121 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Glenn Bot List service. + * @see https://docs.glennbotlist.xyz/ + */ +var GlennBotList = /** @class */ (function (_super) { + __extends(GlennBotList, _super); + function GlennBotList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(GlennBotList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['glennbotlist', 'glennbotlist.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(GlennBotList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://get.snaz.in/8HphUE7.jpg'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(GlennBotList, "serviceName", { + /** Service's name. */ + get: function () { + return 'Glenn Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(GlennBotList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://glennbotlist.xyz'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(GlennBotList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://glennbotlist.xyz/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + GlennBotList.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: { + serverCount: Util_1.Util.resolveCount(serverCount), + shardCount: shard ? Util_1.Util.resolveCount(shard.count) : undefined + } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + GlennBotList.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + GlennBotList.prototype.getBotVotes = function (id) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id) + "/votes", + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Get a user's profile listed on this service. + * @param id The user's ID + */ + GlennBotList.prototype.getUser = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + GlennBotList.prototype.getWidgetURL = function (id, query) { + return this._appendQuery("https://glennbotlist.xyz/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}, false); + }; + return GlennBotList; +}(Service_1.Service)); +exports.default = GlennBotList; diff --git a/lib/Interface/Lists/InfinityBots.d.ts b/lib/Interface/Lists/InfinityBots.d.ts new file mode 100644 index 00000000..7418f98a --- /dev/null +++ b/lib/Interface/Lists/InfinityBots.d.ts @@ -0,0 +1,33 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Infinity Bots service. + * @see https://docs.infinitybots.xyz + */ +export default class InfinityBots extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/InfinityBots.js b/lib/Interface/Lists/InfinityBots.js new file mode 100644 index 00000000..83b7fabb --- /dev/null +++ b/lib/Interface/Lists/InfinityBots.js @@ -0,0 +1,119 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Infinity Bots service. + * @see https://docs.infinitybots.xyz + */ +var InfinityBots = /** @class */ (function (_super) { + __extends(InfinityBots, _super); + function InfinityBots() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(InfinityBots, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['infinitybots', 'infinitybots.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InfinityBots, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://i.imgur.com/x0LCfAh.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InfinityBots, "serviceName", { + /** Service's name. */ + get: function () { + return 'Infinity Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InfinityBots, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://infinitybots.xyz'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InfinityBots, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.infinitybots.xyz'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + InfinityBots.post = function (options) { + var clientID = options.clientID, token = options.token, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID), + headers: { + authorization: token + }, + data: __assign({ servers: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) + ? { + shards: Util_1.Util.resolveCount(shard.count) + } + : {})) + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + InfinityBots.prototype.getBot = function (id) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id) + "/info" + }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + InfinityBots.prototype.getUser = function (id) { + return this._request({ + url: "/user/" + Util_1.Util.resolveID(id) + }); + }; + return InfinityBots; +}(Service_1.Service)); +exports.default = InfinityBots; diff --git a/lib/Interface/Lists/ListMyBots.d.ts b/lib/Interface/Lists/ListMyBots.d.ts new file mode 100644 index 00000000..103f807d --- /dev/null +++ b/lib/Interface/Lists/ListMyBots.d.ts @@ -0,0 +1,52 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the List My Bots service. + * @see https://listmybots.com/docs/api + */ +export default class ListMyBots extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the status widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getStatusWidgetURL(id: IDResolvable, query?: Query): string; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the info about someone's bots. + * @param id The user's ID + */ + getUserBots(id: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + getWidgetURL(id: IDResolvable, query?: Query): string; +} diff --git a/lib/Interface/Lists/ListMyBots.js b/lib/Interface/Lists/ListMyBots.js new file mode 100644 index 00000000..5915f391 --- /dev/null +++ b/lib/Interface/Lists/ListMyBots.js @@ -0,0 +1,122 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the List My Bots service. + * @see https://listmybots.com/docs/api + */ +var ListMyBots = /** @class */ (function (_super) { + __extends(ListMyBots, _super); + function ListMyBots() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ListMyBots, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['listmybots', 'listmybots.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ListMyBots, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://get.snaz.in/5Vm5J7i.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ListMyBots, "serviceName", { + /** Service's name. */ + get: function () { + return 'List My Bots'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ListMyBots, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://listmybots.com/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ListMyBots, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://listmybots.com/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + ListMyBots.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: { count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + ListMyBots.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the status widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + ListMyBots.prototype.getStatusWidgetURL = function (id, query) { + return this._appendQuery("https://listmybots.com/api/bot/" + Util_1.Util.resolveID(id) + "/widget/status", query || {}, false); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + ListMyBots.prototype.getUser = function (id) { + return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the info about someone's bots. + * @param id The user's ID + */ + ListMyBots.prototype.getUserBots = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + */ + ListMyBots.prototype.getWidgetURL = function (id, query) { + return this._appendQuery("https://listmybots.com/api/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}, false); + }; + return ListMyBots; +}(Service_1.Service)); +exports.default = ListMyBots; diff --git a/lib/Interface/Lists/ParadiseBots.d.ts b/lib/Interface/Lists/ParadiseBots.d.ts new file mode 100644 index 00000000..7707e032 --- /dev/null +++ b/lib/Interface/Lists/ParadiseBots.d.ts @@ -0,0 +1,28 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Paradise Bots service. + * @see https://paradisebots.net/api/v1/docs + */ +export default class ParadiseBots extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/ParadiseBots.js b/lib/Interface/Lists/ParadiseBots.js new file mode 100644 index 00000000..da86b136 --- /dev/null +++ b/lib/Interface/Lists/ParadiseBots.js @@ -0,0 +1,108 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Paradise Bots service. + * @see https://paradisebots.net/api/v1/docs + */ +var ParadiseBots = /** @class */ (function (_super) { + __extends(ParadiseBots, _super); + function ParadiseBots() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(ParadiseBots, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['paradisebots', 'paradisebots.net']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ParadiseBots, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://i.imgur.com/Df2seyl.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ParadiseBots, "serviceName", { + /** Service's name. */ + get: function () { + return 'Paradise Bots'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ParadiseBots, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://paradisebots.net/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ParadiseBots, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://paradisebots.net/api/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + ParadiseBots.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID), + headers: { + Authorization: token + }, + data: __assign({ server_count: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) + ? { + shard_count: Util_1.Util.resolveCount(shard.count) + } + : {})) + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + ParadiseBots.prototype.getBot = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + return ParadiseBots; +}(Service_1.Service)); +exports.default = ParadiseBots; diff --git a/lib/Interface/Lists/SpaceBotsList.d.ts b/lib/Interface/Lists/SpaceBotsList.d.ts new file mode 100644 index 00000000..070791bd --- /dev/null +++ b/lib/Interface/Lists/SpaceBotsList.d.ts @@ -0,0 +1,29 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Space Bots List service. + * @see https://spacebots.gitbook.io/tutorial-en/ + */ +export default class SpaceBotsList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/SpaceBotsList.js b/lib/Interface/Lists/SpaceBotsList.js new file mode 100644 index 00000000..a2f5f1b0 --- /dev/null +++ b/lib/Interface/Lists/SpaceBotsList.js @@ -0,0 +1,95 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Space Bots List service. + * @see https://spacebots.gitbook.io/tutorial-en/ + */ +var SpaceBotsList = /** @class */ (function (_super) { + __extends(SpaceBotsList, _super); + function SpaceBotsList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(SpaceBotsList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['spacebotslist', 'space-bot-list.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SpaceBotsList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://cdn.discordapp.com/avatars/546742409409593354/123b9b0a54b45d99627215c7154580af.webp?size=256'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SpaceBotsList, "serviceName", { + /** Service's name. */ + get: function () { + return 'Space Bots List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SpaceBotsList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://space-bot-list.xyz/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SpaceBotsList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://space-bot-list.xyz/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + SpaceBotsList.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, userCount = options.userCount; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: { + guilds: Util_1.Util.resolveCount(serverCount), + users: Util_1.Util.resolveCount(userCount) + } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + SpaceBotsList.prototype.getBot = function (id) { + return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); + }; + return SpaceBotsList; +}(Service_1.Service)); +exports.default = SpaceBotsList; diff --git a/lib/Interface/Lists/TopCord.d.ts b/lib/Interface/Lists/TopCord.d.ts new file mode 100644 index 00000000..d0a98103 --- /dev/null +++ b/lib/Interface/Lists/TopCord.d.ts @@ -0,0 +1,32 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the TopCord service. + * @see https://docs.topcord.xyz/#/API + */ +export default class TopCord extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Lists every bot on this service. + */ + getBots(): Promise>; +} diff --git a/lib/Interface/Lists/TopCord.js b/lib/Interface/Lists/TopCord.js new file mode 100644 index 00000000..3011c4b2 --- /dev/null +++ b/lib/Interface/Lists/TopCord.js @@ -0,0 +1,102 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the TopCord service. + * @see https://docs.topcord.xyz/#/API + */ +var TopCord = /** @class */ (function (_super) { + __extends(TopCord, _super); + function TopCord() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(TopCord, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['topcord', 'topcord.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopCord, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://avatars0.githubusercontent.com/u/69593894?v=4'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopCord, "serviceName", { + /** Service's name. */ + get: function () { + return 'TopCord'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopCord, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://topcord.xyz/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopCord, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.topcord.xyz'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + TopCord.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: shard + ? { + guilds: Util_1.Util.resolveCount(serverCount), + shards: shard.count + } + : { guilds: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + TopCord.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** + * Lists every bot on this service. + */ + TopCord.prototype.getBots = function () { + return this._request({ url: "/bots" }); + }; + return TopCord; +}(Service_1.Service)); +exports.default = TopCord; diff --git a/lib/Interface/Lists/TopGG.d.ts b/lib/Interface/Lists/TopGG.d.ts new file mode 100644 index 00000000..2333d600 --- /dev/null +++ b/lib/Interface/Lists/TopGG.d.ts @@ -0,0 +1,62 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the Top.gg service. + * @see https://docs.top.gg/ + */ +export default class TopGG extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; + /** + * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). + * @param query The query string that will be used in the request + */ + getBots(query: Query): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the bot's stats listed on this service. + * @param id The bot's ID + */ + getBotStats(id: IDResolvable): Promise>; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + getBotVotes(id: IDResolvable): Promise>; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param botId The bot's ID + * @param userID The user's ID + */ + userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) + */ + getWidgetURL(id: IDResolvable, query?: Query, smallWidget?: string): string; +} diff --git a/lib/Interface/Lists/TopGG.js b/lib/Interface/Lists/TopGG.js new file mode 100644 index 00000000..d7eea770 --- /dev/null +++ b/lib/Interface/Lists/TopGG.js @@ -0,0 +1,159 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Top.gg service. + * @see https://docs.top.gg/ + */ +var TopGG = /** @class */ (function (_super) { + __extends(TopGG, _super); + function TopGG() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(TopGG, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['topgg', 'top.gg']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopGG, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://top.gg/images/dblnew.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopGG, "serviceName", { + /** Service's name. */ + get: function () { + return 'Top.gg'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopGG, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://top.gg'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TopGG, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://top.gg/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + TopGG.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: shard + ? { + server_count: Util_1.Util.resolveCount(serverCount), + shard_id: shard.id, + shard_count: shard.count + } + : { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + TopGG.prototype.getUser = function (id) { + return this._request({ + url: "/users/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). + * @param query The query string that will be used in the request + */ + TopGG.prototype.getBots = function (query) { + return this._request({ url: '/bots', params: query, headers: { Authorization: this.token } }, { requiresToken: true }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + TopGG.prototype.getBot = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Gets the bot's stats listed on this service. + * @param id The bot's ID + */ + TopGG.prototype.getBotStats = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/stats", + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Gets the list of people who voted this bot on this service. + * @param id The bot's ID + */ + TopGG.prototype.getBotVotes = function (id) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(id) + "/votes", + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param botId The bot's ID + * @param userID The user's ID + */ + TopGG.prototype.userVoted = function (botId, userID) { + return this._request({ + url: "/bots/" + Util_1.Util.resolveID(botId) + "/check", + params: { userId: Util_1.Util.resolveID(userID) }, + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Gets the widget URL for this bot. + * @param id The bot's ID + * @param query The query string that will be used in the request + * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) + */ + TopGG.prototype.getWidgetURL = function (id, query, smallWidget) { + var subPath = smallWidget ? smallWidget + "/" : ''; + return this._appendQuery("/widget/" + subPath + Util_1.Util.resolveID(id) + ".svg", query || {}); + }; + return TopGG; +}(Service_1.Service)); +exports.default = TopGG; diff --git a/lib/Interface/Lists/VoidBots.d.ts b/lib/Interface/Lists/VoidBots.d.ts new file mode 100644 index 00000000..c4b93623 --- /dev/null +++ b/lib/Interface/Lists/VoidBots.d.ts @@ -0,0 +1,44 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Void Bots service. + * @see https://docs.voidbots.net/ + */ +export default class VoidBots extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param botId The bot's ID + * @param userID The user's ID + */ + userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; + /** + * Gets the bot's reviews on this service. + * @param id The bot's ID + */ + getBotReviews(id: IDResolvable): Promise>; + /** + * Gets the bot's analytics on this service. + * @param id The bot's ID + */ + getBotAnalytics(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/VoidBots.js b/lib/Interface/Lists/VoidBots.js new file mode 100644 index 00000000..70d5f88f --- /dev/null +++ b/lib/Interface/Lists/VoidBots.js @@ -0,0 +1,134 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Void Bots service. + * @see https://docs.voidbots.net/ + */ +var VoidBots = /** @class */ (function (_super) { + __extends(VoidBots, _super); + function VoidBots() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(VoidBots, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['voidbots', 'voidbots.net']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VoidBots, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://gblobscdn.gitbook.com/spaces%2F-MFw3t62urLlBeats8UJ%2Favatar-1598748054479.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VoidBots, "serviceName", { + /** Service's name. */ + get: function () { + return 'Void Bots'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VoidBots, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://voidbots.net/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VoidBots, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.voidbots.net'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + VoidBots.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/stats/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + data: (shard === null || shard === void 0 ? void 0 : shard.count) + ? { + server_count: Util_1.Util.resolveCount(serverCount), + shard_count: Util_1.Util.resolveCount(shard.count) + } + : { server_count: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + VoidBots.prototype.getBot = function (id) { + return this._request({ + url: "/bot/info/" + Util_1.Util.resolveID(id), + headers: { + Authorization: this.token + } + }, { requiresToken: true }); + }; + /** + * Checks whether or not a user has voted for a bot on this service. + * @param botId The bot's ID + * @param userID The user's ID + */ + VoidBots.prototype.userVoted = function (botId, userID) { + return this._request({ + url: "/bot/voted/" + Util_1.Util.resolveID(botId) + "/" + Util_1.Util.resolveID(userID), + headers: { + Authorization: this.token + } + }, { requiresToken: true }); + }; + /** + * Gets the bot's reviews on this service. + * @param id The bot's ID + */ + VoidBots.prototype.getBotReviews = function (id) { + return this._request({ + url: "/bot/reviews/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + /** + * Gets the bot's analytics on this service. + * @param id The bot's ID + */ + VoidBots.prototype.getBotAnalytics = function (id) { + return this._request({ + url: "/bot/analytics/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { requiresToken: true }); + }; + return VoidBots; +}(Service_1.Service)); +exports.default = VoidBots; diff --git a/lib/Interface/Lists/WonderBotList.d.ts b/lib/Interface/Lists/WonderBotList.d.ts new file mode 100644 index 00000000..efb88847 --- /dev/null +++ b/lib/Interface/Lists/WonderBotList.d.ts @@ -0,0 +1,33 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +/** + * Represents the Wonder Bot List service. + * @see https://api.wonderbotlist.com/en/ + */ +export default class WonderBotList extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + getUser(id: IDResolvable): Promise>; +} diff --git a/lib/Interface/Lists/WonderBotList.js b/lib/Interface/Lists/WonderBotList.js new file mode 100644 index 00000000..223377fd --- /dev/null +++ b/lib/Interface/Lists/WonderBotList.js @@ -0,0 +1,110 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the Wonder Bot List service. + * @see https://api.wonderbotlist.com/en/ + */ +var WonderBotList = /** @class */ (function (_super) { + __extends(WonderBotList, _super); + function WonderBotList() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(WonderBotList, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['wonderbotlist', 'wonderbotlist.com']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(WonderBotList, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://get.snaz.in/8Jk3EJg.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(WonderBotList, "serviceName", { + /** Service's name. */ + get: function () { + return 'Wonder Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(WonderBotList, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://wonderbotlist.com/en'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(WonderBotList, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://api.wonderbotlist.com/v1'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * @param options The options of the request + */ + WonderBotList.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID), + headers: { Authorization: token }, + params: shard && shard.count + ? { serveurs: Util_1.Util.resolveCount(serverCount), shard: shard.count } + : { serveurs: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + WonderBotList.prototype.getBot = function (id) { + return this._request({ + url: "/bot/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets the user listed on this service. + * @param id The user's ID + */ + WonderBotList.prototype.getUser = function (id) { + return this._request({ + url: "/user/" + Util_1.Util.resolveID(id), + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + return WonderBotList; +}(Service_1.Service)); +exports.default = WonderBotList; diff --git a/lib/Interface/Lists/YABL.d.ts b/lib/Interface/Lists/YABL.d.ts new file mode 100644 index 00000000..5902a223 --- /dev/null +++ b/lib/Interface/Lists/YABL.d.ts @@ -0,0 +1,48 @@ +import { Service, ServicePostOptions } from '../Service'; +import { IDResolvable } from '../../Utils/Util'; +import { Query } from '../../Utils/Constants'; +/** + * Represents the YABL service. + * @see https://yabl.xyz/api + */ +export default class YABL extends Service { + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** The logo URL. */ + static get logoURL(): string; + /** Service's name. */ + static get serviceName(): string; + /** The website URL. */ + static get websiteURL(): string; + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + static post(options: ServicePostOptions): Promise>; + /** Invalidates the token being used in the request. */ + invalidate(): Promise>; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + getBot(id: IDResolvable): Promise>; + /** Gets 20 random bots from this service. */ + getRandomBots(): Promise>; + /** + * Gets the user's bots listed for this service. + * @param id The user's ID + */ + getUserBots(id: IDResolvable): Promise>; + /** Gets a list of bots on this service. */ + getBots(): Promise>; + /** + * Gets a page of bots on this service. + * @param query The query string that will be used in the request + */ + getBotsByPage(query: Query): Promise>; + /** Gets a list of unverified bots on this service. */ + getUnverifiedBots(): Promise>; +} diff --git a/lib/Interface/Lists/YABL.js b/lib/Interface/Lists/YABL.js new file mode 100644 index 00000000..aa52c916 --- /dev/null +++ b/lib/Interface/Lists/YABL.js @@ -0,0 +1,137 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var Service_1 = require("../Service"); +var Util_1 = require("../../Utils/Util"); +/** + * Represents the YABL service. + * @see https://yabl.xyz/api + */ +var YABL = /** @class */ (function (_super) { + __extends(YABL, _super); + function YABL() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(YABL, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + return ['yabl', 'yabl.xyz']; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(YABL, "logoURL", { + /** The logo URL. */ + get: function () { + return 'https://i.imgur.com/OFiMern.png'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(YABL, "serviceName", { + /** Service's name. */ + get: function () { + return 'Yet Another Bot List'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(YABL, "websiteURL", { + /** The website URL. */ + get: function () { + return 'https://yabl.xyz/'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(YABL, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return 'https://yabl.xyz/api'; + }, + enumerable: false, + configurable: true + }); + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request + */ + YABL.post = function (options) { + var token = options.token, clientID = options.clientID, serverCount = options.serverCount; + return _super._post.call(this, { + method: 'post', + url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", + headers: { Authorization: token }, + data: { guildCount: Util_1.Util.resolveCount(serverCount) } + }); + }; + /** Invalidates the token being used in the request. */ + YABL.prototype.invalidate = function () { + return this._request({ + url: '/token/invalidate', + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets the bot listed on this service. + * @param id The bot's ID + */ + YABL.prototype.getBot = function (id) { + return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); + }; + /** Gets 20 random bots from this service. */ + YABL.prototype.getRandomBots = function () { + return this._request({ url: '/bots' }); + }; + /** + * Gets the user's bots listed for this service. + * @param id The user's ID + */ + YABL.prototype.getUserBots = function (id) { + return this._request({ url: "/bots/user/" + Util_1.Util.resolveID(id) }); + }; + /** Gets a list of bots on this service. */ + YABL.prototype.getBots = function () { + return this._request({ + url: '/bots/all', + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + /** + * Gets a page of bots on this service. + * @param query The query string that will be used in the request + */ + YABL.prototype.getBotsByPage = function (query) { + return this._request({ url: '/bots/page', params: query }); + }; + /** Gets a list of unverified bots on this service. */ + YABL.prototype.getUnverifiedBots = function () { + return this._request({ + url: '/bots/unverified', + headers: { Authorization: this.token } + }, { + requiresToken: true + }); + }; + return YABL; +}(Service_1.Service)); +exports.default = YABL; diff --git a/lib/Interface/Poster.d.ts b/lib/Interface/Poster.d.ts new file mode 100644 index 00000000..0e75e028 --- /dev/null +++ b/lib/Interface/Poster.d.ts @@ -0,0 +1,100 @@ +import { CustomEvent, CustomService, eventHandler, PosterOptions, ServiceKey } from '../Utils/Constants'; +import { Service } from './Service'; +export interface manualPostOptions { + /** The server count to post to the service */ + serverCount: number; + /** The user count to post to the service */ + userCount?: number; + /** The voice connection count to post to the service */ + voiceConnections?: number; +} +/** A class that posts server count to listing site(s). */ +export declare class Poster { + /** The client that will be used to fetch the stats */ + client: PosterOptions['client']; + /** An array of custom services that the poster uses */ + customServices: CustomService[]; + /** The API keys that the poster is using */ + apiKeys: Record; + /** The options the poster was built with */ + readonly options: PosterOptions; + /** The list of event handlers for every custom event */ + handlers: Record; + /** The client filler used in the poster */ + private _clientFiller; + /** Interval that posts to all services */ + private _interval?; + /** + * @constructor + * @param options The options needed to construct the poster + */ + constructor(options: PosterOptions); + /** The client filler used in the poster */ + private get clientFiller(); + /** + * Retrieves the current server count of the client/shard. + * @returns Amount of servers the client/shard is in + */ + getServerCount(): Promise; + /** + * Retrieves the current user count of the client/shard. + * @returns Amount of users the client/shard is connected with + */ + getUserCount(): Promise; + /** + * Retrieves the current voice connection count of the client/shard. + * @returns Number of active voice connections + */ + getVoiceConnections(): Promise; + /** + * Creates an interval that posts to all services. + * @param interval The time (in ms) to reach to post to all {@link Service}s again + * @returns The interval that is responsible for posting + * @emits Poster#autopostSuccess + * @emits Poster#autopostFail + */ + startInterval(interval?: number): number; + /** Destroys the current interval. */ + stopInterval(): void; + /** + * Gets a service, autofilling its API key if the poster has it. + * @param service The service to get + */ + getService(service: ServiceKey): (Service | CustomService) | typeof Service | undefined; + /** + * Posts the current clients server count to a service. + * @param service The service to post to + * @see Poster#postManual + * @returns The result(s) of the post + * @emits Poster#postSuccess + * @emits Poster#postFail + */ + post(service?: ServiceKey | 'all'): Promise; + /** + * Manually posts a server count to a service. + * @param service The service to post to + * @param counts An object containing the tallies of servers, users and voice connections + * @returns The result(s) of the post + */ + postManual(service: ServiceKey | 'all', counts: manualPostOptions): Promise; + /** + * Adds an handler for an event. + * @param event The name of the event to add the handler to + * @param handler The function that is run with the event + * @returns The array of handlers currently set for that event + */ + addHandler(event: CustomEvent, handler: eventHandler): eventHandler[]; + /** + * Removes an handler for an event. + * @param event The name of the event to remove the handler from + * @param handler The function that is run with the event + * @returns The array of handlers currently set for that event + */ + removeHandler(event: CustomEvent, handler: eventHandler): eventHandler[]; + /** + * Manually triggers an event with custom arguments. + * @param {CustomEvent} event The name of the event to run the handlers for + * @param {...any} args The arguments to pass to the handlers + */ + runHandlers(event: CustomEvent, ...args: any[]): void; +} diff --git a/lib/Interface/Poster.js b/lib/Interface/Poster.js new file mode 100644 index 00000000..41b065a7 --- /dev/null +++ b/lib/Interface/Poster.js @@ -0,0 +1,319 @@ +"use strict"; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Poster = void 0; +var Constants_1 = require("../Utils/Constants"); +var EnsurePromise_1 = require("../Utils/EnsurePromise"); +var DBotsError_1 = require("../Utils/DBotsError"); +var ClientFiller_1 = require("./ClientFiller"); +var Service_1 = require("./Service"); +var promise_allsettled_1 = __importDefault(require("promise.allsettled")); +var DBotsError = DBotsError_1.errors.Error, TypeError = DBotsError_1.errors.TypeError; +/** A class that posts server count to listing site(s). */ +var Poster = /** @class */ (function () { + // #endregion + /** + * @constructor + * @param options The options needed to construct the poster + */ + function Poster(options) { + var _a, _b; + if (!options || typeof options !== 'object') + throw new DBotsError('INVALID_POSTER_OPTIONS'); + this.client = options.client; + this._clientFiller = null; + this.customServices = options.customServices || []; + this.apiKeys = options.apiKeys || {}; + this.options = options; + if (typeof options.useSharding !== 'boolean') + options.useSharding = true; + if (!this.client && !options.clientID) + throw new DBotsError('NO_CLIENT_OR_ID'); + if (this.client && !options.clientID) + Object.assign(options, { + clientID: (_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.clientID, + shard: (_b = this.clientFiller) === null || _b === void 0 ? void 0 : _b.shard + }); + if (!options.useSharding) + options.shard = undefined; + this.handlers = {}; + for (var _i = 0, SupportedEvents_1 = Constants_1.SupportedEvents; _i < SupportedEvents_1.length; _i++) { + var event_1 = SupportedEvents_1[_i]; + this.handlers[event_1] = []; + } + } + Object.defineProperty(Poster.prototype, "clientFiller", { + /** The client filler used in the poster */ + get: function () { + return (this._clientFiller || + (this.options.clientLibrary && this.client + ? (this._clientFiller = ClientFiller_1.getClientFiller(this.options.clientLibrary, this.client)) + : undefined)); + }, + enumerable: false, + configurable: true + }); + /** + * Retrieves the current server count of the client/shard. + * @returns Amount of servers the client/shard is in + */ + Poster.prototype.getServerCount = function () { + var _a; + if (this.options.serverCount) + // @ts-expect-error + return EnsurePromise_1.ensurePromise(this.options.serverCount); + if (!this.client) + throw new DBotsError('NO_CLIENT', 'server'); + if (!this.options.clientLibrary) + throw new DBotsError('UNKNOWN_CLIENT', 'server'); + return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.serverCount) || 0); + }; + /** + * Retrieves the current user count of the client/shard. + * @returns Amount of users the client/shard is connected with + */ + Poster.prototype.getUserCount = function () { + var _a; + if (this.options.userCount) + // @ts-expect-error + return EnsurePromise_1.ensurePromise(this.options.userCount); + if (!this.client) + throw new DBotsError('NO_CLIENT', 'user'); + if (!this.options.clientLibrary) + throw new DBotsError('UNKNOWN_CLIENT', 'user'); + return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.userCount) || 0); + }; + /** + * Retrieves the current voice connection count of the client/shard. + * @returns Number of active voice connections + */ + Poster.prototype.getVoiceConnections = function () { + var _a; + if (this.options.voiceConnections) + // @ts-expect-error + return EnsurePromise_1.ensurePromise(this.options.voiceConnections); + if (!this.client) + throw new DBotsError('NO_CLIENT', 'voice connection'); + if (!this.options.clientLibrary) + throw new DBotsError('UNKNOWN_CLIENT', 'voice connection'); + return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.voiceConnections) || 0); + }; + /** + * Creates an interval that posts to all services. + * @param interval The time (in ms) to reach to post to all {@link Service}s again + * @returns The interval that is responsible for posting + * @emits Poster#autopostSuccess + * @emits Poster#autopostFail + */ + Poster.prototype.startInterval = function (interval) { + var _this_1 = this; + if (interval === void 0) { interval = 1800000; } + this._interval && clearTimeout(this._interval); + this._interval = setInterval(function () { + return _this_1.post() + .then(function (result) { + _this_1.runHandlers('autopostSuccess', result); + return result; + }) + .catch(function (error) { return _this_1.runHandlers('autopostFail', error); }); + }, interval); + return this._interval; + }; + /** Destroys the current interval. */ + Poster.prototype.stopInterval = function () { + if (this._interval) + clearTimeout(this._interval); + }; + /** + * Gets a service, autofilling its API key if the poster has it. + * @param service The service to get + */ + Poster.prototype.getService = function (service) { + var _this_1 = this; + var serviceClass = Service_1.Service.get(service, this.customServices); + if (!serviceClass) + return undefined; + var keyName = serviceClass.aliases.find(function (key) { + return Object.keys(_this_1.apiKeys).includes(key); + }); + if (keyName) + return new serviceClass(this.apiKeys[keyName]); + else + return serviceClass; + }; + /** + * Posts the current clients server count to a service. + * @param service The service to post to + * @see Poster#postManual + * @returns The result(s) of the post + * @emits Poster#postSuccess + * @emits Poster#postFail + */ + Poster.prototype.post = function (service) { + if (service === void 0) { service = 'all'; } + var _this = this; + return new Promise(function (resolve, reject) { + return Promise.all([ + _this.getServerCount(), + _this.getUserCount(), + _this.getVoiceConnections() + ]) + .then(function (_a) { + var serverCount = _a[0], userCount = _a[1], voiceConnections = _a[2]; + _this + .postManual(service, { serverCount: serverCount, userCount: userCount, voiceConnections: voiceConnections }) + .then(resolve) + .catch(reject); + }) + .catch(reject); + }); + }; + /** + * Manually posts a server count to a service. + * @param service The service to post to + * @param counts An object containing the tallies of servers, users and voice connections + * @returns The result(s) of the post + */ + Poster.prototype.postManual = function (service, counts) { + var _this_1 = this; + var serverCount = counts.serverCount, userCount = counts.userCount, voiceConnections = counts.voiceConnections; + if (!service) + service = 'all'; + if (!this.apiKeys && !this.options.post) + return Promise.reject(new DBotsError('NO_API_KEYS')); + if (service === 'custom') + // @ts-expect-error + return EnsurePromise_1.ensurePromise( + // @ts-expect-error + this.options.post, this.options.clientID, serverCount, this.options.shard); + if (service === 'all') { + var services = Object.keys(this.apiKeys); + if (this.options.post) + services.push('custom'); + return promise_allsettled_1.default + .call(Promise, services.map(function (k) { + return _this_1.postManual(k, { serverCount: serverCount, userCount: userCount, voiceConnections: voiceConnections }); + })) + .then(function (requests) { + var _a, _b; + var rejected = [], hostnames = []; + for (var _i = 0, requests_1 = requests; _i < requests_1.length; _i++) { + var r = requests_1[_i]; + if (r.status == 'rejected') { + rejected.push(r); + // @ts-expect-error + if ((_b = (_a = r.reason) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.url) { + // @ts-expect-error + var hostname = new URL(r.reason.config.url).hostname; + if (hostname && !hostnames.includes(hostname)) + hostnames.push(hostname); + } + else + hostnames.push('???'); + } + } + if (rejected.length > 0) { + var msg = rejected.length + " request" + (rejected.length == 1 ? '' : 's') + " have been rejected.\n"; + if (hostnames.length > 0) + msg += "Failing hostnames: " + hostnames.join(', ') + "\n"; + msg += 'Please check the error from the following responses.\n'; + msg += rejected + .map(function (rej) { + var reason = rej.reason || rej; + return reason && + typeof reason == 'object' && + !(reason instanceof Error) + ? JSON.stringify(reason, null, 2) + : reason.toString(); + }) + .join('\n'); + throw new DBotsError('GENERIC', msg); + } + else { + // @ts-expect-error + return requests.map(function (r) { return r.value; }); + } + }); + } + if (!Object.keys(this.apiKeys).includes(service)) + return Promise.reject(new DBotsError('SERVICE_NO_KEY', service)); + var serviceClass = Service_1.Service.get(service, this.customServices); + if (!serviceClass) + return Promise.reject(new TypeError('INVALID_SERVICE', service)); + return new Promise(function (resolve, reject) { + serviceClass + .post({ + token: _this_1.apiKeys[service], + clientID: _this_1.options.clientID || '', + shard: _this_1.options.shard, + serverCount: serverCount, + userCount: userCount, + voiceConnections: voiceConnections + }) + .then(function (result) { + _this_1.runHandlers('postSuccess', result); + resolve(result); + }) + .catch(function (error) { + _this_1.runHandlers('postFail', error); + reject(error); + }); + }); + }; + /** + * Adds an handler for an event. + * @param event The name of the event to add the handler to + * @param handler The function that is run with the event + * @returns The array of handlers currently set for that event + */ + Poster.prototype.addHandler = function (event, handler) { + if (!Constants_1.SupportedEvents.includes(event)) + throw new TypeError('UNSUPPORTED_EVENT', 'add'); + if (typeof handler != 'function') + throw new DBotsError('HANDLER_INVALID'); + this.handlers[event].push(handler); + return this.handlers[event]; + }; + /** + * Removes an handler for an event. + * @param event The name of the event to remove the handler from + * @param handler The function that is run with the event + * @returns The array of handlers currently set for that event + */ + Poster.prototype.removeHandler = function (event, handler) { + if (!Constants_1.SupportedEvents.includes(event)) + throw new TypeError('UNSUPPORTED_EVENT', 'remove'); + if (typeof handler != 'function') + throw new DBotsError('HANDLER_INVALID'); + var index = this.handlers[event].indexOf(handler); + if (index >= 0) + this.handlers[event].splice(index, 1); + return this.handlers[event]; + }; + /** + * Manually triggers an event with custom arguments. + * @param {CustomEvent} event The name of the event to run the handlers for + * @param {...any} args The arguments to pass to the handlers + */ + Poster.prototype.runHandlers = function (event) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!Constants_1.SupportedEvents.includes(event)) + throw new TypeError('UNSUPPORTED_EVENT', 'run'); + for (var _a = 0, _b = this.handlers[event]; _a < _b.length; _a++) { + var handler = _b[_a]; + EnsurePromise_1.ensurePromise.apply(void 0, __spreadArray([handler], args)); + } + }; + return Poster; +}()); +exports.Poster = Poster; diff --git a/lib/Interface/Service.d.ts b/lib/Interface/Service.d.ts new file mode 100644 index 00000000..b77a743b --- /dev/null +++ b/lib/Interface/Service.d.ts @@ -0,0 +1,89 @@ +import { RequestForm } from '../Utils/FormatRequest'; +import { CustomService, Query, Shard } from '../Utils/Constants'; +import { CountResolvable, IDResolvable } from '../Utils/Util'; +/** Options provided when sending a service request */ +export interface ServiceRequestOptions { + /** Whether the request requires a token */ + requiresToken?: boolean; + /** Whether to prepend the service's base API url */ + appendBaseURL?: boolean; +} +/** Options provided when posting to a service */ +export interface ServicePostOptions { + /** The Authorization token for the request */ + token: string; + /** The client ID that the request will post for */ + clientID: IDResolvable; + /** The amount of servers that the client is in */ + serverCount: CountResolvable; + /** The amount of users that the client cached */ + userCount: CountResolvable; + /** The number of voice connections */ + voiceConnections?: CountResolvable; + /** The shard the request is representing */ + shard?: Shard; +} +/** Represents a basic service. */ +export declare class Service { + /** + * The token that will be used for the service. + * @private + */ + token: string; + /** + * @param token The token/key for the service + */ + constructor(token: string); + /** The base URL of the service's API. */ + static get baseURL(): string; + /** + * Gets a service from a key. + * @param key The name of the service to get + * @param extras An array of {@link CustomService}s to include + */ + static get(key: string, extras?: CustomService[]): typeof Service | null; + /** Gets every loaded service. */ + static getAll(): Record; + /** + * Posts statistics to this service. + * Internally, this is supposed to be used in extended classes. + * @param form The request form + * @param appendBaseURL Whether to append the service's base API url + * @private + */ + static _post(form: RequestForm, appendBaseURL?: boolean): Promise>; + /** + * Sends a request for the service interface. + * @param form The request form + * @param options The options of this request + * @private + */ + _request(form: RequestForm, options?: ServiceRequestOptions): Promise>; + /** + * Appends query string to a URL. + * @param url The URL to modify + * @param query The query to append + * @param appendBaseURL Whether to prepend the service's base API url + * @returns The modified URL + * @private + */ + _appendQuery(url: string, query: Query, appendBaseURL?: boolean): string; + /** The values that can be used to select the service. */ + static get aliases(): string[]; + /** + * The logo URL, used only for documentation. + * @private + */ + static get logoURL(): string; + /** + * Service's name, used only for documentation. + * @private + */ + static get serviceName(): string; + /** + * The website URL, used only for documentation. + * @private + */ + static get websiteURL(): string; + static post(options: ServicePostOptions): ReturnType; +} diff --git a/lib/Interface/Service.js b/lib/Interface/Service.js new file mode 100644 index 00000000..c66e3478 --- /dev/null +++ b/lib/Interface/Service.js @@ -0,0 +1,183 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Service = void 0; +var FormatRequest_1 = require("../Utils/FormatRequest"); +var DBotsError_1 = require("../Utils/DBotsError"); +var Error = DBotsError_1.errors.Error; +// @ts-expect-error +var buildURL_1 = __importDefault(require("axios/lib/helpers/buildURL")); +var Util_1 = require("../Utils/Util"); +/** Represents a basic service. */ +var Service = /** @class */ (function () { + /** + * @param token The token/key for the service + */ + function Service(token) { + this.token = token; + } + Object.defineProperty(Service, "baseURL", { + /** The base URL of the service's API. */ + get: function () { + return ''; + }, + enumerable: false, + configurable: true + }); + /** + * Gets a service from a key. + * @param key The name of the service to get + * @param extras An array of {@link CustomService}s to include + */ + Service.get = function (key, extras) { + if (extras === void 0) { extras = []; } + if (!key || typeof key !== 'string') + return null; + var services = __spreadArray(__spreadArray([], Object.values(serviceClasses)), extras); + for (var _i = 0, services_1 = services; _i < services_1.length; _i++) { + var service = services_1[_i]; + if (!service || !service.aliases || !service.post) + continue; + if (service.aliases.includes(key.toLowerCase())) + return service; + } + return null; + }; + /** Gets every loaded service. */ + Service.getAll = function () { + return serviceClasses; + }; + /** + * Posts statistics to this service. + * Internally, this is supposed to be used in extended classes. + * @param form The request form + * @param appendBaseURL Whether to append the service's base API url + * @private + */ + Service._post = function (form, appendBaseURL) { + if (appendBaseURL === void 0) { appendBaseURL = true; } + try { + this.serviceName; + } + catch (_a) { + return Promise.reject(new Error('CALLED_FROM_BASE')); + } + if (this.baseURL && appendBaseURL) + form.url = this.baseURL + form.url; + return FormatRequest_1.formatRequest(form); + }; + /** + * Sends a request for the service interface. + * @param form The request form + * @param options The options of this request + * @private + */ + Service.prototype._request = function (form, options) { + if (options === void 0) { options = {}; } + var _a = options.requiresToken, requiresToken = _a === void 0 ? false : _a, _b = options.appendBaseURL, appendBaseURL = _b === void 0 ? true : _b; + if (requiresToken && !this.token) + return Promise.reject(new Error('REQUIRES_TOKEN')); + Util_1.assert(this.constructor); + return FormatRequest_1.formatRequest(__assign(__assign({}, form), { url: (this.constructor.baseURL && appendBaseURL + ? this.constructor.baseURL + : '') + form.url })); + }; + /** + * Appends query string to a URL. + * @param url The URL to modify + * @param query The query to append + * @param appendBaseURL Whether to prepend the service's base API url + * @returns The modified URL + * @private + */ + Service.prototype._appendQuery = function (url, query, appendBaseURL) { + if (appendBaseURL === void 0) { appendBaseURL = true; } + Util_1.assert(this.constructor); + if (this.constructor.baseURL && appendBaseURL) + url = this.constructor.baseURL + url; + return buildURL_1.default(url, query); + }; + Object.defineProperty(Service, "aliases", { + /** The values that can be used to select the service. */ + get: function () { + throw 'This is just a placeholder prop, it should not be accessed'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Service, "logoURL", { + /** + * The logo URL, used only for documentation. + * @private + */ + get: function () { + throw 'This is just a placeholder prop, it should not be accessed'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Service, "serviceName", { + /** + * Service's name, used only for documentation. + * @private + */ + get: function () { + throw 'This is just a placeholder prop, it should not be accessed'; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Service, "websiteURL", { + /** + * The website URL, used only for documentation. + * @private + */ + get: function () { + throw 'This is just a placeholder prop, it should not be accessed'; + }, + enumerable: false, + configurable: true + }); + Service.post = function (options // eslint-disable-line @typescript-eslint/no-unused-vars + ) { + throw 'This is just a placeholder method, it should not be called'; + }; + return Service; +}()); +exports.Service = Service; +// Service loading +var serviceClasses = {}; +var usingNode = typeof process != 'undefined' && process.release.name == 'node'; +if (!usingNode) { + serviceClasses = require('../../.tmp/services-list'); +} +else { + var path_1 = eval('require')('path'); + var fs = eval('require')('fs'); + var listsDir_1 = path_1.join(__dirname, './Lists'); + fs.readdirSync(listsDir_1).forEach(function (fileName) { + if (fileName.endsWith('.d.ts')) + return; + var listClass = require(path_1.join(listsDir_1, fileName)).default; + if (listClass) + serviceClasses[path_1.parse(fileName).name] = listClass; + }); +} diff --git a/lib/Utils/Constants.d.ts b/lib/Utils/Constants.d.ts new file mode 100644 index 00000000..b40d348b --- /dev/null +++ b/lib/Utils/Constants.d.ts @@ -0,0 +1,111 @@ +import { PromiseResolvable } from './EnsurePromise'; +/** Options for a poster. */ +export interface PosterOptions { + /** + * An object that pairs a {@link ServiceKey} with their token + * @default {} + */ + apiKeys?: Record; + /** + * The client that a supported {@link Library} uses to manage the Discord application. + * Requires {@link #clientLibrary} to be present + */ + client?: object; + /** + * The client ID used for posting to a {@link Service}. + * Automatically filled in when {@link #client} is present + */ + clientID?: string; + /** The library that the client is based on */ + clientLibrary?: Library; + /** + * The function to use when posting to a server that uses the client ID, the amount of servers, and a {@link Shard}. + * This will be used when the {@link ServiceKey} is `custom` + */ + post?: PromiseResolvable; + /** The shard data for using different methods of posting to services */ + shard?: Shard; + /** The function to use when retrieving the amount of servers a client/shard is in, using the client as a parameter */ + serverCount?: PromiseResolvable; + /** The function to use when retrieving the amount of users a client/shard is connected with, using the client as a parameter */ + userCount?: PromiseResolvable; + /** The function to use when retrieving the number of active voice connections, using the client as a parameter */ + voiceConnections?: PromiseResolvable; + /** + * The custom services that the poster will use + * @default [] + */ + customServices?: CustomService[]; + /** + * Whether or not to use a {@link Service}s sharding methods when posting + * @default true + */ + useSharding?: boolean; +} +/** A shard that is used when posting to services. */ +export interface Shard { + count?: number; + id?: number; +} +/** The object that is given to {@link Service}s and {@link CustomService}s in order to send requests to them. */ +export interface PostRequestData { + /** The Authorization token for the request */ + token: string; + /** The client ID that the request will post for */ + clientID?: string; + /** The amount of servers that the client is in */ + serverCount?: number; + /** The amount of users that the client cached */ + userCount?: number; + /** The amount of voice connections the client has */ + voiceConnections?: number; + /** The shard the request is representing */ + shard?: Shard; +} +/** An object with all query parameters */ +export declare type Query = Record; +/** + * A mock of a {@link Service} that only consists of the nessessities for a poster to use it. + * When you're passing your custom services to method in this package, remmeber to use pass the actual service class, not an instance of it. + * @example + * class MyCustomService { + * static get aliases() { + * return ['a', 'string', 'array'] // string[] + * } + * + * static post() { + * return yourCustomPostMethod() // Promise + * } + * } + */ +export declare type CustomService = any; +/** + * A {@link Service} key supported by the package. + * This can also includes keys from {@link CustomService}s and can be `custom` if a {@link Poster} has a custom post function. + * @see {@link https://dbots.js.org/#/docs/main/master/general/services} + */ +export declare type ServiceKey = string; +/** + * A library supported by the package. Here are the available libraries: + * * discord.js + * * discord.io + * * discordie + * * eris + * * paracord + */ +export declare type Library = 'discord.js' | 'discord.io' | 'discordie' | 'eris' | 'paracord'; +/** + * Type of function to set for handlers + * @param result The result(s) of the post + */ +export declare type eventHandler = (result: object | object[]) => void; +/** + * An event that can be added an handler for. These are the available events: + * * autopostSuccess + * * autopostFail + * * postSuccess + * * postFail + */ +export declare type CustomEvent = 'autopostSuccess' | 'autopostFail' | 'postSuccess' | 'postFail'; +export declare const SupportedEvents: CustomEvent[]; +export declare const Package: any; diff --git a/lib/Utils/Constants.js b/lib/Utils/Constants.js new file mode 100644 index 00000000..2c49005a --- /dev/null +++ b/lib/Utils/Constants.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Package = exports.SupportedEvents = void 0; +exports.SupportedEvents = [ + 'autopostSuccess', + 'autopostFail', + 'postSuccess', + 'postFail' +]; +exports.Package = require('../../package.json'); diff --git a/lib/Utils/DBotsError.d.ts b/lib/Utils/DBotsError.d.ts new file mode 100644 index 00000000..1b421f16 --- /dev/null +++ b/lib/Utils/DBotsError.d.ts @@ -0,0 +1,64 @@ +/// +export declare const codeSymbol: unique symbol; +export declare const messages: Map<"INVALID_POSTER_OPTIONS" | "NO_CLIENT_OR_ID" | "UNKNOWN_CLIENT" | "NO_CLIENT" | "NO_API_KEYS" | "SERVICE_NO_KEY" | "INVALID_SERVICE" | "HANDLER_INVALID" | "UNSUPPORTED_EVENT" | "CALLED_FROM_BASE" | "REQUIRES_TOKEN" | "POSTING_UNSUPPORTED" | "INVALID_ID" | "INVALID_COUNT" | "COUNT_NEGATIVE" | "GENERIC", string | ((...args: any[]) => string)>; +/** + * Register an error code and message. + * @param sym Unique name for the error + * @param val Value of the error + */ +export declare function register(sym: errorKey, val: any): void; +declare type errorKey = keyof typeof messageObject; +declare const messageObject: { + INVALID_POSTER_OPTIONS: string; + NO_CLIENT_OR_ID: string; + UNKNOWN_CLIENT: (count_name: string) => string; + NO_CLIENT: (count_name: string) => string; + NO_API_KEYS: string; + SERVICE_NO_KEY: (service: string) => string; + INVALID_SERVICE: (service: string) => string; + HANDLER_INVALID: string; + UNSUPPORTED_EVENT: (action: string) => string; + CALLED_FROM_BASE: string; + REQUIRES_TOKEN: string; + POSTING_UNSUPPORTED: (service: string) => string; + INVALID_ID: string; + INVALID_COUNT: string; + COUNT_NEGATIVE: string; + GENERIC: (err: string) => string; +}; +export declare const errors: { + Error: { + new (key: errorKey, ...args: any[]): { + readonly name: string; + readonly code: any; + message: string; + stack?: string | undefined; + }; + captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; + stackTraceLimit: number; + }; + TypeError: { + new (key: errorKey, ...args: any[]): { + readonly name: string; + readonly code: any; + message: string; + stack?: string | undefined; + }; + captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; + stackTraceLimit: number; + }; + RangeError: { + new (key: errorKey, ...args: any[]): { + readonly name: string; + readonly code: any; + message: string; + stack?: string | undefined; + }; + captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; + prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; + stackTraceLimit: number; + }; +}; +export {}; diff --git a/lib/Utils/DBotsError.js b/lib/Utils/DBotsError.js new file mode 100644 index 00000000..ef176f59 --- /dev/null +++ b/lib/Utils/DBotsError.js @@ -0,0 +1,143 @@ +"use strict"; +// Taken from Discord.JS's way of making errors +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.errors = exports.register = exports.messages = exports.codeSymbol = void 0; +exports.codeSymbol = Symbol('code'); +exports.messages = new Map(); +// This is just a mock class to make docs work +/** + * Extend an error of some sort into a DBotsError. + * @param {string} key Error key + * @param {any[]} args Arguments to pass for util format or as function args + * @extends Error + * @private + */ +var DBotsError = /** @class */ (function (_super) { + __extends(DBotsError, _super); + function DBotsError() { + var _this = _super.call(this) || this; + _this.name = ''; + _this.code = ''; + return _this; + } + return DBotsError; +}(Error)); +/** + * Extend an error of some sort into a DBotsError. + * @param Base Base error to extend + * @returns The resulting class (as a class, not an instance) + */ +function makeDbotsError(Base) { + return /** @class */ (function (_super) { + __extends(DBotsError, _super); + function DBotsError(key) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var _this = _super.call(this, message(key, args)) || this; + // @ts-expect-error + _this[exports.codeSymbol] = key; + if (Error.captureStackTrace) + Error.captureStackTrace(_this, DBotsError); + return _this; + } + Object.defineProperty(DBotsError.prototype, "name", { + get: function () { + // @ts-expect-error + return _super.prototype.name + " [" + this[exports.codeSymbol] + "]"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DBotsError.prototype, "code", { + get: function () { + // @ts-expect-error + return this[exports.codeSymbol]; + }, + enumerable: false, + configurable: true + }); + return DBotsError; + }(Base)); +} +/** + * Format the message for an error. + * @param key Error key + * @param args Arguments to pass for util format or as function args + * @returns Formatted string + */ +function message(key, args) { + if (typeof key !== 'string') + throw new Error('Error message key must be a string'); + var msg = exports.messages.get(key); + if (!['string', 'function'].includes(typeof msg)) + throw new Error("An invalid error message key was used: " + key + "."); + if (typeof msg === 'function') + return msg.apply(void 0, args); + if (args === undefined || args.length === 0) + return msg; + args.unshift(msg); + return String.apply(void 0, args); +} +/** + * Register an error code and message. + * @param sym Unique name for the error + * @param val Value of the error + */ +function register(sym, val) { + exports.messages.set(sym, typeof val === 'function' ? val : String(val)); +} +exports.register = register; +var messageObject = { + INVALID_POSTER_OPTIONS: 'An object is required a parameter to construct a poster.', + NO_CLIENT_OR_ID: 'clientID must be defined when client is non-existant.', + UNKNOWN_CLIENT: function (count_name) { + return "Can't retrieve " + count_name + " count from non-existant client."; + }, + NO_CLIENT: function (count_name) { + return "Can't retrieve " + count_name + " count from unknown client."; + }, + NO_API_KEYS: "Can't post with a poster that has no API keys.", + SERVICE_NO_KEY: function (service) { + return "Can't post to \"" + service + "\" without an API key."; + }, + INVALID_SERVICE: function (service) { return "\"" + service + "\" is an invalid service."; }, + HANDLER_INVALID: 'Given handler is not a PromiseResolvable.', + UNSUPPORTED_EVENT: function (action) { + return "Can't " + action + " handler for an unsupported event."; + }, + CALLED_FROM_BASE: 'This function needs to be called by an extended class.', + REQUIRES_TOKEN: 'This endpoint requires a token.', + POSTING_UNSUPPORTED: function (service) { + return "The service " + service + " does not support posting."; + }, + INVALID_ID: 'An invalid ID was given.', + INVALID_COUNT: 'An invalid countable number was given.', + COUNT_NEGATIVE: 'A countable number cannot be negative.', + GENERIC: function (err) { return err; } +}; +for (var _i = 0, _a = Object.entries(messageObject); _i < _a.length; _i++) { + var _b = _a[_i], name_1 = _b[0], message_1 = _b[1]; + register(name_1, message_1); +} +exports.errors = { + Error: makeDbotsError(Error), + TypeError: makeDbotsError(TypeError), + RangeError: makeDbotsError(RangeError) +}; diff --git a/lib/Utils/EnsurePromise.d.ts b/lib/Utils/EnsurePromise.d.ts new file mode 100644 index 00000000..d62edb27 --- /dev/null +++ b/lib/Utils/EnsurePromise.d.ts @@ -0,0 +1,6 @@ +import { eventHandler } from './Constants'; +/** A generic string callback */ +export declare type stringCallback = (...args: any[]) => string; +/** Data that can be resolved to give a string. This can either be a Function or a Promise. */ +export declare type PromiseResolvable = stringCallback | eventHandler | Promise; +export declare function ensurePromise(func: ((...args: any[]) => T) | Promise, ...args: any[]): Promise | undefined; diff --git a/lib/Utils/EnsurePromise.js b/lib/Utils/EnsurePromise.js new file mode 100644 index 00000000..316eb18e --- /dev/null +++ b/lib/Utils/EnsurePromise.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ensurePromise = void 0; +function ensurePromise(func) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof func === 'function') + return new Promise(function (resolve) { return resolve(func.apply(void 0, args)); }); + else if (func instanceof Promise) + return func; +} +exports.ensurePromise = ensurePromise; diff --git a/lib/Utils/FormatRequest.d.ts b/lib/Utils/FormatRequest.d.ts new file mode 100644 index 00000000..25ad72f5 --- /dev/null +++ b/lib/Utils/FormatRequest.d.ts @@ -0,0 +1,27 @@ +import { AxiosRequestConfig, AxiosResponse } from 'axios'; +/** + * The response from the axios call + * @see {@link https://github.com/axios/axios#response-schema} + */ +export { AxiosResponse } from 'axios'; +/** + * @private + */ +export interface RequestForm { + /** The method to use */ + method?: AxiosRequestConfig['method']; + /** The URL for the request */ + url: string; + /** The headers to append to the request */ + headers?: Record; + /** The data to send with the request, if the method allows it */ + data?: Record; + /** The query parameters for the request */ + params?: Record; +} +/** + * Returns a request. + * @param opts An object containing the config for the request: only basic properties are documented, but all [Axios](https://github.com/axios/axios#request-config) parameters are valid + * @returns The request + */ +export declare function formatRequest(options: RequestForm): Promise; diff --git a/lib/Utils/FormatRequest.js b/lib/Utils/FormatRequest.js new file mode 100644 index 00000000..4e856a89 --- /dev/null +++ b/lib/Utils/FormatRequest.js @@ -0,0 +1,36 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatRequest = void 0; +var axios_1 = __importDefault(require("axios")); +var Constants_1 = require("./Constants"); +/** + * Returns a request. + * @param opts An object containing the config for the request: only basic properties are documented, but all [Axios](https://github.com/axios/axios#request-config) parameters are valid + * @returns The request + */ +function formatRequest(options) { + var opts = options; + if (!opts.method) + opts.method = 'get'; + // This is no longer needed, because the types enforce the correct properties + // if (opts.body) { + // opts.data = opts.body + // delete opts.body + // } + // if (opts.query) { + // opts.params = opts.query + // delete opts.query + // } + var userAgent = "dbots (https://github.com/dbots-pkg/dbots.js " + Constants_1.Package.version + ") Node.js/" + process.version; + if (!opts.headers) + opts.headers = { + 'User-Agent': userAgent + }; + else if (!opts.headers['User-Agent']) + opts.headers['User-Agent'] = userAgent; + return axios_1.default(opts); +} +exports.formatRequest = formatRequest; diff --git a/lib/Utils/Util.d.ts b/lib/Utils/Util.d.ts new file mode 100644 index 00000000..c0bceba8 --- /dev/null +++ b/lib/Utils/Util.d.ts @@ -0,0 +1,35 @@ +/** + * Data that can be resolved to give a Discord ID, this can be: + * * A string + * * A number + * * Any value with an `id` key + */ +export declare type IDResolvable = string | number | Record<'id', string>; +/** + * Data that can be resolved to give a finite and positive integer. + * This can include any value that can be parsed into an integer. + */ +export declare type CountResolvable = any; +/** Just a utility type representing an object */ +export declare type AnyObject = Record; +/** + * Enforces a type on its argument + * @private + */ +export declare function assert(value: any): asserts value is T; +/** + * Contains various general-purpose utility methods. + */ +export declare class Util { + constructor(); + /** + * Resolves data into a Discord ID. + * @param data The data to resolve + */ + static resolveID(data: IDResolvable): string; + /** + * Resolves data into a countable number that is finite and positive. + * @param data The data to resolve + */ + static resolveCount(data: CountResolvable): number; +} diff --git a/lib/Utils/Util.js b/lib/Utils/Util.js new file mode 100644 index 00000000..b6dd923c --- /dev/null +++ b/lib/Utils/Util.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Util = exports.assert = void 0; +var DBotsError_1 = require("./DBotsError"); +var DBotsError = DBotsError_1.errors.Error, RangeError = DBotsError_1.errors.RangeError, TypeError = DBotsError_1.errors.TypeError; +/** + * Enforces a type on its argument + * @private + */ +function assert(value) { } +exports.assert = assert; +/** + * Contains various general-purpose utility methods. + */ +var Util = /** @class */ (function () { + function Util() { + throw new Error("The " + this.constructor.name + " class may not be instantiated."); + } + /** + * Resolves data into a Discord ID. + * @param data The data to resolve + */ + Util.resolveID = function (data) { + if (typeof data === 'undefined' || data === null) + throw new DBotsError('INVALID_ID'); + var id = null; + if (typeof data === 'string') + id = data; + else if (typeof data === 'number') + id = String(data); + else if (typeof data === 'object' && + Object.prototype.hasOwnProperty.call(data, 'id') && + typeof data.id !== 'object') + return Util.resolveID(data.id); + else + throw new DBotsError('INVALID_ID'); + if (/^\d{17,19}$/.test(id)) + return id; + else + throw new DBotsError('INVALID_ID'); + }; + /** + * Resolves data into a countable number that is finite and positive. + * @param data The data to resolve + */ + Util.resolveCount = function (data) { + var count = parseInt(data); + if (isNaN(count)) + throw new TypeError('INVALID_COUNT'); + else if (count < 0) + throw new RangeError('COUNT_NEGATIVE'); + return count; + }; + return Util; +}()); +exports.Util = Util; diff --git a/lib/index.d.ts b/lib/index.d.ts new file mode 100644 index 00000000..626f0ebb --- /dev/null +++ b/lib/index.d.ts @@ -0,0 +1,10 @@ +import { Service } from './Interface/Service'; +export { Poster } from './Interface/Poster'; +export * as Constants from './Utils/Constants'; +export * as DBotsError from './Utils/DBotsError'; +export { ensurePromise } from './Utils/EnsurePromise'; +export { formatRequest } from './Utils/FormatRequest'; +export * as Util from './Utils/Util'; +export { Service }; +export declare const getService: typeof Service.get; +export declare const serviceClasses: Record; diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 00000000..eb1bd8cc --- /dev/null +++ b/lib/index.js @@ -0,0 +1,35 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.serviceClasses = exports.getService = exports.Service = exports.Util = exports.formatRequest = exports.ensurePromise = exports.DBotsError = exports.Constants = exports.Poster = void 0; +var Service_1 = require("./Interface/Service"); +Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return Service_1.Service; } }); +var Poster_1 = require("./Interface/Poster"); +Object.defineProperty(exports, "Poster", { enumerable: true, get: function () { return Poster_1.Poster; } }); +exports.Constants = __importStar(require("./Utils/Constants")); +exports.DBotsError = __importStar(require("./Utils/DBotsError")); +var EnsurePromise_1 = require("./Utils/EnsurePromise"); +Object.defineProperty(exports, "ensurePromise", { enumerable: true, get: function () { return EnsurePromise_1.ensurePromise; } }); +var FormatRequest_1 = require("./Utils/FormatRequest"); +Object.defineProperty(exports, "formatRequest", { enumerable: true, get: function () { return FormatRequest_1.formatRequest; } }); +exports.Util = __importStar(require("./Utils/Util")); +exports.getService = Service_1.Service.get; +exports.serviceClasses = Service_1.Service.getAll(); diff --git a/src/Interface/ClientFiller.ts b/src/Interface/ClientFiller.ts index 0030ba4f..799ba6c1 100644 --- a/src/Interface/ClientFiller.ts +++ b/src/Interface/ClientFiller.ts @@ -19,7 +19,7 @@ export class ClientFiller { this.client = client } - /** Gets the amount of users the bot has cached. */ + /** Gets the amount of users the bot can reach. */ get userCount(): number | undefined { return 0 } diff --git a/src/Interface/Clients/DiscordIO.ts b/src/Interface/Clients/DiscordIO.ts index d1440a5c..2539190e 100644 --- a/src/Interface/Clients/DiscordIO.ts +++ b/src/Interface/Clients/DiscordIO.ts @@ -1,3 +1,4 @@ +import { AnyObject } from '../../Utils/Util' import { Shard } from '../../Utils/Constants' import { ClientFiller } from '../ClientFiller' @@ -7,8 +8,13 @@ import { ClientFiller } from '../ClientFiller' */ export default class DiscordIO extends ClientFiller { get userCount() { - if (!this.client.users) return undefined - return Object.keys(this.client.users).length + if (!this.client.servers) return undefined + return Object.keys(this.client.servers) + .map((id) => this.client.servers[id]) + .reduce( + (count: number, guild: AnyObject) => count + guild.member_count, + 0 + ) } get serverCount() { diff --git a/src/Interface/Clients/Discordie.ts b/src/Interface/Clients/Discordie.ts index bf70565b..8402057e 100644 --- a/src/Interface/Clients/Discordie.ts +++ b/src/Interface/Clients/Discordie.ts @@ -1,3 +1,4 @@ +import { AnyObject } from '../../Utils/Util' import { Shard } from '../../Utils/Constants' import { ClientFiller } from '../ClientFiller' @@ -7,11 +8,14 @@ import { ClientFiller } from '../ClientFiller' */ export default class Discordie extends ClientFiller { get userCount(): number { - return this.client.Guilds?.size + return this.client.Guilds?.toArray().reduce( + (count: number, guild: AnyObject) => count + guild.member_count, + 0 + ) } get serverCount(): number { - return this.client.Users?.size + return this.client.Guilds?.size } get voiceConnections(): number { diff --git a/src/Interface/Clients/Eris.ts b/src/Interface/Clients/Eris.ts index 0fa70ad4..9cd05d2c 100644 --- a/src/Interface/Clients/Eris.ts +++ b/src/Interface/Clients/Eris.ts @@ -1,3 +1,4 @@ +import { AnyObject } from '../../Utils/Util' import { ClientFiller } from '../ClientFiller' /** @@ -6,7 +7,10 @@ import { ClientFiller } from '../ClientFiller' */ export default class Eris extends ClientFiller { get userCount(): number { - return this.client.users?.size + return this.client.guilds?.reduce( + (count: number, guild: AnyObject) => count + guild.memberCount, + 0 + ) } get serverCount(): number { diff --git a/src/Interface/Clients/Paracord.ts b/src/Interface/Clients/Paracord.ts index 647bfc88..367a502e 100644 --- a/src/Interface/Clients/Paracord.ts +++ b/src/Interface/Clients/Paracord.ts @@ -1,3 +1,4 @@ +import { AnyObject } from '../../Utils/Util' import { ClientFiller } from '../ClientFiller' /** @@ -6,7 +7,10 @@ import { ClientFiller } from '../ClientFiller' */ export default class Paracord extends ClientFiller { get userCount(): number { - return this.client.users?.size + return Array.from(this.client.guilds.values as ArrayLike).reduce( + (count: number, guild: AnyObject) => count + guild.member_count, + 0 + ) } get serverCount(): number { From c274f4dc2c4759d0fe2ab99a477077afe433bd56 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Thu, 25 Mar 2021 10:18:57 -0500 Subject: [PATCH 06/10] fix: merge conflicts From c372dd7ac4cc749ce0e3756c54f1998b22e0554e Mon Sep 17 00:00:00 2001 From: Snazzah Date: Thu, 25 Mar 2021 10:22:38 -0500 Subject: [PATCH 07/10] fix: merge conflicts actually --- lib/Interface/ClientFiller.d.ts | 30 -- lib/Interface/ClientFiller.js | 93 ------ lib/Interface/Clients/DiscordIO.d.ts | 13 - lib/Interface/Clients/DiscordIO.js | 79 ----- lib/Interface/Clients/DiscordJS.d.ts | 13 - lib/Interface/Clients/DiscordJS.js | 83 ----- lib/Interface/Clients/Discordie.d.ts | 13 - lib/Interface/Clients/Discordie.js | 75 ----- lib/Interface/Clients/Eris.d.ts | 16 - lib/Interface/Clients/Eris.js | 78 ----- lib/Interface/Clients/Paracord.d.ts | 20 -- lib/Interface/Clients/Paracord.js | 75 ----- lib/Interface/Lists/Arcane.d.ts | 22 -- lib/Interface/Lists/Arcane.js | 93 ------ lib/Interface/Lists/AstroBotList.d.ts | 24 -- lib/Interface/Lists/AstroBotList.js | 95 ------ lib/Interface/Lists/BladeBotList.d.ts | 34 -- lib/Interface/Lists/BladeBotList.js | 106 ------ lib/Interface/Lists/Blist.d.ts | 65 ---- lib/Interface/Lists/Blist.js | 152 --------- lib/Interface/Lists/BotListSpace.d.ts | 58 ---- lib/Interface/Lists/BotListSpace.js | 141 -------- lib/Interface/Lists/BotsDataBase.d.ts | 39 --- lib/Interface/Lists/BotsDataBase.js | 112 ------- lib/Interface/Lists/BotsForDiscord.d.ts | 51 --- lib/Interface/Lists/BotsForDiscord.js | 121 ------- lib/Interface/Lists/BotsOnDiscord.d.ts | 37 --- lib/Interface/Lists/BotsOnDiscord.js | 107 ------- lib/Interface/Lists/Carbon.d.ts | 24 -- lib/Interface/Lists/Carbon.js | 87 ----- lib/Interface/Lists/DBots.d.ts | 34 -- lib/Interface/Lists/DBots.js | 105 ------ lib/Interface/Lists/DiscordAppsDev.d.ts | 41 --- lib/Interface/Lists/DiscordAppsDev.js | 119 ------- lib/Interface/Lists/DiscordBoats.d.ts | 47 --- lib/Interface/Lists/DiscordBoats.js | 118 ------- lib/Interface/Lists/DiscordBotDirectory.d.ts | 30 -- lib/Interface/Lists/DiscordBotDirectory.js | 93 ------ lib/Interface/Lists/DiscordBotList.d.ts | 22 -- lib/Interface/Lists/DiscordBotList.js | 91 ------ lib/Interface/Lists/DiscordBotsCo.d.ts | 28 -- lib/Interface/Lists/DiscordBotsCo.js | 104 ------ lib/Interface/Lists/DiscordBotsGG.d.ts | 55 ---- lib/Interface/Lists/DiscordBotsGG.js | 147 --------- lib/Interface/Lists/DiscordExtremeList.d.ts | 35 -- lib/Interface/Lists/DiscordExtremeList.js | 120 ------- lib/Interface/Lists/DiscordLabs.d.ts | 28 -- lib/Interface/Lists/DiscordLabs.js | 99 ------ lib/Interface/Lists/DiscordListology.d.ts | 45 --- lib/Interface/Lists/DiscordListology.js | 123 ------- lib/Interface/Lists/DiscordServices.d.ts | 45 --- lib/Interface/Lists/DiscordServices.js | 120 ------- lib/Interface/Lists/Disforge.d.ts | 31 -- lib/Interface/Lists/Disforge.js | 101 ------ lib/Interface/Lists/GlennBotList.d.ts | 45 --- lib/Interface/Lists/GlennBotList.js | 121 ------- lib/Interface/Lists/InfinityBots.d.ts | 33 -- lib/Interface/Lists/InfinityBots.js | 119 ------- lib/Interface/Lists/ListMyBots.d.ts | 52 --- lib/Interface/Lists/ListMyBots.js | 122 ------- lib/Interface/Lists/ParadiseBots.d.ts | 28 -- lib/Interface/Lists/ParadiseBots.js | 108 ------- lib/Interface/Lists/SpaceBotsList.d.ts | 29 -- lib/Interface/Lists/SpaceBotsList.js | 95 ------ lib/Interface/Lists/TopCord.d.ts | 32 -- lib/Interface/Lists/TopCord.js | 102 ------ lib/Interface/Lists/TopGG.d.ts | 62 ---- lib/Interface/Lists/TopGG.js | 159 --------- lib/Interface/Lists/VoidBots.d.ts | 44 --- lib/Interface/Lists/VoidBots.js | 134 -------- lib/Interface/Lists/WonderBotList.d.ts | 33 -- lib/Interface/Lists/WonderBotList.js | 110 ------- lib/Interface/Lists/YABL.d.ts | 48 --- lib/Interface/Lists/YABL.js | 137 -------- lib/Interface/Poster.d.ts | 100 ------ lib/Interface/Poster.js | 319 ------------------- lib/Interface/Service.d.ts | 89 ------ lib/Interface/Service.js | 183 ----------- lib/Utils/Constants.d.ts | 111 ------- lib/Utils/Constants.js | 10 - lib/Utils/DBotsError.d.ts | 64 ---- lib/Utils/DBotsError.js | 143 --------- lib/Utils/EnsurePromise.d.ts | 6 - lib/Utils/EnsurePromise.js | 14 - lib/Utils/FormatRequest.d.ts | 27 -- lib/Utils/FormatRequest.js | 36 --- lib/Utils/Util.d.ts | 35 -- lib/Utils/Util.js | 56 ---- lib/index.d.ts | 10 - lib/index.js | 35 -- 90 files changed, 6588 deletions(-) delete mode 100644 lib/Interface/ClientFiller.d.ts delete mode 100644 lib/Interface/ClientFiller.js delete mode 100644 lib/Interface/Clients/DiscordIO.d.ts delete mode 100644 lib/Interface/Clients/DiscordIO.js delete mode 100644 lib/Interface/Clients/DiscordJS.d.ts delete mode 100644 lib/Interface/Clients/DiscordJS.js delete mode 100644 lib/Interface/Clients/Discordie.d.ts delete mode 100644 lib/Interface/Clients/Discordie.js delete mode 100644 lib/Interface/Clients/Eris.d.ts delete mode 100644 lib/Interface/Clients/Eris.js delete mode 100644 lib/Interface/Clients/Paracord.d.ts delete mode 100644 lib/Interface/Clients/Paracord.js delete mode 100644 lib/Interface/Lists/Arcane.d.ts delete mode 100644 lib/Interface/Lists/Arcane.js delete mode 100644 lib/Interface/Lists/AstroBotList.d.ts delete mode 100644 lib/Interface/Lists/AstroBotList.js delete mode 100644 lib/Interface/Lists/BladeBotList.d.ts delete mode 100644 lib/Interface/Lists/BladeBotList.js delete mode 100644 lib/Interface/Lists/Blist.d.ts delete mode 100644 lib/Interface/Lists/Blist.js delete mode 100644 lib/Interface/Lists/BotListSpace.d.ts delete mode 100644 lib/Interface/Lists/BotListSpace.js delete mode 100644 lib/Interface/Lists/BotsDataBase.d.ts delete mode 100644 lib/Interface/Lists/BotsDataBase.js delete mode 100644 lib/Interface/Lists/BotsForDiscord.d.ts delete mode 100644 lib/Interface/Lists/BotsForDiscord.js delete mode 100644 lib/Interface/Lists/BotsOnDiscord.d.ts delete mode 100644 lib/Interface/Lists/BotsOnDiscord.js delete mode 100644 lib/Interface/Lists/Carbon.d.ts delete mode 100644 lib/Interface/Lists/Carbon.js delete mode 100644 lib/Interface/Lists/DBots.d.ts delete mode 100644 lib/Interface/Lists/DBots.js delete mode 100644 lib/Interface/Lists/DiscordAppsDev.d.ts delete mode 100644 lib/Interface/Lists/DiscordAppsDev.js delete mode 100644 lib/Interface/Lists/DiscordBoats.d.ts delete mode 100644 lib/Interface/Lists/DiscordBoats.js delete mode 100644 lib/Interface/Lists/DiscordBotDirectory.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotDirectory.js delete mode 100644 lib/Interface/Lists/DiscordBotList.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotList.js delete mode 100644 lib/Interface/Lists/DiscordBotsCo.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotsCo.js delete mode 100644 lib/Interface/Lists/DiscordBotsGG.d.ts delete mode 100644 lib/Interface/Lists/DiscordBotsGG.js delete mode 100644 lib/Interface/Lists/DiscordExtremeList.d.ts delete mode 100644 lib/Interface/Lists/DiscordExtremeList.js delete mode 100644 lib/Interface/Lists/DiscordLabs.d.ts delete mode 100644 lib/Interface/Lists/DiscordLabs.js delete mode 100644 lib/Interface/Lists/DiscordListology.d.ts delete mode 100644 lib/Interface/Lists/DiscordListology.js delete mode 100644 lib/Interface/Lists/DiscordServices.d.ts delete mode 100644 lib/Interface/Lists/DiscordServices.js delete mode 100644 lib/Interface/Lists/Disforge.d.ts delete mode 100644 lib/Interface/Lists/Disforge.js delete mode 100644 lib/Interface/Lists/GlennBotList.d.ts delete mode 100644 lib/Interface/Lists/GlennBotList.js delete mode 100644 lib/Interface/Lists/InfinityBots.d.ts delete mode 100644 lib/Interface/Lists/InfinityBots.js delete mode 100644 lib/Interface/Lists/ListMyBots.d.ts delete mode 100644 lib/Interface/Lists/ListMyBots.js delete mode 100644 lib/Interface/Lists/ParadiseBots.d.ts delete mode 100644 lib/Interface/Lists/ParadiseBots.js delete mode 100644 lib/Interface/Lists/SpaceBotsList.d.ts delete mode 100644 lib/Interface/Lists/SpaceBotsList.js delete mode 100644 lib/Interface/Lists/TopCord.d.ts delete mode 100644 lib/Interface/Lists/TopCord.js delete mode 100644 lib/Interface/Lists/TopGG.d.ts delete mode 100644 lib/Interface/Lists/TopGG.js delete mode 100644 lib/Interface/Lists/VoidBots.d.ts delete mode 100644 lib/Interface/Lists/VoidBots.js delete mode 100644 lib/Interface/Lists/WonderBotList.d.ts delete mode 100644 lib/Interface/Lists/WonderBotList.js delete mode 100644 lib/Interface/Lists/YABL.d.ts delete mode 100644 lib/Interface/Lists/YABL.js delete mode 100644 lib/Interface/Poster.d.ts delete mode 100644 lib/Interface/Poster.js delete mode 100644 lib/Interface/Service.d.ts delete mode 100644 lib/Interface/Service.js delete mode 100644 lib/Utils/Constants.d.ts delete mode 100644 lib/Utils/Constants.js delete mode 100644 lib/Utils/DBotsError.d.ts delete mode 100644 lib/Utils/DBotsError.js delete mode 100644 lib/Utils/EnsurePromise.d.ts delete mode 100644 lib/Utils/EnsurePromise.js delete mode 100644 lib/Utils/FormatRequest.d.ts delete mode 100644 lib/Utils/FormatRequest.js delete mode 100644 lib/Utils/Util.d.ts delete mode 100644 lib/Utils/Util.js delete mode 100644 lib/index.d.ts delete mode 100644 lib/index.js diff --git a/lib/Interface/ClientFiller.d.ts b/lib/Interface/ClientFiller.d.ts deleted file mode 100644 index 733dcc26..00000000 --- a/lib/Interface/ClientFiller.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Library, Shard } from '../Utils/Constants'; -import { AnyObject } from '../Utils/Util'; -/** - * A class that gets certain values from a client. - * @private - */ -export declare class ClientFiller { - /** The client that will be used for the filler. */ - client: AnyObject; - /** - * @param client The client that will be used - */ - constructor(client: object); - /** Gets the amount of users the bot can reach. */ - get userCount(): number | undefined; - /** Gets the amount of servers the bot has cached. */ - get serverCount(): number | undefined; - /** Gets the amount of voice connectinos the bot is using. */ - get voiceConnections(): number | undefined; - /** Gets the client ID (technically the user ID) of the bot. */ - get clientID(): string | undefined; - /** Gets the shard of the bot. */ - get shard(): Shard | undefined; -} -/** - * Gets a client filler from a library. - * @param libraryName The name of the library to get - * @param client The client that the library made - */ -export declare function getClientFiller(libraryName: Library, client: object): ClientFiller; diff --git a/lib/Interface/ClientFiller.js b/lib/Interface/ClientFiller.js deleted file mode 100644 index 09cdd7bb..00000000 --- a/lib/Interface/ClientFiller.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getClientFiller = exports.ClientFiller = void 0; -var DBotsError_1 = require("../Utils/DBotsError"); -/** - * A class that gets certain values from a client. - * @private - */ -var ClientFiller = /** @class */ (function () { - /** - * @param client The client that will be used - */ - function ClientFiller(client) { - if (!client || typeof client != 'object') - throw new DBotsError_1.errors.Error('UNKNOWN_CLIENT'); - this.client = client; - } - Object.defineProperty(ClientFiller.prototype, "userCount", { - /** Gets the amount of users the bot can reach. */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "serverCount", { - /** Gets the amount of servers the bot has cached. */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "voiceConnections", { - /** Gets the amount of voice connectinos the bot is using. */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "clientID", { - /** Gets the client ID (technically the user ID) of the bot. */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ClientFiller.prototype, "shard", { - /** Gets the shard of the bot. */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - return ClientFiller; -}()); -exports.ClientFiller = ClientFiller; -/** - * Gets a client filler from a library. - * @param libraryName The name of the library to get - * @param client The client that the library made - */ -function getClientFiller(libraryName, client) { - if (!client) - throw new Error('No client was provided!'); - switch (libraryName) { - case 'discordie': { - return new (require('./Clients/Discordie') - .default)(client); - } - case 'discord.io': { - return new (require('./Clients/DiscordIO') - .default)(client); - } - case 'discord.js': { - return new (require('./Clients/DiscordJS') - .default)(client); - } - case 'eris': { - return new (require('./Clients/Eris').default)(client); - } - case 'paracord': { - return new (require('./Clients/Paracord').default)(client); - } - default: { - throw new Error("Unknown client '" + libraryName + "'"); - } - } -} -exports.getClientFiller = getClientFiller; diff --git a/lib/Interface/Clients/DiscordIO.d.ts b/lib/Interface/Clients/DiscordIO.d.ts deleted file mode 100644 index 6426dc3d..00000000 --- a/lib/Interface/Clients/DiscordIO.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Shard } from '../../Utils/Constants'; -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for discord.io clients. - * @private - */ -export default class DiscordIO extends ClientFiller { - get userCount(): any; - get serverCount(): number | undefined; - get voiceConnections(): number | undefined; - get clientID(): string | undefined; - get shard(): Shard | undefined; -} diff --git a/lib/Interface/Clients/DiscordIO.js b/lib/Interface/Clients/DiscordIO.js deleted file mode 100644 index ee8a037e..00000000 --- a/lib/Interface/Clients/DiscordIO.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for discord.io clients. - * @private - */ -var DiscordIO = /** @class */ (function (_super) { - __extends(DiscordIO, _super); - function DiscordIO() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordIO.prototype, "userCount", { - get: function () { - var _this = this; - if (!this.client.servers) - return undefined; - return Object.keys(this.client.servers) - .map(function (id) { return _this.client.servers[id]; }) - .reduce(function (count, guild) { return count + guild.member_count; }, 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "serverCount", { - get: function () { - if (!this.client.servers) - return undefined; - return Object.keys(this.client.servers).length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "voiceConnections", { - get: function () { - if (!this.client._vChannels) - return undefined; - return Object.keys(this.client._vChannels).length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "clientID", { - get: function () { - return this.client.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordIO.prototype, "shard", { - get: function () { - return this.client._shard - ? { - id: this.client._shard[0], - count: this.client._shard[1] - } - : undefined; - }, - enumerable: false, - configurable: true - }); - return DiscordIO; -}(ClientFiller_1.ClientFiller)); -exports.default = DiscordIO; diff --git a/lib/Interface/Clients/DiscordJS.d.ts b/lib/Interface/Clients/DiscordJS.d.ts deleted file mode 100644 index 140f52ca..00000000 --- a/lib/Interface/Clients/DiscordJS.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Shard } from '../../Utils/Constants'; -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for discord.js clients. - * @private - */ -export default class DiscordJS extends ClientFiller { - get userCount(): number; - get serverCount(): number; - get voiceConnections(): number; - get clientID(): string | undefined; - get shard(): Shard | undefined; -} diff --git a/lib/Interface/Clients/DiscordJS.js b/lib/Interface/Clients/DiscordJS.js deleted file mode 100644 index f0792003..00000000 --- a/lib/Interface/Clients/DiscordJS.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for discord.js clients. - * @private - */ -var DiscordJS = /** @class */ (function (_super) { - __extends(DiscordJS, _super); - function DiscordJS() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordJS.prototype, "userCount", { - get: function () { - var _a, _b, _c, _d, _e; - if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') - return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.reduce(function (count, guild) { return count + guild.memberCount; }, 0); - else - return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.reduce(function (count, guild) { return count + guild.memberCount; }, 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "serverCount", { - get: function () { - var _a, _b, _c, _d, _e; - if (((_b = (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'GuildManager') - return (_d = (_c = this.client.guilds) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.size; - else - return (_e = this.client.guilds) === null || _e === void 0 ? void 0 : _e.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "voiceConnections", { - get: function () { - var _a, _b; - if (this.client.voice) - return ((_a = this.client.voice.broadcasts) === null || _a === void 0 ? void 0 : _a.length) || 0; - else - return (_b = this.client.broadcasts) === null || _b === void 0 ? void 0 : _b.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordJS.prototype, "shard", { - get: function () { - return this.client.shard - ? { - id: this.client.shard.id, - count: this.client.shard.count - } - : undefined; - }, - enumerable: false, - configurable: true - }); - return DiscordJS; -}(ClientFiller_1.ClientFiller)); -exports.default = DiscordJS; diff --git a/lib/Interface/Clients/Discordie.d.ts b/lib/Interface/Clients/Discordie.d.ts deleted file mode 100644 index 41bb3741..00000000 --- a/lib/Interface/Clients/Discordie.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Shard } from '../../Utils/Constants'; -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for discordie clients. - * @private - */ -export default class Discordie extends ClientFiller { - get userCount(): number; - get serverCount(): number; - get voiceConnections(): number; - get clientID(): string | undefined; - get shard(): Shard | undefined; -} diff --git a/lib/Interface/Clients/Discordie.js b/lib/Interface/Clients/Discordie.js deleted file mode 100644 index 9e8bd909..00000000 --- a/lib/Interface/Clients/Discordie.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for discordie clients. - * @private - */ -var Discordie = /** @class */ (function (_super) { - __extends(Discordie, _super); - function Discordie() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Discordie.prototype, "userCount", { - get: function () { - var _a; - return (_a = this.client.Guilds) === null || _a === void 0 ? void 0 : _a.toArray().reduce(function (count, guild) { return count + guild.member_count; }, 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "serverCount", { - get: function () { - var _a; - return (_a = this.client.Guilds) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "voiceConnections", { - get: function () { - var _a; - return (_a = this.client.VoiceConnections) === null || _a === void 0 ? void 0 : _a.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.User) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Discordie.prototype, "shard", { - get: function () { - var _a, _b; - return ((_a = this.client.options) === null || _a === void 0 ? void 0 : _a.shardId) && ((_b = this.client.options) === null || _b === void 0 ? void 0 : _b.shardCount) - ? { - id: this.client.options.shardId, - count: this.client.options.shardCount - } - : undefined; - }, - enumerable: false, - configurable: true - }); - return Discordie; -}(ClientFiller_1.ClientFiller)); -exports.default = Discordie; diff --git a/lib/Interface/Clients/Eris.d.ts b/lib/Interface/Clients/Eris.d.ts deleted file mode 100644 index 3d5e3309..00000000 --- a/lib/Interface/Clients/Eris.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for Eris clients. - * @private - */ -export default class Eris extends ClientFiller { - get userCount(): number; - get serverCount(): number; - get voiceConnections(): number; - get clientID(): string | undefined; - /** - * This client does not natively support sharding. - * @private - */ - get shard(): undefined; -} diff --git a/lib/Interface/Clients/Eris.js b/lib/Interface/Clients/Eris.js deleted file mode 100644 index 0c437440..00000000 --- a/lib/Interface/Clients/Eris.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for Eris clients. - * @private - */ -var Eris = /** @class */ (function (_super) { - __extends(Eris, _super); - function Eris() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Eris.prototype, "userCount", { - get: function () { - var _a; - return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.reduce(function (count, guild) { return count + guild.memberCount; }, 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "serverCount", { - get: function () { - var _a; - return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "voiceConnections", { - get: function () { - var _a, _b, _c, _d; - if (((_b = (_a = this.client.voiceConnections) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) === - 'VoiceConnectionManager') - return (_c = this.client.voiceConnections) === null || _c === void 0 ? void 0 : _c.size; - else - return Object.keys(((_d = this.client.voiceConnections) === null || _d === void 0 ? void 0 : _d.pendingGuilds) || {}) - .length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Eris.prototype, "shard", { - /** - * This client does not natively support sharding. - * @private - */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - return Eris; -}(ClientFiller_1.ClientFiller)); -exports.default = Eris; diff --git a/lib/Interface/Clients/Paracord.d.ts b/lib/Interface/Clients/Paracord.d.ts deleted file mode 100644 index 6a73fe51..00000000 --- a/lib/Interface/Clients/Paracord.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ClientFiller } from '../ClientFiller'; -/** - * Represents the client filler for Paracord clients. - * @private - */ -export default class Paracord extends ClientFiller { - get userCount(): number; - get serverCount(): number; - /** - * This client does not yet support voice connections. - * @private - */ - get voiceConnections(): number; - get clientID(): string | undefined; - /** - * This client handles sharding in a way that is not supported by dbots in its current structure. - * @private - */ - get shard(): undefined; -} diff --git a/lib/Interface/Clients/Paracord.js b/lib/Interface/Clients/Paracord.js deleted file mode 100644 index 5f603478..00000000 --- a/lib/Interface/Clients/Paracord.js +++ /dev/null @@ -1,75 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ClientFiller_1 = require("../ClientFiller"); -/** - * Represents the client filler for Paracord clients. - * @private - */ -var Paracord = /** @class */ (function (_super) { - __extends(Paracord, _super); - function Paracord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Paracord.prototype, "userCount", { - get: function () { - return Array.from(this.client.guilds.values).reduce(function (count, guild) { return count + guild.member_count; }, 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "serverCount", { - get: function () { - var _a; - return (_a = this.client.guilds) === null || _a === void 0 ? void 0 : _a.size; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "voiceConnections", { - /** - * This client does not yet support voice connections. - * @private - */ - get: function () { - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "clientID", { - get: function () { - var _a; - return (_a = this.client.user) === null || _a === void 0 ? void 0 : _a.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Paracord.prototype, "shard", { - /** - * This client handles sharding in a way that is not supported by dbots in its current structure. - * @private - */ - get: function () { - return undefined; - }, - enumerable: false, - configurable: true - }); - return Paracord; -}(ClientFiller_1.ClientFiller)); -exports.default = Paracord; diff --git a/lib/Interface/Lists/Arcane.d.ts b/lib/Interface/Lists/Arcane.d.ts deleted file mode 100644 index d5fee1df..00000000 --- a/lib/Interface/Lists/Arcane.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Arcane Bot Center service. - * @see https://arcane-center.xyz/documentation - */ -export default class Arcane extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; -} diff --git a/lib/Interface/Lists/Arcane.js b/lib/Interface/Lists/Arcane.js deleted file mode 100644 index 3b8de6cb..00000000 --- a/lib/Interface/Lists/Arcane.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Arcane Bot Center service. - * @see https://arcane-center.xyz/documentation - */ -var Arcane = /** @class */ (function (_super) { - __extends(Arcane, _super); - function Arcane() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Arcane, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['arcane', 'arcane-center.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://arcane-center.xyz/src/images/favicons/favicon.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "serviceName", { - /** Service's name. */ - get: function () { - return 'Arcane Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://arcane-center.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Arcane, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://arcane-center.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - Arcane.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, userCount = options.userCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - member_count: Util_1.Util.resolveCount(userCount), - shard_count: shard.count - } - : { - server_count: Util_1.Util.resolveCount(serverCount), - member_count: Util_1.Util.resolveCount(userCount) - } - }); - }; - return Arcane; -}(Service_1.Service)); -exports.default = Arcane; diff --git a/lib/Interface/Lists/AstroBotList.d.ts b/lib/Interface/Lists/AstroBotList.d.ts deleted file mode 100644 index e60c0ea1..00000000 --- a/lib/Interface/Lists/AstroBotList.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Astro Bot List service. - * @see https://botlists.com/api/docs - */ -export default class AstroBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets the stats of this bot. */ - getOwnStats(): Promise>; -} diff --git a/lib/Interface/Lists/AstroBotList.js b/lib/Interface/Lists/AstroBotList.js deleted file mode 100644 index 93b4a3d9..00000000 --- a/lib/Interface/Lists/AstroBotList.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Astro Bot List service. - * @see https://botlists.com/api/docs - */ -var AstroBotList = /** @class */ (function (_super) { - __extends(AstroBotList, _super); - function AstroBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(AstroBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['astrobotlist', 'botlists.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://cdn.bot-list.xyz/7364djcas.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Astro Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botlists.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AstroBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://botlists.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - AstroBotList.post = function (options) { - var token = options.token, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: '/bot', - headers: { token: token }, - data: { - guild_count: Util_1.Util.resolveCount(serverCount) - } - }); - }; - /** Gets the stats of this bot. */ - AstroBotList.prototype.getOwnStats = function () { - return this._request({ - url: '/bot', - headers: { token: this.token } - }, { - requiresToken: true - }); - }; - return AstroBotList; -}(Service_1.Service)); -exports.default = AstroBotList; diff --git a/lib/Interface/Lists/BladeBotList.d.ts b/lib/Interface/Lists/BladeBotList.d.ts deleted file mode 100644 index 83de9872..00000000 --- a/lib/Interface/Lists/BladeBotList.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the BladeBotList service. - * @see https://docs.bladebotlist.xyz/api/introduction.html - */ -export default class BladeBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Checks whether a user has given a vote to the bot - * @param botId The bot's ID - * @param userID The user's ID - */ - userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/BladeBotList.js b/lib/Interface/Lists/BladeBotList.js deleted file mode 100644 index 9031bdf8..00000000 --- a/lib/Interface/Lists/BladeBotList.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the BladeBotList service. - * @see https://docs.bladebotlist.xyz/api/introduction.html - */ -var BladeBotList = /** @class */ (function (_super) { - __extends(BladeBotList, _super); - function BladeBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BladeBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['bladebotlist', 'bladebotlist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://bladebotlist.xyz/img/logo.svg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'BladeBotList'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://bladebotlist.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BladeBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://bladebotlist.xyz/api/'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - BladeBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats/", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: shard.count - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - BladeBotList.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Checks whether a user has given a vote to the bot - * @param botId The bot's ID - * @param userID The user's ID - */ - BladeBotList.prototype.userVoted = function (botId, userID) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(botId) + "/votes/" + Util_1.Util.resolveID(userID) - }); - }; - return BladeBotList; -}(Service_1.Service)); -exports.default = BladeBotList; diff --git a/lib/Interface/Lists/Blist.d.ts b/lib/Interface/Lists/Blist.d.ts deleted file mode 100644 index 4a4e0035..00000000 --- a/lib/Interface/Lists/Blist.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Blist service. - * @see https://blist.xyz/docs/ - */ -export default class Blist extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the user's bots listed on this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the user's servers listed on this service. - * @param id The user's ID - */ - getUserServers(id: IDResolvable): Promise>; - /** - * Gets the server listed on this service. - * @param id The server's ID - */ - getServer(id: IDResolvable): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - getBotReviews(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query: Query): string; -} diff --git a/lib/Interface/Lists/Blist.js b/lib/Interface/Lists/Blist.js deleted file mode 100644 index 971ccf82..00000000 --- a/lib/Interface/Lists/Blist.js +++ /dev/null @@ -1,152 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Blist service. - * @see https://blist.xyz/docs/ - */ -var Blist = /** @class */ (function (_super) { - __extends(Blist, _super); - function Blist() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Blist, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['blist', 'blist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://blist.xyz/main_site/staticfiles/main/assets/blist.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "serviceName", { - /** Service's name. */ - get: function () { - return 'Blist'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://blist.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Blist, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://blist.xyz/api/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - Blist.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'patch', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats/", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: shard.count - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - Blist.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user's bots listed on this service. - * @param id The user's ID - */ - Blist.prototype.getUserBots = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/bots" }); - }; - /** - * Gets the user's servers listed on this service. - * @param id The user's ID - */ - Blist.prototype.getUserServers = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/servers" }); - }; - /** - * Gets the server listed on this service. - * @param id The server's ID - */ - Blist.prototype.getServer = function (id) { - return this._request({ url: "/server/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - Blist.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - Blist.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - Blist.prototype.getBotReviews = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) + "/reviews" }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - Blist.prototype.getWidgetURL = function (id, query) { - var actualQuery = Object.assign({ type: 'normal' }, query); - return this._appendQuery("/bot/" + Util_1.Util.resolveID(id) + "/widget", actualQuery); - }; - return Blist; -}(Service_1.Service)); -exports.default = Blist; diff --git a/lib/Interface/Lists/BotListSpace.d.ts b/lib/Interface/Lists/BotListSpace.d.ts deleted file mode 100644 index 966d8d48..00000000 --- a/lib/Interface/Lists/BotListSpace.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { CountResolvable, IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the botlist.space service. - * @see https://docs.botlist.space/ - */ -export default class BotListSpace extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets the statistics of this service. */ - getStatistics(): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; - /** Gets the bot listed on this service. */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Gets the uptime of a bot listed on this service. - * @param id The bot's ID - */ - getBotUptime(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param style The style of the widget, cannot be zero - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, style?: CountResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/BotListSpace.js b/lib/Interface/Lists/BotListSpace.js deleted file mode 100644 index 54928077..00000000 --- a/lib/Interface/Lists/BotListSpace.js +++ /dev/null @@ -1,141 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the botlist.space service. - * @see https://docs.botlist.space/ - */ -var BotListSpace = /** @class */ (function (_super) { - __extends(BotListSpace, _super); - function BotListSpace() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotListSpace, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botlistspace', 'botlist.space']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://botlist.space/img/android-chrome-512x512.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "serviceName", { - /** Service's name. */ - get: function () { - return 'botlist.space'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botlist.space'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotListSpace, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.botlist.space/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotListSpace.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** Gets the statistics of this service. */ - BotListSpace.prototype.getStatistics = function () { - return this._request({ url: '/statistics' }); - }; - /** Gets a list of bots on this service. */ - BotListSpace.prototype.getBots = function () { - return this._request({ url: '/bots' }); - }; - /** Gets the bot listed on this service. */ - BotListSpace.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - BotListSpace.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/upvotes", - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the uptime of a bot listed on this service. - * @param id The bot's ID - */ - BotListSpace.prototype.getBotUptime = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) + "/uptime" }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - BotListSpace.prototype.getUser = function (id) { - return this._request({ url: "/users/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - BotListSpace.prototype.getUserBots = function (id) { - return this._request({ url: "/users/" + Util_1.Util.resolveID(id) + "/bots" }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param style The style of the widget, cannot be zero - * @param query The query string that will be used in the request - */ - BotListSpace.prototype.getWidgetURL = function (id, style, query) { - if (style === void 0) { style = 1; } - if (query === void 0) { query = {}; } - return this._appendQuery("https://api.botlist.space/widget/" + Util_1.Util.resolveID(id) + "/" + Util_1.Util.resolveCount(style), query, false); - }; - return BotListSpace; -}(Service_1.Service)); -exports.default = BotListSpace; diff --git a/lib/Interface/Lists/BotsDataBase.d.ts b/lib/Interface/Lists/BotsDataBase.d.ts deleted file mode 100644 index e1888002..00000000 --- a/lib/Interface/Lists/BotsDataBase.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the BotsDataBase service. - * @see https://docs.botsdatabase.com/ - */ -export default class BotsDataBase extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/BotsDataBase.js b/lib/Interface/Lists/BotsDataBase.js deleted file mode 100644 index e4d08267..00000000 --- a/lib/Interface/Lists/BotsDataBase.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the BotsDataBase service. - * @see https://docs.botsdatabase.com/ - */ -var BotsDataBase = /** @class */ (function (_super) { - __extends(BotsDataBase, _super); - function BotsDataBase() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotsDataBase, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botsdatabase', 'botsdatabase.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://botsdatabase.com/images/icons/favicon-96x96.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "serviceName", { - /** Service's name. */ - get: function () { - return 'BotsDataBase'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botsdatabase.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsDataBase, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.botsdatabase.com/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotsDataBase.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { - Authorization: token, - 'Content-Type': 'application/json' - }, - data: { servers: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - BotsDataBase.prototype.getUser = function (id) { - return this._request({ url: "/users/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - BotsDataBase.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - BotsDataBase.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - return BotsDataBase; -}(Service_1.Service)); -exports.default = BotsDataBase; diff --git a/lib/Interface/Lists/BotsForDiscord.d.ts b/lib/Interface/Lists/BotsForDiscord.d.ts deleted file mode 100644 index fdd7dac7..00000000 --- a/lib/Interface/Lists/BotsForDiscord.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Bots For Discord service. - * @see https://docs.botsfordiscord.com/ - */ -export default class BotsForDiscord extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/BotsForDiscord.js b/lib/Interface/Lists/BotsForDiscord.js deleted file mode 100644 index 8ffe2f6a..00000000 --- a/lib/Interface/Lists/BotsForDiscord.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Bots For Discord service. - * @see https://docs.botsfordiscord.com/ - */ -var BotsForDiscord = /** @class */ (function (_super) { - __extends(BotsForDiscord, _super); - function BotsForDiscord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotsForDiscord, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botsfordiscord', 'botsfordiscord.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://botsfordiscord.com/img/manifest/icon-512x512.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "serviceName", { - /** Service's name. */ - get: function () { - return 'Bots For Discord'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://botsfordiscord.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsForDiscord, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://botsfordiscord.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotsForDiscord.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - BotsForDiscord.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - BotsForDiscord.prototype.getBotVotes = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) + "/votes" }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - BotsForDiscord.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - BotsForDiscord.prototype.getUserBots = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) + "/bots" }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - BotsForDiscord.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}); - }; - return BotsForDiscord; -}(Service_1.Service)); -exports.default = BotsForDiscord; diff --git a/lib/Interface/Lists/BotsOnDiscord.d.ts b/lib/Interface/Lists/BotsOnDiscord.d.ts deleted file mode 100644 index 8bc51e48..00000000 --- a/lib/Interface/Lists/BotsOnDiscord.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Bots On Discord service. - * @see https://bots.ondiscord.xyz/info/api - */ -export default class BotsOnDiscord extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Checks whether or not a user has reviewed a bot. - * @param id The bot's ID - * @param userId The user's ID - */ - checkReview(id: IDResolvable, userId: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/BotsOnDiscord.js b/lib/Interface/Lists/BotsOnDiscord.js deleted file mode 100644 index c8076e43..00000000 --- a/lib/Interface/Lists/BotsOnDiscord.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Bots On Discord service. - * @see https://bots.ondiscord.xyz/info/api - */ -var BotsOnDiscord = /** @class */ (function (_super) { - __extends(BotsOnDiscord, _super); - function BotsOnDiscord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(BotsOnDiscord, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['botsondiscord', 'bots.ondiscord.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://bots.ondiscord.xyz/favicon/android-chrome-256x256.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "serviceName", { - /** Service's name. */ - get: function () { - return 'Bots On Discord'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://bots.ondiscord.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(BotsOnDiscord, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://bots.ondiscord.xyz/bot-api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - BotsOnDiscord.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/guilds", - headers: { Authorization: token }, - data: { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Checks whether or not a user has reviewed a bot. - * @param id The bot's ID - * @param userId The user's ID - */ - BotsOnDiscord.prototype.checkReview = function (id, userId) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/review", - headers: { Authorization: this.token }, - params: { owner: Util_1.Util.resolveID(userId) } - }, { - requiresToken: true - }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - BotsOnDiscord.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("https://bots.ondiscord.xyz/bots/" + Util_1.Util.resolveID(id) + "/embed", query || {}, false); - }; - return BotsOnDiscord; -}(Service_1.Service)); -exports.default = BotsOnDiscord; diff --git a/lib/Interface/Lists/Carbon.d.ts b/lib/Interface/Lists/Carbon.d.ts deleted file mode 100644 index bb6a57a8..00000000 --- a/lib/Interface/Lists/Carbon.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Carbonitex service. - */ -export default class Carbon extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; -} diff --git a/lib/Interface/Lists/Carbon.js b/lib/Interface/Lists/Carbon.js deleted file mode 100644 index 871eb124..00000000 --- a/lib/Interface/Lists/Carbon.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Carbonitex service. - */ -var Carbon = /** @class */ (function (_super) { - __extends(Carbon, _super); - function Carbon() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Carbon, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['carbonitex', 'carbonitex.net', 'carbon']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/7N8ywwr.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "serviceName", { - /** Service's name. */ - get: function () { - return 'Carbonitex'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://www.carbonitex.net/Discord/bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Carbon, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://www.carbonitex.net/discord'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - Carbon.post = function (options) { - var token = options.token, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: '/data/botdata.php', - data: { key: token, servercount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** Gets a list of bots on this service. */ - Carbon.prototype.getBots = function () { - return this._request({ url: '/api/listedbots' }); - }; - return Carbon; -}(Service_1.Service)); -exports.default = Carbon; diff --git a/lib/Interface/Lists/DBots.d.ts b/lib/Interface/Lists/DBots.d.ts deleted file mode 100644 index 12cdb824..00000000 --- a/lib/Interface/Lists/DBots.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the DBots service. - * @see https://docs.dbots.co/ - */ -export default class DBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot's audit logs. - * @param id The bot's ID - */ - getAudit(id: IDResolvable): Promise>; - /** - * Regenerates the bot API token. - * @param id The bot's ID - */ - regenToken(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DBots.js b/lib/Interface/Lists/DBots.js deleted file mode 100644 index fda8b55b..00000000 --- a/lib/Interface/Lists/DBots.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the DBots service. - * @see https://docs.dbots.co/ - */ -var DBots = /** @class */ (function (_super) { - __extends(DBots, _super); - function DBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['dbots', 'dbots.co']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://gblobscdn.gitbook.com/spaces%2F-MO490c2KMEgwyXnbtbV%2Favatar-1607528014691.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'DBots.co'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://dbots.co/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://dbots.co/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot's audit logs. - * @param id The bot's ID - */ - DBots.prototype.getAudit = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/log", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Regenerates the bot API token. - * @param id The bot's ID - */ - DBots.prototype.regenToken = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/keys/regen", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - return DBots; -}(Service_1.Service)); -exports.default = DBots; diff --git a/lib/Interface/Lists/DiscordAppsDev.d.ts b/lib/Interface/Lists/DiscordAppsDev.d.ts deleted file mode 100644 index aa02ba12..00000000 --- a/lib/Interface/Lists/DiscordAppsDev.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { AnyObject, IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Apps service. - * @see https://discordapps.dev/en-GB/posts/docs/api-v2/ - */ -export default class DiscordAppsDev extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; - /** Gets a list of applications on this service. */ - getApps(): Promise>; - /** Gets a list of RPC applications on this service. */ - getRPCApps(): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Updates the bot with the data provided. - * @param id The bot's ID - * @param data The data being posted - */ - updateBot(id: IDResolvable, data: AnyObject): Promise>; -} diff --git a/lib/Interface/Lists/DiscordAppsDev.js b/lib/Interface/Lists/DiscordAppsDev.js deleted file mode 100644 index c499051f..00000000 --- a/lib/Interface/Lists/DiscordAppsDev.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Apps service. - * @see https://discordapps.dev/en-GB/posts/docs/api-v2/ - */ -var DiscordAppsDev = /** @class */ (function (_super) { - __extends(DiscordAppsDev, _super); - function DiscordAppsDev() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordAppsDev, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordappsdev', 'discordapps.dev']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://api.discordapps.dev/img/logo/logo128.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Apps'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordapps.dev'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordAppsDev, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordapps.dev/api/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DiscordAppsDev.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { bot: { count: Util_1.Util.resolveCount(serverCount) } } - }); - }; - /** Gets a list of bots on this service. */ - DiscordAppsDev.prototype.getBots = function () { - return this._request({ url: '/bots' }); - }; - /** Gets a list of applications on this service. */ - DiscordAppsDev.prototype.getApps = function () { - return this._request({ url: '/apps' }); - }; - /** Gets a list of RPC applications on this service. */ - DiscordAppsDev.prototype.getRPCApps = function () { - return this._request({ url: '/rpc' }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordAppsDev.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Updates the bot with the data provided. - * @param id The bot's ID - * @param data The data being posted - */ - DiscordAppsDev.prototype.updateBot = function (id, data) { - return this._request({ - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token }, - data: data - }, { - requiresToken: true - }); - }; - return DiscordAppsDev; -}(Service_1.Service)); -exports.default = DiscordAppsDev; diff --git a/lib/Interface/Lists/DiscordBoats.d.ts b/lib/Interface/Lists/DiscordBoats.d.ts deleted file mode 100644 index d3ef906d..00000000 --- a/lib/Interface/Lists/DiscordBoats.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Discord Boats service. - * @see https://discord.boats/api/docs - */ -export default class DiscordBoats extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - userVoted(id: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/DiscordBoats.js b/lib/Interface/Lists/DiscordBoats.js deleted file mode 100644 index 46b101d4..00000000 --- a/lib/Interface/Lists/DiscordBoats.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Boats service. - * @see https://discord.boats/api/docs - */ -var DiscordBoats = /** @class */ (function (_super) { - __extends(DiscordBoats, _super); - function DiscordBoats() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBoats, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordboats', 'discord.boats']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discord.boats/android-icon-192x192.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Boats'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discord.boats'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBoats, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discord.boats/api/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DiscordBoats.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordBoats.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - DiscordBoats.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - DiscordBoats.prototype.userVoted = function (id, userID) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/voted", - params: { id: Util_1.Util.resolveID(userID) } - }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - DiscordBoats.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("/widget/" + Util_1.Util.resolveID(id), query || {}); - }; - return DiscordBoats; -}(Service_1.Service)); -exports.default = DiscordBoats; diff --git a/lib/Interface/Lists/DiscordBotDirectory.d.ts b/lib/Interface/Lists/DiscordBotDirectory.d.ts deleted file mode 100644 index 4c18e86c..00000000 --- a/lib/Interface/Lists/DiscordBotDirectory.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Bot Directory service. - * @see https://botblock.org/lists/discordbotdirectory.net - */ -export default class DiscordBotDirectory extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * The docs for this endopoint exist only in a Discord message. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - */ - getWidgetURL(id: IDResolvable): string; -} diff --git a/lib/Interface/Lists/DiscordBotDirectory.js b/lib/Interface/Lists/DiscordBotDirectory.js deleted file mode 100644 index 85f0cac2..00000000 --- a/lib/Interface/Lists/DiscordBotDirectory.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Bot Directory service. - * @see https://botblock.org/lists/discordbotdirectory.net - */ -var DiscordBotDirectory = /** @class */ (function (_super) { - __extends(DiscordBotDirectory, _super); - function DiscordBotDirectory() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBotDirectory, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotdirectory', 'discordbotdirectory.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordbotdirectory.net/assets/img/logo.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Bot Directory'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordbotdirectory.net'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotDirectory, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discordbotdirectory.net/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * The docs for this endopoint exist only in a Discord message. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - DiscordBotDirectory.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/auth/stats/" + Util_1.Util.resolveID(clientID), - headers: { authorization: token, 'Content-Type': 'application/json' }, - data: { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - */ - DiscordBotDirectory.prototype.getWidgetURL = function (id) { - return this._appendQuery("/embed/" + Util_1.Util.resolveID(id), {}); - }; - return DiscordBotDirectory; -}(Service_1.Service)); -exports.default = DiscordBotDirectory; diff --git a/lib/Interface/Lists/DiscordBotList.d.ts b/lib/Interface/Lists/DiscordBotList.d.ts deleted file mode 100644 index ad1ce868..00000000 --- a/lib/Interface/Lists/DiscordBotList.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Discord Bot List service. - * @see https://discordbotlist.com/api-docs - */ -export default class DiscordBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; -} diff --git a/lib/Interface/Lists/DiscordBotList.js b/lib/Interface/Lists/DiscordBotList.js deleted file mode 100644 index b3b75481..00000000 --- a/lib/Interface/Lists/DiscordBotList.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Bot List service. - * @see https://discordbotlist.com/api-docs - */ -var DiscordBotList = /** @class */ (function (_super) { - __extends(DiscordBotList, _super); - function DiscordBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotlist', 'discordbotlist.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordbotlist.com/android-icon-192x192.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordbotlist.com'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discordbotlist.com/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard, userCount = options.userCount, voiceConnections = options.voiceConnections; - var data = { guilds: Util_1.Util.resolveCount(serverCount) }; - if (shard) - data.shard_id = shard.id; - if (userCount) - data.users = Util_1.Util.resolveCount(userCount); - if (voiceConnections) - data.voice_connections = Util_1.Util.resolveCount(voiceConnections); - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: "Bot " + token }, - data: data - }); - }; - return DiscordBotList; -}(Service_1.Service)); -exports.default = DiscordBotList; diff --git a/lib/Interface/Lists/DiscordBotsCo.d.ts b/lib/Interface/Lists/DiscordBotsCo.d.ts deleted file mode 100644 index cc362812..00000000 --- a/lib/Interface/Lists/DiscordBotsCo.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the DiscordBots.co service. - * @see https://discordbots.co/api-information - */ -export default class DiscordBotsCo extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordBotsCo.js b/lib/Interface/Lists/DiscordBotsCo.js deleted file mode 100644 index d56199de..00000000 --- a/lib/Interface/Lists/DiscordBotsCo.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the DiscordBots.co service. - * @see https://discordbots.co/api-information - */ -var DiscordBotsCo = /** @class */ (function (_super) { - __extends(DiscordBotsCo, _super); - function DiscordBotsCo() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordBotsCo, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotsco', 'discordbots.co']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://cdn.discordapp.com/avatars/688927563409522694/17cfd572fd3e2d3285534c12e0f58422.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "serviceName", { - /** Service's name. */ - get: function () { - return 'DiscordBots.co'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordbots.co'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsCo, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordbots.co/v1/public'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordBotsCo.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { - Authorization: token, - 'Content-Type': 'application/json' - }, - data: shard - ? { - serverCount: Util_1.Util.resolveCount(serverCount), - shardCount: shard.count - } - : { serverCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordBotsCo.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return DiscordBotsCo; -}(Service_1.Service)); -exports.default = DiscordBotsCo; diff --git a/lib/Interface/Lists/DiscordBotsGG.d.ts b/lib/Interface/Lists/DiscordBotsGG.d.ts deleted file mode 100644 index afc66bc1..00000000 --- a/lib/Interface/Lists/DiscordBotsGG.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** The user agent used options for the DiscordBotsGG service */ -export interface DiscordBotsGGUserAgent { - /** The bot's library */ - library: string; - /** The bot ID for the user agent */ - clientID: string; -} -/** - * Represents the Discord Bots service. - * @see https://discord.bots.gg/docs - */ -export default class DiscordBotsGG extends Service { - /** The user agent options for this service */ - private agent; - /** - * @param token The token/key for the service - * @param userAgent The user agent options of the service. Providing this is highly recommended. - */ - constructor(token: string, userAgent?: DiscordBotsGGUserAgent); - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Creates a compliant user agent to use for any API calls to Discord Bots. - * @param botID The ID of the bot that the agent will be identified with - * @param library The library the agent is using - */ - static userAgent(botID: IDResolvable, library?: string): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - * @param sanitized Whether to sanitize descriptions - */ - getBot(id: IDResolvable, sanitized?: boolean): Promise>; - /** - * Gets a list of bots on this service. - * @param query The query string that will be used in the request - */ - getBots(query?: Query): Promise>; -} diff --git a/lib/Interface/Lists/DiscordBotsGG.js b/lib/Interface/Lists/DiscordBotsGG.js deleted file mode 100644 index f32a17f9..00000000 --- a/lib/Interface/Lists/DiscordBotsGG.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -var Constants_1 = require("../../Utils/Constants"); -/** - * Represents the Discord Bots service. - * @see https://discord.bots.gg/docs - */ -var DiscordBotsGG = /** @class */ (function (_super) { - __extends(DiscordBotsGG, _super); - // - /** - * @param token The token/key for the service - * @param userAgent The user agent options of the service. Providing this is highly recommended. - */ - function DiscordBotsGG(token, userAgent) { - var _this = _super.call(this, token) || this; - _this.agent = { - library: (userAgent === null || userAgent === void 0 ? void 0 : userAgent.library) || 'unknown', - clientID: (userAgent === null || userAgent === void 0 ? void 0 : userAgent.clientID) || '000000000000000' - }; - return _this; - } - Object.defineProperty(DiscordBotsGG, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordbotsgg', 'discord.bots.gg']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://pbs.twimg.com/profile_images/1071582837030060032/kKV-I01n_400x400.jpg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discord.bots.gg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordBotsGG, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discord.bots.gg/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Creates a compliant user agent to use for any API calls to Discord Bots. - * @param botID The ID of the bot that the agent will be identified with - * @param library The library the agent is using - */ - DiscordBotsGG.userAgent = function (botID, library) { - if (library === void 0) { library = 'unknown'; } - return "dbots-0000/" + Constants_1.Package.version + " (" + library + "; +https://github.com/dbots-pkg/dbots.js) DBots/" + Util_1.Util.resolveID(botID); - }; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordBotsGG.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { - Authorization: token, - 'User-Agent': DiscordBotsGG.userAgent(clientID) - }, - data: shard - ? { - guildCount: Util_1.Util.resolveCount(serverCount), - shardId: shard.id, - shardCount: shard.count - } - : { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - * @param sanitized Whether to sanitize descriptions - */ - DiscordBotsGG.prototype.getBot = function (id, sanitized) { - if (sanitized === void 0) { sanitized = false; } - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id), - headers: { - Authorization: this.token, - 'User-Agent': DiscordBotsGG.userAgent(this.agent.clientID, this.agent.library) - }, - params: { sanitized: sanitized } - }, { - requiresToken: true - }); - }; - /** - * Gets a list of bots on this service. - * @param query The query string that will be used in the request - */ - DiscordBotsGG.prototype.getBots = function (query) { - return this._request({ - url: '/bots', - headers: { - Authorization: this.token, - 'User-Agent': DiscordBotsGG.userAgent(this.agent.clientID, this.agent.library) - }, - params: query - }, { - requiresToken: true - }); - }; - return DiscordBotsGG; -}(Service_1.Service)); -exports.default = DiscordBotsGG; diff --git a/lib/Interface/Lists/DiscordExtremeList.d.ts b/lib/Interface/Lists/DiscordExtremeList.d.ts deleted file mode 100644 index 633de098..00000000 --- a/lib/Interface/Lists/DiscordExtremeList.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Extreme List service. - * @see https://docs.discordextremelist.xyz/ - */ -export default class DiscordExtremeList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Gets the statistics of this service. */ - getStatistics(): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The bot's ID - */ - getUser(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordExtremeList.js b/lib/Interface/Lists/DiscordExtremeList.js deleted file mode 100644 index 5dcdeb1a..00000000 --- a/lib/Interface/Lists/DiscordExtremeList.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Extreme List service. - * @see https://docs.discordextremelist.xyz/ - */ -var DiscordExtremeList = /** @class */ (function (_super) { - __extends(DiscordExtremeList, _super); - function DiscordExtremeList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordExtremeList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordextremelist', 'discordextremelist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/4KjWg91.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Extreme List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordextremelist.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordExtremeList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordextremelist.xyz/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordExtremeList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { - guildCount: Util_1.Util.resolveCount(serverCount), - shardCount: shard ? Util_1.Util.resolveCount(shard.count) : undefined - } - }); - }; - /** Gets the statistics of this service. */ - DiscordExtremeList.prototype.getStatistics = function () { - return this._request({ - url: '/stats', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordExtremeList.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the user listed on this service. - * @param id The bot's ID - */ - DiscordExtremeList.prototype.getUser = function (id) { - return this._request({ - url: "/user/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return DiscordExtremeList; -}(Service_1.Service)); -exports.default = DiscordExtremeList; diff --git a/lib/Interface/Lists/DiscordLabs.d.ts b/lib/Interface/Lists/DiscordLabs.d.ts deleted file mode 100644 index c720ad0a..00000000 --- a/lib/Interface/Lists/DiscordLabs.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Discord Labs service. - * @see https://docs.discordlabs.org/#/api - */ -export default class DiscordLabs extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordLabs.js b/lib/Interface/Lists/DiscordLabs.js deleted file mode 100644 index a5b21dc6..00000000 --- a/lib/Interface/Lists/DiscordLabs.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Labs service. - * @see https://docs.discordlabs.org/#/api - */ -var DiscordLabs = /** @class */ (function (_super) { - __extends(DiscordLabs, _super); - function DiscordLabs() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordLabs, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordlabs', 'discordlabs.org']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://avatars2.githubusercontent.com/u/54491479?v=4'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Labs'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://bots.discordlabs.org/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordLabs, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://bots.discordlabs.org/v2'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordLabs.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - data: shard - ? { - token: token, - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: shard.count - } - : { - token: token, - server_count: Util_1.Util.resolveCount(serverCount) - } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - DiscordLabs.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - return DiscordLabs; -}(Service_1.Service)); -exports.default = DiscordLabs; diff --git a/lib/Interface/Lists/DiscordListology.d.ts b/lib/Interface/Lists/DiscordListology.d.ts deleted file mode 100644 index 2e43f206..00000000 --- a/lib/Interface/Lists/DiscordListology.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the DiscordListology service. - * @see https://discordlistology.com/developer/documentation - */ -export default class DiscordListology extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - getBotStats(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - userVotedBot(id: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the guild's stats listed on this service. - * @param id The guild's ID - */ - getGuildStats(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a guild on this service. - * @param id The guild's ID - * @param userID The user's ID - */ - userVotedGuild(id: IDResolvable, userID: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/DiscordListology.js b/lib/Interface/Lists/DiscordListology.js deleted file mode 100644 index da56cd4c..00000000 --- a/lib/Interface/Lists/DiscordListology.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the DiscordListology service. - * @see https://discordlistology.com/developer/documentation - */ -var DiscordListology = /** @class */ (function (_super) { - __extends(DiscordListology, _super); - function DiscordListology() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordListology, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordlistology', 'discordlistology.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordlistology.com/idiscord.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "serviceName", { - /** Service's name. */ - get: function () { - return 'DiscordListology'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordlistology.com/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordListology, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://discordlistology.com/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordListology.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - servers: Util_1.Util.resolveCount(serverCount), - shards: shard.count - } - : { servers: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - DiscordListology.prototype.getBotStats = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) + "/stats" }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param id The bot's ID - * @param userID The user's ID - */ - DiscordListology.prototype.userVotedBot = function (id, userID) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(userID) + "/hasvoted/" + Util_1.Util.resolveID(id) - }); - }; - /** - * Gets the guild's stats listed on this service. - * @param id The guild's ID - */ - DiscordListology.prototype.getGuildStats = function (id) { - return this._request({ url: "/guilds/" + Util_1.Util.resolveID(id) + "/stats" }); - }; - /** - * Checks whether or not a user has voted for a guild on this service. - * @param id The guild's ID - * @param userID The user's ID - */ - DiscordListology.prototype.userVotedGuild = function (id, userID) { - return this._request({ - url: "/guilds/" + Util_1.Util.resolveID(userID) + "/hasvoted/" + Util_1.Util.resolveID(id) - }); - }; - return DiscordListology; -}(Service_1.Service)); -exports.default = DiscordListology; diff --git a/lib/Interface/Lists/DiscordServices.d.ts b/lib/Interface/Lists/DiscordServices.d.ts deleted file mode 100644 index c83c33b9..00000000 --- a/lib/Interface/Lists/DiscordServices.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** The options to use when posting command info for the DiscordServices service */ -export interface DiscordServicesCommandInfo { - /** The command name including the prefix */ - command: string; - /** The description for your command */ - desc: string; - /** The category of your command */ - category: string; -} -/** - * Represents the Discord Services service. - * @see https://discordservices.net/docs/api - */ -export default class DiscordServices extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Posts news to your bot page - * @param id The bot's ID - * @param title The title of the post - * @param content The content of the post - */ - postNews(id: IDResolvable, title: string, content: string): Promise>; - /** - * Posts commands info to your bot page - * @param id The bot's ID - * @param commands The command info to post - */ - postCommands(id: IDResolvable, commands: DiscordServicesCommandInfo[]): Promise>; -} diff --git a/lib/Interface/Lists/DiscordServices.js b/lib/Interface/Lists/DiscordServices.js deleted file mode 100644 index d685589a..00000000 --- a/lib/Interface/Lists/DiscordServices.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Discord Services service. - * @see https://discordservices.net/docs/api - */ -var DiscordServices = /** @class */ (function (_super) { - __extends(DiscordServices, _super); - function DiscordServices() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(DiscordServices, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['discordservices', 'discordservices.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://discordservices.net/icon.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "serviceName", { - /** Service's name. */ - get: function () { - return 'Discord Services'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://discordservices.net'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DiscordServices, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.discordservices.net'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - DiscordServices.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - servers: Util_1.Util.resolveCount(serverCount), - shards: shard.count - } - : { servers: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Posts news to your bot page - * @param id The bot's ID - * @param title The title of the post - * @param content The content of the post - */ - DiscordServices.prototype.postNews = function (id, title, content) { - return this._request({ - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(id) + "/news", - headers: { Authorization: this.token }, - data: { - title: title, - content: content, - error: false - } - }, { requiresToken: true }); - }; - /** - * Posts commands info to your bot page - * @param id The bot's ID - * @param commands The command info to post - */ - DiscordServices.prototype.postCommands = function (id, commands) { - return this._request({ - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(id) + "/commands", - headers: { Authorization: this.token }, - data: commands - }, { requiresToken: true }); - }; - return DiscordServices; -}(Service_1.Service)); -exports.default = DiscordServices; diff --git a/lib/Interface/Lists/Disforge.d.ts b/lib/Interface/Lists/Disforge.d.ts deleted file mode 100644 index 70c8305f..00000000 --- a/lib/Interface/Lists/Disforge.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -/** - * Represents the Disforge service. - * @see https://disforge.com/developer - */ -export default class Disforge extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Retreives the data shown on the homepage. - */ - getHomepage(): Promise>; - /** - * Retreives statistics about Disforge. - */ - getStats(): Promise>; -} diff --git a/lib/Interface/Lists/Disforge.js b/lib/Interface/Lists/Disforge.js deleted file mode 100644 index 76ba5d35..00000000 --- a/lib/Interface/Lists/Disforge.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Disforge service. - * @see https://disforge.com/developer - */ -var Disforge = /** @class */ (function (_super) { - __extends(Disforge, _super); - function Disforge() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(Disforge, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['disforge', 'disforge.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://disforge.com/assets/img/ui/categories/all-bots.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "serviceName", { - /** Service's name. */ - get: function () { - return 'Disforge'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://disforge.com/bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Disforge, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://disforge.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - Disforge.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/botstats/" + Util_1.Util.resolveID(clientID), - headers: { - Authorization: token - }, - data: { - servers: Util_1.Util.resolveCount(serverCount) - } - }); - }; - /** - * Retreives the data shown on the homepage. - */ - Disforge.prototype.getHomepage = function () { - return this._request({ url: "/home" }); - }; - /** - * Retreives statistics about Disforge. - */ - Disforge.prototype.getStats = function () { - return this._request({ url: "/stats" }); - }; - return Disforge; -}(Service_1.Service)); -exports.default = Disforge; diff --git a/lib/Interface/Lists/GlennBotList.d.ts b/lib/Interface/Lists/GlennBotList.d.ts deleted file mode 100644 index c13c5907..00000000 --- a/lib/Interface/Lists/GlennBotList.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Glenn Bot List service. - * @see https://docs.glennbotlist.xyz/ - */ -export default class GlennBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Get a user's profile listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/GlennBotList.js b/lib/Interface/Lists/GlennBotList.js deleted file mode 100644 index 423bf616..00000000 --- a/lib/Interface/Lists/GlennBotList.js +++ /dev/null @@ -1,121 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Glenn Bot List service. - * @see https://docs.glennbotlist.xyz/ - */ -var GlennBotList = /** @class */ (function (_super) { - __extends(GlennBotList, _super); - function GlennBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(GlennBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['glennbotlist', 'glennbotlist.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/8HphUE7.jpg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Glenn Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://glennbotlist.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(GlennBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://glennbotlist.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - GlennBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { - serverCount: Util_1.Util.resolveCount(serverCount), - shardCount: shard ? Util_1.Util.resolveCount(shard.count) : undefined - } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - GlennBotList.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - GlennBotList.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Get a user's profile listed on this service. - * @param id The user's ID - */ - GlennBotList.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - GlennBotList.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("https://glennbotlist.xyz/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}, false); - }; - return GlennBotList; -}(Service_1.Service)); -exports.default = GlennBotList; diff --git a/lib/Interface/Lists/InfinityBots.d.ts b/lib/Interface/Lists/InfinityBots.d.ts deleted file mode 100644 index 7418f98a..00000000 --- a/lib/Interface/Lists/InfinityBots.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Infinity Bots service. - * @see https://docs.infinitybots.xyz - */ -export default class InfinityBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/InfinityBots.js b/lib/Interface/Lists/InfinityBots.js deleted file mode 100644 index 83b7fabb..00000000 --- a/lib/Interface/Lists/InfinityBots.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Infinity Bots service. - * @see https://docs.infinitybots.xyz - */ -var InfinityBots = /** @class */ (function (_super) { - __extends(InfinityBots, _super); - function InfinityBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(InfinityBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['infinitybots', 'infinitybots.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://i.imgur.com/x0LCfAh.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'Infinity Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://infinitybots.xyz'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(InfinityBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.infinitybots.xyz'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - InfinityBots.post = function (options) { - var clientID = options.clientID, token = options.token, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { - authorization: token - }, - data: __assign({ servers: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) - ? { - shards: Util_1.Util.resolveCount(shard.count) - } - : {})) - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - InfinityBots.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id) + "/info" - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - InfinityBots.prototype.getUser = function (id) { - return this._request({ - url: "/user/" + Util_1.Util.resolveID(id) - }); - }; - return InfinityBots; -}(Service_1.Service)); -exports.default = InfinityBots; diff --git a/lib/Interface/Lists/ListMyBots.d.ts b/lib/Interface/Lists/ListMyBots.d.ts deleted file mode 100644 index 103f807d..00000000 --- a/lib/Interface/Lists/ListMyBots.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the List My Bots service. - * @see https://listmybots.com/docs/api - */ -export default class ListMyBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the status widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getStatusWidgetURL(id: IDResolvable, query?: Query): string; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the info about someone's bots. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - getWidgetURL(id: IDResolvable, query?: Query): string; -} diff --git a/lib/Interface/Lists/ListMyBots.js b/lib/Interface/Lists/ListMyBots.js deleted file mode 100644 index 5915f391..00000000 --- a/lib/Interface/Lists/ListMyBots.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the List My Bots service. - * @see https://listmybots.com/docs/api - */ -var ListMyBots = /** @class */ (function (_super) { - __extends(ListMyBots, _super); - function ListMyBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(ListMyBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['listmybots', 'listmybots.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/5Vm5J7i.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'List My Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://listmybots.com/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ListMyBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://listmybots.com/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - ListMyBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - ListMyBots.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the status widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - ListMyBots.prototype.getStatusWidgetURL = function (id, query) { - return this._appendQuery("https://listmybots.com/api/bot/" + Util_1.Util.resolveID(id) + "/widget/status", query || {}, false); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - ListMyBots.prototype.getUser = function (id) { - return this._request({ url: "/user/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the info about someone's bots. - * @param id The user's ID - */ - ListMyBots.prototype.getUserBots = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - */ - ListMyBots.prototype.getWidgetURL = function (id, query) { - return this._appendQuery("https://listmybots.com/api/bot/" + Util_1.Util.resolveID(id) + "/widget", query || {}, false); - }; - return ListMyBots; -}(Service_1.Service)); -exports.default = ListMyBots; diff --git a/lib/Interface/Lists/ParadiseBots.d.ts b/lib/Interface/Lists/ParadiseBots.d.ts deleted file mode 100644 index 7707e032..00000000 --- a/lib/Interface/Lists/ParadiseBots.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Paradise Bots service. - * @see https://paradisebots.net/api/v1/docs - */ -export default class ParadiseBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/ParadiseBots.js b/lib/Interface/Lists/ParadiseBots.js deleted file mode 100644 index da86b136..00000000 --- a/lib/Interface/Lists/ParadiseBots.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Paradise Bots service. - * @see https://paradisebots.net/api/v1/docs - */ -var ParadiseBots = /** @class */ (function (_super) { - __extends(ParadiseBots, _super); - function ParadiseBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(ParadiseBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['paradisebots', 'paradisebots.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://i.imgur.com/Df2seyl.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'Paradise Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://paradisebots.net/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ParadiseBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://paradisebots.net/api/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - ParadiseBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { - Authorization: token - }, - data: __assign({ server_count: Util_1.Util.resolveCount(serverCount) }, ((shard === null || shard === void 0 ? void 0 : shard.count) - ? { - shard_count: Util_1.Util.resolveCount(shard.count) - } - : {})) - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - ParadiseBots.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - return ParadiseBots; -}(Service_1.Service)); -exports.default = ParadiseBots; diff --git a/lib/Interface/Lists/SpaceBotsList.d.ts b/lib/Interface/Lists/SpaceBotsList.d.ts deleted file mode 100644 index 070791bd..00000000 --- a/lib/Interface/Lists/SpaceBotsList.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Space Bots List service. - * @see https://spacebots.gitbook.io/tutorial-en/ - */ -export default class SpaceBotsList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/SpaceBotsList.js b/lib/Interface/Lists/SpaceBotsList.js deleted file mode 100644 index a2f5f1b0..00000000 --- a/lib/Interface/Lists/SpaceBotsList.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Space Bots List service. - * @see https://spacebots.gitbook.io/tutorial-en/ - */ -var SpaceBotsList = /** @class */ (function (_super) { - __extends(SpaceBotsList, _super); - function SpaceBotsList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(SpaceBotsList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['spacebotslist', 'space-bot-list.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://cdn.discordapp.com/avatars/546742409409593354/123b9b0a54b45d99627215c7154580af.webp?size=256'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Space Bots List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://space-bot-list.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SpaceBotsList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://space-bot-list.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - SpaceBotsList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, userCount = options.userCount; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: { - guilds: Util_1.Util.resolveCount(serverCount), - users: Util_1.Util.resolveCount(userCount) - } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - SpaceBotsList.prototype.getBot = function (id) { - return this._request({ url: "/bots/" + Util_1.Util.resolveID(id) }); - }; - return SpaceBotsList; -}(Service_1.Service)); -exports.default = SpaceBotsList; diff --git a/lib/Interface/Lists/TopCord.d.ts b/lib/Interface/Lists/TopCord.d.ts deleted file mode 100644 index d0a98103..00000000 --- a/lib/Interface/Lists/TopCord.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the TopCord service. - * @see https://docs.topcord.xyz/#/API - */ -export default class TopCord extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Lists every bot on this service. - */ - getBots(): Promise>; -} diff --git a/lib/Interface/Lists/TopCord.js b/lib/Interface/Lists/TopCord.js deleted file mode 100644 index 3011c4b2..00000000 --- a/lib/Interface/Lists/TopCord.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the TopCord service. - * @see https://docs.topcord.xyz/#/API - */ -var TopCord = /** @class */ (function (_super) { - __extends(TopCord, _super); - function TopCord() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(TopCord, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['topcord', 'topcord.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://avatars0.githubusercontent.com/u/69593894?v=4'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "serviceName", { - /** Service's name. */ - get: function () { - return 'TopCord'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://topcord.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopCord, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.topcord.xyz'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - TopCord.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - guilds: Util_1.Util.resolveCount(serverCount), - shards: shard.count - } - : { guilds: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - TopCord.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** - * Lists every bot on this service. - */ - TopCord.prototype.getBots = function () { - return this._request({ url: "/bots" }); - }; - return TopCord; -}(Service_1.Service)); -exports.default = TopCord; diff --git a/lib/Interface/Lists/TopGG.d.ts b/lib/Interface/Lists/TopGG.d.ts deleted file mode 100644 index 2333d600..00000000 --- a/lib/Interface/Lists/TopGG.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the Top.gg service. - * @see https://docs.top.gg/ - */ -export default class TopGG extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; - /** - * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). - * @param query The query string that will be used in the request - */ - getBots(query: Query): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - getBotStats(id: IDResolvable): Promise>; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - getBotVotes(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) - */ - getWidgetURL(id: IDResolvable, query?: Query, smallWidget?: string): string; -} diff --git a/lib/Interface/Lists/TopGG.js b/lib/Interface/Lists/TopGG.js deleted file mode 100644 index d7eea770..00000000 --- a/lib/Interface/Lists/TopGG.js +++ /dev/null @@ -1,159 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Top.gg service. - * @see https://docs.top.gg/ - */ -var TopGG = /** @class */ (function (_super) { - __extends(TopGG, _super); - function TopGG() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(TopGG, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['topgg', 'top.gg']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://top.gg/images/dblnew.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "serviceName", { - /** Service's name. */ - get: function () { - return 'Top.gg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://top.gg'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TopGG, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://top.gg/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - TopGG.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bots/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: shard - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_id: shard.id, - shard_count: shard.count - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - TopGG.prototype.getUser = function (id) { - return this._request({ - url: "/users/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). - * @param query The query string that will be used in the request - */ - TopGG.prototype.getBots = function (query) { - return this._request({ url: '/bots', params: query, headers: { Authorization: this.token } }, { requiresToken: true }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - TopGG.prototype.getBot = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the bot's stats listed on this service. - * @param id The bot's ID - */ - TopGG.prototype.getBotStats = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/stats", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the list of people who voted this bot on this service. - * @param id The bot's ID - */ - TopGG.prototype.getBotVotes = function (id) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(id) + "/votes", - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - TopGG.prototype.userVoted = function (botId, userID) { - return this._request({ - url: "/bots/" + Util_1.Util.resolveID(botId) + "/check", - params: { userId: Util_1.Util.resolveID(userID) }, - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) - */ - TopGG.prototype.getWidgetURL = function (id, query, smallWidget) { - var subPath = smallWidget ? smallWidget + "/" : ''; - return this._appendQuery("/widget/" + subPath + Util_1.Util.resolveID(id) + ".svg", query || {}); - }; - return TopGG; -}(Service_1.Service)); -exports.default = TopGG; diff --git a/lib/Interface/Lists/VoidBots.d.ts b/lib/Interface/Lists/VoidBots.d.ts deleted file mode 100644 index c4b93623..00000000 --- a/lib/Interface/Lists/VoidBots.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Void Bots service. - * @see https://docs.voidbots.net/ - */ -export default class VoidBots extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - userVoted(botId: IDResolvable, userID: IDResolvable): Promise>; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - getBotReviews(id: IDResolvable): Promise>; - /** - * Gets the bot's analytics on this service. - * @param id The bot's ID - */ - getBotAnalytics(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/VoidBots.js b/lib/Interface/Lists/VoidBots.js deleted file mode 100644 index 70d5f88f..00000000 --- a/lib/Interface/Lists/VoidBots.js +++ /dev/null @@ -1,134 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Void Bots service. - * @see https://docs.voidbots.net/ - */ -var VoidBots = /** @class */ (function (_super) { - __extends(VoidBots, _super); - function VoidBots() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(VoidBots, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['voidbots', 'voidbots.net']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://gblobscdn.gitbook.com/spaces%2F-MFw3t62urLlBeats8UJ%2Favatar-1598748054479.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "serviceName", { - /** Service's name. */ - get: function () { - return 'Void Bots'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://voidbots.net/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(VoidBots, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.voidbots.net'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - VoidBots.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/stats/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - data: (shard === null || shard === void 0 ? void 0 : shard.count) - ? { - server_count: Util_1.Util.resolveCount(serverCount), - shard_count: Util_1.Util.resolveCount(shard.count) - } - : { server_count: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - VoidBots.prototype.getBot = function (id) { - return this._request({ - url: "/bot/info/" + Util_1.Util.resolveID(id), - headers: { - Authorization: this.token - } - }, { requiresToken: true }); - }; - /** - * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID - */ - VoidBots.prototype.userVoted = function (botId, userID) { - return this._request({ - url: "/bot/voted/" + Util_1.Util.resolveID(botId) + "/" + Util_1.Util.resolveID(userID), - headers: { - Authorization: this.token - } - }, { requiresToken: true }); - }; - /** - * Gets the bot's reviews on this service. - * @param id The bot's ID - */ - VoidBots.prototype.getBotReviews = function (id) { - return this._request({ - url: "/bot/reviews/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - /** - * Gets the bot's analytics on this service. - * @param id The bot's ID - */ - VoidBots.prototype.getBotAnalytics = function (id) { - return this._request({ - url: "/bot/analytics/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { requiresToken: true }); - }; - return VoidBots; -}(Service_1.Service)); -exports.default = VoidBots; diff --git a/lib/Interface/Lists/WonderBotList.d.ts b/lib/Interface/Lists/WonderBotList.d.ts deleted file mode 100644 index efb88847..00000000 --- a/lib/Interface/Lists/WonderBotList.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -/** - * Represents the Wonder Bot List service. - * @see https://api.wonderbotlist.com/en/ - */ -export default class WonderBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - getUser(id: IDResolvable): Promise>; -} diff --git a/lib/Interface/Lists/WonderBotList.js b/lib/Interface/Lists/WonderBotList.js deleted file mode 100644 index 223377fd..00000000 --- a/lib/Interface/Lists/WonderBotList.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the Wonder Bot List service. - * @see https://api.wonderbotlist.com/en/ - */ -var WonderBotList = /** @class */ (function (_super) { - __extends(WonderBotList, _super); - function WonderBotList() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(WonderBotList, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['wonderbotlist', 'wonderbotlist.com']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://get.snaz.in/8Jk3EJg.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "serviceName", { - /** Service's name. */ - get: function () { - return 'Wonder Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://wonderbotlist.com/en'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(WonderBotList, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://api.wonderbotlist.com/v1'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * @param options The options of the request - */ - WonderBotList.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount, shard = options.shard; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID), - headers: { Authorization: token }, - params: shard && shard.count - ? { serveurs: Util_1.Util.resolveCount(serverCount), shard: shard.count } - : { serveurs: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - WonderBotList.prototype.getBot = function (id) { - return this._request({ - url: "/bot/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the user listed on this service. - * @param id The user's ID - */ - WonderBotList.prototype.getUser = function (id) { - return this._request({ - url: "/user/" + Util_1.Util.resolveID(id), - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return WonderBotList; -}(Service_1.Service)); -exports.default = WonderBotList; diff --git a/lib/Interface/Lists/YABL.d.ts b/lib/Interface/Lists/YABL.d.ts deleted file mode 100644 index 5902a223..00000000 --- a/lib/Interface/Lists/YABL.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Service, ServicePostOptions } from '../Service'; -import { IDResolvable } from '../../Utils/Util'; -import { Query } from '../../Utils/Constants'; -/** - * Represents the YABL service. - * @see https://yabl.xyz/api - */ -export default class YABL extends Service { - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** The logo URL. */ - static get logoURL(): string; - /** Service's name. */ - static get serviceName(): string; - /** The website URL. */ - static get websiteURL(): string; - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions): Promise>; - /** Invalidates the token being used in the request. */ - invalidate(): Promise>; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable): Promise>; - /** Gets 20 random bots from this service. */ - getRandomBots(): Promise>; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - getUserBots(id: IDResolvable): Promise>; - /** Gets a list of bots on this service. */ - getBots(): Promise>; - /** - * Gets a page of bots on this service. - * @param query The query string that will be used in the request - */ - getBotsByPage(query: Query): Promise>; - /** Gets a list of unverified bots on this service. */ - getUnverifiedBots(): Promise>; -} diff --git a/lib/Interface/Lists/YABL.js b/lib/Interface/Lists/YABL.js deleted file mode 100644 index aa52c916..00000000 --- a/lib/Interface/Lists/YABL.js +++ /dev/null @@ -1,137 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var Service_1 = require("../Service"); -var Util_1 = require("../../Utils/Util"); -/** - * Represents the YABL service. - * @see https://yabl.xyz/api - */ -var YABL = /** @class */ (function (_super) { - __extends(YABL, _super); - function YABL() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(YABL, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - return ['yabl', 'yabl.xyz']; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "logoURL", { - /** The logo URL. */ - get: function () { - return 'https://i.imgur.com/OFiMern.png'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "serviceName", { - /** Service's name. */ - get: function () { - return 'Yet Another Bot List'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "websiteURL", { - /** The website URL. */ - get: function () { - return 'https://yabl.xyz/'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(YABL, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return 'https://yabl.xyz/api'; - }, - enumerable: false, - configurable: true - }); - /** - * Posts statistics to this service. - * Shard data posting is not supported for this service. - * @param options The options of the request - */ - YABL.post = function (options) { - var token = options.token, clientID = options.clientID, serverCount = options.serverCount; - return _super._post.call(this, { - method: 'post', - url: "/bot/" + Util_1.Util.resolveID(clientID) + "/stats", - headers: { Authorization: token }, - data: { guildCount: Util_1.Util.resolveCount(serverCount) } - }); - }; - /** Invalidates the token being used in the request. */ - YABL.prototype.invalidate = function () { - return this._request({ - url: '/token/invalidate', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - YABL.prototype.getBot = function (id) { - return this._request({ url: "/bot/" + Util_1.Util.resolveID(id) }); - }; - /** Gets 20 random bots from this service. */ - YABL.prototype.getRandomBots = function () { - return this._request({ url: '/bots' }); - }; - /** - * Gets the user's bots listed for this service. - * @param id The user's ID - */ - YABL.prototype.getUserBots = function (id) { - return this._request({ url: "/bots/user/" + Util_1.Util.resolveID(id) }); - }; - /** Gets a list of bots on this service. */ - YABL.prototype.getBots = function () { - return this._request({ - url: '/bots/all', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - /** - * Gets a page of bots on this service. - * @param query The query string that will be used in the request - */ - YABL.prototype.getBotsByPage = function (query) { - return this._request({ url: '/bots/page', params: query }); - }; - /** Gets a list of unverified bots on this service. */ - YABL.prototype.getUnverifiedBots = function () { - return this._request({ - url: '/bots/unverified', - headers: { Authorization: this.token } - }, { - requiresToken: true - }); - }; - return YABL; -}(Service_1.Service)); -exports.default = YABL; diff --git a/lib/Interface/Poster.d.ts b/lib/Interface/Poster.d.ts deleted file mode 100644 index 0e75e028..00000000 --- a/lib/Interface/Poster.d.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { CustomEvent, CustomService, eventHandler, PosterOptions, ServiceKey } from '../Utils/Constants'; -import { Service } from './Service'; -export interface manualPostOptions { - /** The server count to post to the service */ - serverCount: number; - /** The user count to post to the service */ - userCount?: number; - /** The voice connection count to post to the service */ - voiceConnections?: number; -} -/** A class that posts server count to listing site(s). */ -export declare class Poster { - /** The client that will be used to fetch the stats */ - client: PosterOptions['client']; - /** An array of custom services that the poster uses */ - customServices: CustomService[]; - /** The API keys that the poster is using */ - apiKeys: Record; - /** The options the poster was built with */ - readonly options: PosterOptions; - /** The list of event handlers for every custom event */ - handlers: Record; - /** The client filler used in the poster */ - private _clientFiller; - /** Interval that posts to all services */ - private _interval?; - /** - * @constructor - * @param options The options needed to construct the poster - */ - constructor(options: PosterOptions); - /** The client filler used in the poster */ - private get clientFiller(); - /** - * Retrieves the current server count of the client/shard. - * @returns Amount of servers the client/shard is in - */ - getServerCount(): Promise; - /** - * Retrieves the current user count of the client/shard. - * @returns Amount of users the client/shard is connected with - */ - getUserCount(): Promise; - /** - * Retrieves the current voice connection count of the client/shard. - * @returns Number of active voice connections - */ - getVoiceConnections(): Promise; - /** - * Creates an interval that posts to all services. - * @param interval The time (in ms) to reach to post to all {@link Service}s again - * @returns The interval that is responsible for posting - * @emits Poster#autopostSuccess - * @emits Poster#autopostFail - */ - startInterval(interval?: number): number; - /** Destroys the current interval. */ - stopInterval(): void; - /** - * Gets a service, autofilling its API key if the poster has it. - * @param service The service to get - */ - getService(service: ServiceKey): (Service | CustomService) | typeof Service | undefined; - /** - * Posts the current clients server count to a service. - * @param service The service to post to - * @see Poster#postManual - * @returns The result(s) of the post - * @emits Poster#postSuccess - * @emits Poster#postFail - */ - post(service?: ServiceKey | 'all'): Promise; - /** - * Manually posts a server count to a service. - * @param service The service to post to - * @param counts An object containing the tallies of servers, users and voice connections - * @returns The result(s) of the post - */ - postManual(service: ServiceKey | 'all', counts: manualPostOptions): Promise; - /** - * Adds an handler for an event. - * @param event The name of the event to add the handler to - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - addHandler(event: CustomEvent, handler: eventHandler): eventHandler[]; - /** - * Removes an handler for an event. - * @param event The name of the event to remove the handler from - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - removeHandler(event: CustomEvent, handler: eventHandler): eventHandler[]; - /** - * Manually triggers an event with custom arguments. - * @param {CustomEvent} event The name of the event to run the handlers for - * @param {...any} args The arguments to pass to the handlers - */ - runHandlers(event: CustomEvent, ...args: any[]): void; -} diff --git a/lib/Interface/Poster.js b/lib/Interface/Poster.js deleted file mode 100644 index 41b065a7..00000000 --- a/lib/Interface/Poster.js +++ /dev/null @@ -1,319 +0,0 @@ -"use strict"; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Poster = void 0; -var Constants_1 = require("../Utils/Constants"); -var EnsurePromise_1 = require("../Utils/EnsurePromise"); -var DBotsError_1 = require("../Utils/DBotsError"); -var ClientFiller_1 = require("./ClientFiller"); -var Service_1 = require("./Service"); -var promise_allsettled_1 = __importDefault(require("promise.allsettled")); -var DBotsError = DBotsError_1.errors.Error, TypeError = DBotsError_1.errors.TypeError; -/** A class that posts server count to listing site(s). */ -var Poster = /** @class */ (function () { - // #endregion - /** - * @constructor - * @param options The options needed to construct the poster - */ - function Poster(options) { - var _a, _b; - if (!options || typeof options !== 'object') - throw new DBotsError('INVALID_POSTER_OPTIONS'); - this.client = options.client; - this._clientFiller = null; - this.customServices = options.customServices || []; - this.apiKeys = options.apiKeys || {}; - this.options = options; - if (typeof options.useSharding !== 'boolean') - options.useSharding = true; - if (!this.client && !options.clientID) - throw new DBotsError('NO_CLIENT_OR_ID'); - if (this.client && !options.clientID) - Object.assign(options, { - clientID: (_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.clientID, - shard: (_b = this.clientFiller) === null || _b === void 0 ? void 0 : _b.shard - }); - if (!options.useSharding) - options.shard = undefined; - this.handlers = {}; - for (var _i = 0, SupportedEvents_1 = Constants_1.SupportedEvents; _i < SupportedEvents_1.length; _i++) { - var event_1 = SupportedEvents_1[_i]; - this.handlers[event_1] = []; - } - } - Object.defineProperty(Poster.prototype, "clientFiller", { - /** The client filler used in the poster */ - get: function () { - return (this._clientFiller || - (this.options.clientLibrary && this.client - ? (this._clientFiller = ClientFiller_1.getClientFiller(this.options.clientLibrary, this.client)) - : undefined)); - }, - enumerable: false, - configurable: true - }); - /** - * Retrieves the current server count of the client/shard. - * @returns Amount of servers the client/shard is in - */ - Poster.prototype.getServerCount = function () { - var _a; - if (this.options.serverCount) - // @ts-expect-error - return EnsurePromise_1.ensurePromise(this.options.serverCount); - if (!this.client) - throw new DBotsError('NO_CLIENT', 'server'); - if (!this.options.clientLibrary) - throw new DBotsError('UNKNOWN_CLIENT', 'server'); - return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.serverCount) || 0); - }; - /** - * Retrieves the current user count of the client/shard. - * @returns Amount of users the client/shard is connected with - */ - Poster.prototype.getUserCount = function () { - var _a; - if (this.options.userCount) - // @ts-expect-error - return EnsurePromise_1.ensurePromise(this.options.userCount); - if (!this.client) - throw new DBotsError('NO_CLIENT', 'user'); - if (!this.options.clientLibrary) - throw new DBotsError('UNKNOWN_CLIENT', 'user'); - return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.userCount) || 0); - }; - /** - * Retrieves the current voice connection count of the client/shard. - * @returns Number of active voice connections - */ - Poster.prototype.getVoiceConnections = function () { - var _a; - if (this.options.voiceConnections) - // @ts-expect-error - return EnsurePromise_1.ensurePromise(this.options.voiceConnections); - if (!this.client) - throw new DBotsError('NO_CLIENT', 'voice connection'); - if (!this.options.clientLibrary) - throw new DBotsError('UNKNOWN_CLIENT', 'voice connection'); - return Promise.resolve(((_a = this.clientFiller) === null || _a === void 0 ? void 0 : _a.voiceConnections) || 0); - }; - /** - * Creates an interval that posts to all services. - * @param interval The time (in ms) to reach to post to all {@link Service}s again - * @returns The interval that is responsible for posting - * @emits Poster#autopostSuccess - * @emits Poster#autopostFail - */ - Poster.prototype.startInterval = function (interval) { - var _this_1 = this; - if (interval === void 0) { interval = 1800000; } - this._interval && clearTimeout(this._interval); - this._interval = setInterval(function () { - return _this_1.post() - .then(function (result) { - _this_1.runHandlers('autopostSuccess', result); - return result; - }) - .catch(function (error) { return _this_1.runHandlers('autopostFail', error); }); - }, interval); - return this._interval; - }; - /** Destroys the current interval. */ - Poster.prototype.stopInterval = function () { - if (this._interval) - clearTimeout(this._interval); - }; - /** - * Gets a service, autofilling its API key if the poster has it. - * @param service The service to get - */ - Poster.prototype.getService = function (service) { - var _this_1 = this; - var serviceClass = Service_1.Service.get(service, this.customServices); - if (!serviceClass) - return undefined; - var keyName = serviceClass.aliases.find(function (key) { - return Object.keys(_this_1.apiKeys).includes(key); - }); - if (keyName) - return new serviceClass(this.apiKeys[keyName]); - else - return serviceClass; - }; - /** - * Posts the current clients server count to a service. - * @param service The service to post to - * @see Poster#postManual - * @returns The result(s) of the post - * @emits Poster#postSuccess - * @emits Poster#postFail - */ - Poster.prototype.post = function (service) { - if (service === void 0) { service = 'all'; } - var _this = this; - return new Promise(function (resolve, reject) { - return Promise.all([ - _this.getServerCount(), - _this.getUserCount(), - _this.getVoiceConnections() - ]) - .then(function (_a) { - var serverCount = _a[0], userCount = _a[1], voiceConnections = _a[2]; - _this - .postManual(service, { serverCount: serverCount, userCount: userCount, voiceConnections: voiceConnections }) - .then(resolve) - .catch(reject); - }) - .catch(reject); - }); - }; - /** - * Manually posts a server count to a service. - * @param service The service to post to - * @param counts An object containing the tallies of servers, users and voice connections - * @returns The result(s) of the post - */ - Poster.prototype.postManual = function (service, counts) { - var _this_1 = this; - var serverCount = counts.serverCount, userCount = counts.userCount, voiceConnections = counts.voiceConnections; - if (!service) - service = 'all'; - if (!this.apiKeys && !this.options.post) - return Promise.reject(new DBotsError('NO_API_KEYS')); - if (service === 'custom') - // @ts-expect-error - return EnsurePromise_1.ensurePromise( - // @ts-expect-error - this.options.post, this.options.clientID, serverCount, this.options.shard); - if (service === 'all') { - var services = Object.keys(this.apiKeys); - if (this.options.post) - services.push('custom'); - return promise_allsettled_1.default - .call(Promise, services.map(function (k) { - return _this_1.postManual(k, { serverCount: serverCount, userCount: userCount, voiceConnections: voiceConnections }); - })) - .then(function (requests) { - var _a, _b; - var rejected = [], hostnames = []; - for (var _i = 0, requests_1 = requests; _i < requests_1.length; _i++) { - var r = requests_1[_i]; - if (r.status == 'rejected') { - rejected.push(r); - // @ts-expect-error - if ((_b = (_a = r.reason) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.url) { - // @ts-expect-error - var hostname = new URL(r.reason.config.url).hostname; - if (hostname && !hostnames.includes(hostname)) - hostnames.push(hostname); - } - else - hostnames.push('???'); - } - } - if (rejected.length > 0) { - var msg = rejected.length + " request" + (rejected.length == 1 ? '' : 's') + " have been rejected.\n"; - if (hostnames.length > 0) - msg += "Failing hostnames: " + hostnames.join(', ') + "\n"; - msg += 'Please check the error from the following responses.\n'; - msg += rejected - .map(function (rej) { - var reason = rej.reason || rej; - return reason && - typeof reason == 'object' && - !(reason instanceof Error) - ? JSON.stringify(reason, null, 2) - : reason.toString(); - }) - .join('\n'); - throw new DBotsError('GENERIC', msg); - } - else { - // @ts-expect-error - return requests.map(function (r) { return r.value; }); - } - }); - } - if (!Object.keys(this.apiKeys).includes(service)) - return Promise.reject(new DBotsError('SERVICE_NO_KEY', service)); - var serviceClass = Service_1.Service.get(service, this.customServices); - if (!serviceClass) - return Promise.reject(new TypeError('INVALID_SERVICE', service)); - return new Promise(function (resolve, reject) { - serviceClass - .post({ - token: _this_1.apiKeys[service], - clientID: _this_1.options.clientID || '', - shard: _this_1.options.shard, - serverCount: serverCount, - userCount: userCount, - voiceConnections: voiceConnections - }) - .then(function (result) { - _this_1.runHandlers('postSuccess', result); - resolve(result); - }) - .catch(function (error) { - _this_1.runHandlers('postFail', error); - reject(error); - }); - }); - }; - /** - * Adds an handler for an event. - * @param event The name of the event to add the handler to - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - Poster.prototype.addHandler = function (event, handler) { - if (!Constants_1.SupportedEvents.includes(event)) - throw new TypeError('UNSUPPORTED_EVENT', 'add'); - if (typeof handler != 'function') - throw new DBotsError('HANDLER_INVALID'); - this.handlers[event].push(handler); - return this.handlers[event]; - }; - /** - * Removes an handler for an event. - * @param event The name of the event to remove the handler from - * @param handler The function that is run with the event - * @returns The array of handlers currently set for that event - */ - Poster.prototype.removeHandler = function (event, handler) { - if (!Constants_1.SupportedEvents.includes(event)) - throw new TypeError('UNSUPPORTED_EVENT', 'remove'); - if (typeof handler != 'function') - throw new DBotsError('HANDLER_INVALID'); - var index = this.handlers[event].indexOf(handler); - if (index >= 0) - this.handlers[event].splice(index, 1); - return this.handlers[event]; - }; - /** - * Manually triggers an event with custom arguments. - * @param {CustomEvent} event The name of the event to run the handlers for - * @param {...any} args The arguments to pass to the handlers - */ - Poster.prototype.runHandlers = function (event) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - if (!Constants_1.SupportedEvents.includes(event)) - throw new TypeError('UNSUPPORTED_EVENT', 'run'); - for (var _a = 0, _b = this.handlers[event]; _a < _b.length; _a++) { - var handler = _b[_a]; - EnsurePromise_1.ensurePromise.apply(void 0, __spreadArray([handler], args)); - } - }; - return Poster; -}()); -exports.Poster = Poster; diff --git a/lib/Interface/Service.d.ts b/lib/Interface/Service.d.ts deleted file mode 100644 index b77a743b..00000000 --- a/lib/Interface/Service.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { RequestForm } from '../Utils/FormatRequest'; -import { CustomService, Query, Shard } from '../Utils/Constants'; -import { CountResolvable, IDResolvable } from '../Utils/Util'; -/** Options provided when sending a service request */ -export interface ServiceRequestOptions { - /** Whether the request requires a token */ - requiresToken?: boolean; - /** Whether to prepend the service's base API url */ - appendBaseURL?: boolean; -} -/** Options provided when posting to a service */ -export interface ServicePostOptions { - /** The Authorization token for the request */ - token: string; - /** The client ID that the request will post for */ - clientID: IDResolvable; - /** The amount of servers that the client is in */ - serverCount: CountResolvable; - /** The amount of users that the client cached */ - userCount: CountResolvable; - /** The number of voice connections */ - voiceConnections?: CountResolvable; - /** The shard the request is representing */ - shard?: Shard; -} -/** Represents a basic service. */ -export declare class Service { - /** - * The token that will be used for the service. - * @private - */ - token: string; - /** - * @param token The token/key for the service - */ - constructor(token: string); - /** The base URL of the service's API. */ - static get baseURL(): string; - /** - * Gets a service from a key. - * @param key The name of the service to get - * @param extras An array of {@link CustomService}s to include - */ - static get(key: string, extras?: CustomService[]): typeof Service | null; - /** Gets every loaded service. */ - static getAll(): Record; - /** - * Posts statistics to this service. - * Internally, this is supposed to be used in extended classes. - * @param form The request form - * @param appendBaseURL Whether to append the service's base API url - * @private - */ - static _post(form: RequestForm, appendBaseURL?: boolean): Promise>; - /** - * Sends a request for the service interface. - * @param form The request form - * @param options The options of this request - * @private - */ - _request(form: RequestForm, options?: ServiceRequestOptions): Promise>; - /** - * Appends query string to a URL. - * @param url The URL to modify - * @param query The query to append - * @param appendBaseURL Whether to prepend the service's base API url - * @returns The modified URL - * @private - */ - _appendQuery(url: string, query: Query, appendBaseURL?: boolean): string; - /** The values that can be used to select the service. */ - static get aliases(): string[]; - /** - * The logo URL, used only for documentation. - * @private - */ - static get logoURL(): string; - /** - * Service's name, used only for documentation. - * @private - */ - static get serviceName(): string; - /** - * The website URL, used only for documentation. - * @private - */ - static get websiteURL(): string; - static post(options: ServicePostOptions): ReturnType; -} diff --git a/lib/Interface/Service.js b/lib/Interface/Service.js deleted file mode 100644 index c66e3478..00000000 --- a/lib/Interface/Service.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __spreadArray = (this && this.__spreadArray) || function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Service = void 0; -var FormatRequest_1 = require("../Utils/FormatRequest"); -var DBotsError_1 = require("../Utils/DBotsError"); -var Error = DBotsError_1.errors.Error; -// @ts-expect-error -var buildURL_1 = __importDefault(require("axios/lib/helpers/buildURL")); -var Util_1 = require("../Utils/Util"); -/** Represents a basic service. */ -var Service = /** @class */ (function () { - /** - * @param token The token/key for the service - */ - function Service(token) { - this.token = token; - } - Object.defineProperty(Service, "baseURL", { - /** The base URL of the service's API. */ - get: function () { - return ''; - }, - enumerable: false, - configurable: true - }); - /** - * Gets a service from a key. - * @param key The name of the service to get - * @param extras An array of {@link CustomService}s to include - */ - Service.get = function (key, extras) { - if (extras === void 0) { extras = []; } - if (!key || typeof key !== 'string') - return null; - var services = __spreadArray(__spreadArray([], Object.values(serviceClasses)), extras); - for (var _i = 0, services_1 = services; _i < services_1.length; _i++) { - var service = services_1[_i]; - if (!service || !service.aliases || !service.post) - continue; - if (service.aliases.includes(key.toLowerCase())) - return service; - } - return null; - }; - /** Gets every loaded service. */ - Service.getAll = function () { - return serviceClasses; - }; - /** - * Posts statistics to this service. - * Internally, this is supposed to be used in extended classes. - * @param form The request form - * @param appendBaseURL Whether to append the service's base API url - * @private - */ - Service._post = function (form, appendBaseURL) { - if (appendBaseURL === void 0) { appendBaseURL = true; } - try { - this.serviceName; - } - catch (_a) { - return Promise.reject(new Error('CALLED_FROM_BASE')); - } - if (this.baseURL && appendBaseURL) - form.url = this.baseURL + form.url; - return FormatRequest_1.formatRequest(form); - }; - /** - * Sends a request for the service interface. - * @param form The request form - * @param options The options of this request - * @private - */ - Service.prototype._request = function (form, options) { - if (options === void 0) { options = {}; } - var _a = options.requiresToken, requiresToken = _a === void 0 ? false : _a, _b = options.appendBaseURL, appendBaseURL = _b === void 0 ? true : _b; - if (requiresToken && !this.token) - return Promise.reject(new Error('REQUIRES_TOKEN')); - Util_1.assert(this.constructor); - return FormatRequest_1.formatRequest(__assign(__assign({}, form), { url: (this.constructor.baseURL && appendBaseURL - ? this.constructor.baseURL - : '') + form.url })); - }; - /** - * Appends query string to a URL. - * @param url The URL to modify - * @param query The query to append - * @param appendBaseURL Whether to prepend the service's base API url - * @returns The modified URL - * @private - */ - Service.prototype._appendQuery = function (url, query, appendBaseURL) { - if (appendBaseURL === void 0) { appendBaseURL = true; } - Util_1.assert(this.constructor); - if (this.constructor.baseURL && appendBaseURL) - url = this.constructor.baseURL + url; - return buildURL_1.default(url, query); - }; - Object.defineProperty(Service, "aliases", { - /** The values that can be used to select the service. */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Service, "logoURL", { - /** - * The logo URL, used only for documentation. - * @private - */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Service, "serviceName", { - /** - * Service's name, used only for documentation. - * @private - */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Service, "websiteURL", { - /** - * The website URL, used only for documentation. - * @private - */ - get: function () { - throw 'This is just a placeholder prop, it should not be accessed'; - }, - enumerable: false, - configurable: true - }); - Service.post = function (options // eslint-disable-line @typescript-eslint/no-unused-vars - ) { - throw 'This is just a placeholder method, it should not be called'; - }; - return Service; -}()); -exports.Service = Service; -// Service loading -var serviceClasses = {}; -var usingNode = typeof process != 'undefined' && process.release.name == 'node'; -if (!usingNode) { - serviceClasses = require('../../.tmp/services-list'); -} -else { - var path_1 = eval('require')('path'); - var fs = eval('require')('fs'); - var listsDir_1 = path_1.join(__dirname, './Lists'); - fs.readdirSync(listsDir_1).forEach(function (fileName) { - if (fileName.endsWith('.d.ts')) - return; - var listClass = require(path_1.join(listsDir_1, fileName)).default; - if (listClass) - serviceClasses[path_1.parse(fileName).name] = listClass; - }); -} diff --git a/lib/Utils/Constants.d.ts b/lib/Utils/Constants.d.ts deleted file mode 100644 index b40d348b..00000000 --- a/lib/Utils/Constants.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { PromiseResolvable } from './EnsurePromise'; -/** Options for a poster. */ -export interface PosterOptions { - /** - * An object that pairs a {@link ServiceKey} with their token - * @default {} - */ - apiKeys?: Record; - /** - * The client that a supported {@link Library} uses to manage the Discord application. - * Requires {@link #clientLibrary} to be present - */ - client?: object; - /** - * The client ID used for posting to a {@link Service}. - * Automatically filled in when {@link #client} is present - */ - clientID?: string; - /** The library that the client is based on */ - clientLibrary?: Library; - /** - * The function to use when posting to a server that uses the client ID, the amount of servers, and a {@link Shard}. - * This will be used when the {@link ServiceKey} is `custom` - */ - post?: PromiseResolvable; - /** The shard data for using different methods of posting to services */ - shard?: Shard; - /** The function to use when retrieving the amount of servers a client/shard is in, using the client as a parameter */ - serverCount?: PromiseResolvable; - /** The function to use when retrieving the amount of users a client/shard is connected with, using the client as a parameter */ - userCount?: PromiseResolvable; - /** The function to use when retrieving the number of active voice connections, using the client as a parameter */ - voiceConnections?: PromiseResolvable; - /** - * The custom services that the poster will use - * @default [] - */ - customServices?: CustomService[]; - /** - * Whether or not to use a {@link Service}s sharding methods when posting - * @default true - */ - useSharding?: boolean; -} -/** A shard that is used when posting to services. */ -export interface Shard { - count?: number; - id?: number; -} -/** The object that is given to {@link Service}s and {@link CustomService}s in order to send requests to them. */ -export interface PostRequestData { - /** The Authorization token for the request */ - token: string; - /** The client ID that the request will post for */ - clientID?: string; - /** The amount of servers that the client is in */ - serverCount?: number; - /** The amount of users that the client cached */ - userCount?: number; - /** The amount of voice connections the client has */ - voiceConnections?: number; - /** The shard the request is representing */ - shard?: Shard; -} -/** An object with all query parameters */ -export declare type Query = Record; -/** - * A mock of a {@link Service} that only consists of the nessessities for a poster to use it. - * When you're passing your custom services to method in this package, remmeber to use pass the actual service class, not an instance of it. - * @example - * class MyCustomService { - * static get aliases() { - * return ['a', 'string', 'array'] // string[] - * } - * - * static post() { - * return yourCustomPostMethod() // Promise - * } - * } - */ -export declare type CustomService = any; -/** - * A {@link Service} key supported by the package. - * This can also includes keys from {@link CustomService}s and can be `custom` if a {@link Poster} has a custom post function. - * @see {@link https://dbots.js.org/#/docs/main/master/general/services} - */ -export declare type ServiceKey = string; -/** - * A library supported by the package. Here are the available libraries: - * * discord.js - * * discord.io - * * discordie - * * eris - * * paracord - */ -export declare type Library = 'discord.js' | 'discord.io' | 'discordie' | 'eris' | 'paracord'; -/** - * Type of function to set for handlers - * @param result The result(s) of the post - */ -export declare type eventHandler = (result: object | object[]) => void; -/** - * An event that can be added an handler for. These are the available events: - * * autopostSuccess - * * autopostFail - * * postSuccess - * * postFail - */ -export declare type CustomEvent = 'autopostSuccess' | 'autopostFail' | 'postSuccess' | 'postFail'; -export declare const SupportedEvents: CustomEvent[]; -export declare const Package: any; diff --git a/lib/Utils/Constants.js b/lib/Utils/Constants.js deleted file mode 100644 index 2c49005a..00000000 --- a/lib/Utils/Constants.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Package = exports.SupportedEvents = void 0; -exports.SupportedEvents = [ - 'autopostSuccess', - 'autopostFail', - 'postSuccess', - 'postFail' -]; -exports.Package = require('../../package.json'); diff --git a/lib/Utils/DBotsError.d.ts b/lib/Utils/DBotsError.d.ts deleted file mode 100644 index 1b421f16..00000000 --- a/lib/Utils/DBotsError.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// -export declare const codeSymbol: unique symbol; -export declare const messages: Map<"INVALID_POSTER_OPTIONS" | "NO_CLIENT_OR_ID" | "UNKNOWN_CLIENT" | "NO_CLIENT" | "NO_API_KEYS" | "SERVICE_NO_KEY" | "INVALID_SERVICE" | "HANDLER_INVALID" | "UNSUPPORTED_EVENT" | "CALLED_FROM_BASE" | "REQUIRES_TOKEN" | "POSTING_UNSUPPORTED" | "INVALID_ID" | "INVALID_COUNT" | "COUNT_NEGATIVE" | "GENERIC", string | ((...args: any[]) => string)>; -/** - * Register an error code and message. - * @param sym Unique name for the error - * @param val Value of the error - */ -export declare function register(sym: errorKey, val: any): void; -declare type errorKey = keyof typeof messageObject; -declare const messageObject: { - INVALID_POSTER_OPTIONS: string; - NO_CLIENT_OR_ID: string; - UNKNOWN_CLIENT: (count_name: string) => string; - NO_CLIENT: (count_name: string) => string; - NO_API_KEYS: string; - SERVICE_NO_KEY: (service: string) => string; - INVALID_SERVICE: (service: string) => string; - HANDLER_INVALID: string; - UNSUPPORTED_EVENT: (action: string) => string; - CALLED_FROM_BASE: string; - REQUIRES_TOKEN: string; - POSTING_UNSUPPORTED: (service: string) => string; - INVALID_ID: string; - INVALID_COUNT: string; - COUNT_NEGATIVE: string; - GENERIC: (err: string) => string; -}; -export declare const errors: { - Error: { - new (key: errorKey, ...args: any[]): { - readonly name: string; - readonly code: any; - message: string; - stack?: string | undefined; - }; - captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - stackTraceLimit: number; - }; - TypeError: { - new (key: errorKey, ...args: any[]): { - readonly name: string; - readonly code: any; - message: string; - stack?: string | undefined; - }; - captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - stackTraceLimit: number; - }; - RangeError: { - new (key: errorKey, ...args: any[]): { - readonly name: string; - readonly code: any; - message: string; - stack?: string | undefined; - }; - captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - stackTraceLimit: number; - }; -}; -export {}; diff --git a/lib/Utils/DBotsError.js b/lib/Utils/DBotsError.js deleted file mode 100644 index ef176f59..00000000 --- a/lib/Utils/DBotsError.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; -// Taken from Discord.JS's way of making errors -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.errors = exports.register = exports.messages = exports.codeSymbol = void 0; -exports.codeSymbol = Symbol('code'); -exports.messages = new Map(); -// This is just a mock class to make docs work -/** - * Extend an error of some sort into a DBotsError. - * @param {string} key Error key - * @param {any[]} args Arguments to pass for util format or as function args - * @extends Error - * @private - */ -var DBotsError = /** @class */ (function (_super) { - __extends(DBotsError, _super); - function DBotsError() { - var _this = _super.call(this) || this; - _this.name = ''; - _this.code = ''; - return _this; - } - return DBotsError; -}(Error)); -/** - * Extend an error of some sort into a DBotsError. - * @param Base Base error to extend - * @returns The resulting class (as a class, not an instance) - */ -function makeDbotsError(Base) { - return /** @class */ (function (_super) { - __extends(DBotsError, _super); - function DBotsError(key) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var _this = _super.call(this, message(key, args)) || this; - // @ts-expect-error - _this[exports.codeSymbol] = key; - if (Error.captureStackTrace) - Error.captureStackTrace(_this, DBotsError); - return _this; - } - Object.defineProperty(DBotsError.prototype, "name", { - get: function () { - // @ts-expect-error - return _super.prototype.name + " [" + this[exports.codeSymbol] + "]"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(DBotsError.prototype, "code", { - get: function () { - // @ts-expect-error - return this[exports.codeSymbol]; - }, - enumerable: false, - configurable: true - }); - return DBotsError; - }(Base)); -} -/** - * Format the message for an error. - * @param key Error key - * @param args Arguments to pass for util format or as function args - * @returns Formatted string - */ -function message(key, args) { - if (typeof key !== 'string') - throw new Error('Error message key must be a string'); - var msg = exports.messages.get(key); - if (!['string', 'function'].includes(typeof msg)) - throw new Error("An invalid error message key was used: " + key + "."); - if (typeof msg === 'function') - return msg.apply(void 0, args); - if (args === undefined || args.length === 0) - return msg; - args.unshift(msg); - return String.apply(void 0, args); -} -/** - * Register an error code and message. - * @param sym Unique name for the error - * @param val Value of the error - */ -function register(sym, val) { - exports.messages.set(sym, typeof val === 'function' ? val : String(val)); -} -exports.register = register; -var messageObject = { - INVALID_POSTER_OPTIONS: 'An object is required a parameter to construct a poster.', - NO_CLIENT_OR_ID: 'clientID must be defined when client is non-existant.', - UNKNOWN_CLIENT: function (count_name) { - return "Can't retrieve " + count_name + " count from non-existant client."; - }, - NO_CLIENT: function (count_name) { - return "Can't retrieve " + count_name + " count from unknown client."; - }, - NO_API_KEYS: "Can't post with a poster that has no API keys.", - SERVICE_NO_KEY: function (service) { - return "Can't post to \"" + service + "\" without an API key."; - }, - INVALID_SERVICE: function (service) { return "\"" + service + "\" is an invalid service."; }, - HANDLER_INVALID: 'Given handler is not a PromiseResolvable.', - UNSUPPORTED_EVENT: function (action) { - return "Can't " + action + " handler for an unsupported event."; - }, - CALLED_FROM_BASE: 'This function needs to be called by an extended class.', - REQUIRES_TOKEN: 'This endpoint requires a token.', - POSTING_UNSUPPORTED: function (service) { - return "The service " + service + " does not support posting."; - }, - INVALID_ID: 'An invalid ID was given.', - INVALID_COUNT: 'An invalid countable number was given.', - COUNT_NEGATIVE: 'A countable number cannot be negative.', - GENERIC: function (err) { return err; } -}; -for (var _i = 0, _a = Object.entries(messageObject); _i < _a.length; _i++) { - var _b = _a[_i], name_1 = _b[0], message_1 = _b[1]; - register(name_1, message_1); -} -exports.errors = { - Error: makeDbotsError(Error), - TypeError: makeDbotsError(TypeError), - RangeError: makeDbotsError(RangeError) -}; diff --git a/lib/Utils/EnsurePromise.d.ts b/lib/Utils/EnsurePromise.d.ts deleted file mode 100644 index d62edb27..00000000 --- a/lib/Utils/EnsurePromise.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { eventHandler } from './Constants'; -/** A generic string callback */ -export declare type stringCallback = (...args: any[]) => string; -/** Data that can be resolved to give a string. This can either be a Function or a Promise. */ -export declare type PromiseResolvable = stringCallback | eventHandler | Promise; -export declare function ensurePromise(func: ((...args: any[]) => T) | Promise, ...args: any[]): Promise | undefined; diff --git a/lib/Utils/EnsurePromise.js b/lib/Utils/EnsurePromise.js deleted file mode 100644 index 316eb18e..00000000 --- a/lib/Utils/EnsurePromise.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ensurePromise = void 0; -function ensurePromise(func) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - if (typeof func === 'function') - return new Promise(function (resolve) { return resolve(func.apply(void 0, args)); }); - else if (func instanceof Promise) - return func; -} -exports.ensurePromise = ensurePromise; diff --git a/lib/Utils/FormatRequest.d.ts b/lib/Utils/FormatRequest.d.ts deleted file mode 100644 index 25ad72f5..00000000 --- a/lib/Utils/FormatRequest.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { AxiosRequestConfig, AxiosResponse } from 'axios'; -/** - * The response from the axios call - * @see {@link https://github.com/axios/axios#response-schema} - */ -export { AxiosResponse } from 'axios'; -/** - * @private - */ -export interface RequestForm { - /** The method to use */ - method?: AxiosRequestConfig['method']; - /** The URL for the request */ - url: string; - /** The headers to append to the request */ - headers?: Record; - /** The data to send with the request, if the method allows it */ - data?: Record; - /** The query parameters for the request */ - params?: Record; -} -/** - * Returns a request. - * @param opts An object containing the config for the request: only basic properties are documented, but all [Axios](https://github.com/axios/axios#request-config) parameters are valid - * @returns The request - */ -export declare function formatRequest(options: RequestForm): Promise; diff --git a/lib/Utils/FormatRequest.js b/lib/Utils/FormatRequest.js deleted file mode 100644 index 4e856a89..00000000 --- a/lib/Utils/FormatRequest.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.formatRequest = void 0; -var axios_1 = __importDefault(require("axios")); -var Constants_1 = require("./Constants"); -/** - * Returns a request. - * @param opts An object containing the config for the request: only basic properties are documented, but all [Axios](https://github.com/axios/axios#request-config) parameters are valid - * @returns The request - */ -function formatRequest(options) { - var opts = options; - if (!opts.method) - opts.method = 'get'; - // This is no longer needed, because the types enforce the correct properties - // if (opts.body) { - // opts.data = opts.body - // delete opts.body - // } - // if (opts.query) { - // opts.params = opts.query - // delete opts.query - // } - var userAgent = "dbots (https://github.com/dbots-pkg/dbots.js " + Constants_1.Package.version + ") Node.js/" + process.version; - if (!opts.headers) - opts.headers = { - 'User-Agent': userAgent - }; - else if (!opts.headers['User-Agent']) - opts.headers['User-Agent'] = userAgent; - return axios_1.default(opts); -} -exports.formatRequest = formatRequest; diff --git a/lib/Utils/Util.d.ts b/lib/Utils/Util.d.ts deleted file mode 100644 index c0bceba8..00000000 --- a/lib/Utils/Util.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Data that can be resolved to give a Discord ID, this can be: - * * A string - * * A number - * * Any value with an `id` key - */ -export declare type IDResolvable = string | number | Record<'id', string>; -/** - * Data that can be resolved to give a finite and positive integer. - * This can include any value that can be parsed into an integer. - */ -export declare type CountResolvable = any; -/** Just a utility type representing an object */ -export declare type AnyObject = Record; -/** - * Enforces a type on its argument - * @private - */ -export declare function assert(value: any): asserts value is T; -/** - * Contains various general-purpose utility methods. - */ -export declare class Util { - constructor(); - /** - * Resolves data into a Discord ID. - * @param data The data to resolve - */ - static resolveID(data: IDResolvable): string; - /** - * Resolves data into a countable number that is finite and positive. - * @param data The data to resolve - */ - static resolveCount(data: CountResolvable): number; -} diff --git a/lib/Utils/Util.js b/lib/Utils/Util.js deleted file mode 100644 index b6dd923c..00000000 --- a/lib/Utils/Util.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Util = exports.assert = void 0; -var DBotsError_1 = require("./DBotsError"); -var DBotsError = DBotsError_1.errors.Error, RangeError = DBotsError_1.errors.RangeError, TypeError = DBotsError_1.errors.TypeError; -/** - * Enforces a type on its argument - * @private - */ -function assert(value) { } -exports.assert = assert; -/** - * Contains various general-purpose utility methods. - */ -var Util = /** @class */ (function () { - function Util() { - throw new Error("The " + this.constructor.name + " class may not be instantiated."); - } - /** - * Resolves data into a Discord ID. - * @param data The data to resolve - */ - Util.resolveID = function (data) { - if (typeof data === 'undefined' || data === null) - throw new DBotsError('INVALID_ID'); - var id = null; - if (typeof data === 'string') - id = data; - else if (typeof data === 'number') - id = String(data); - else if (typeof data === 'object' && - Object.prototype.hasOwnProperty.call(data, 'id') && - typeof data.id !== 'object') - return Util.resolveID(data.id); - else - throw new DBotsError('INVALID_ID'); - if (/^\d{17,19}$/.test(id)) - return id; - else - throw new DBotsError('INVALID_ID'); - }; - /** - * Resolves data into a countable number that is finite and positive. - * @param data The data to resolve - */ - Util.resolveCount = function (data) { - var count = parseInt(data); - if (isNaN(count)) - throw new TypeError('INVALID_COUNT'); - else if (count < 0) - throw new RangeError('COUNT_NEGATIVE'); - return count; - }; - return Util; -}()); -exports.Util = Util; diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index 626f0ebb..00000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Service } from './Interface/Service'; -export { Poster } from './Interface/Poster'; -export * as Constants from './Utils/Constants'; -export * as DBotsError from './Utils/DBotsError'; -export { ensurePromise } from './Utils/EnsurePromise'; -export { formatRequest } from './Utils/FormatRequest'; -export * as Util from './Utils/Util'; -export { Service }; -export declare const getService: typeof Service.get; -export declare const serviceClasses: Record; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index eb1bd8cc..00000000 --- a/lib/index.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.serviceClasses = exports.getService = exports.Service = exports.Util = exports.formatRequest = exports.ensurePromise = exports.DBotsError = exports.Constants = exports.Poster = void 0; -var Service_1 = require("./Interface/Service"); -Object.defineProperty(exports, "Service", { enumerable: true, get: function () { return Service_1.Service; } }); -var Poster_1 = require("./Interface/Poster"); -Object.defineProperty(exports, "Poster", { enumerable: true, get: function () { return Poster_1.Poster; } }); -exports.Constants = __importStar(require("./Utils/Constants")); -exports.DBotsError = __importStar(require("./Utils/DBotsError")); -var EnsurePromise_1 = require("./Utils/EnsurePromise"); -Object.defineProperty(exports, "ensurePromise", { enumerable: true, get: function () { return EnsurePromise_1.ensurePromise; } }); -var FormatRequest_1 = require("./Utils/FormatRequest"); -Object.defineProperty(exports, "formatRequest", { enumerable: true, get: function () { return FormatRequest_1.formatRequest; } }); -exports.Util = __importStar(require("./Utils/Util")); -exports.getService = Service_1.Service.get; -exports.serviceClasses = Service_1.Service.getAll(); From e651174d84b74167bfe8fcb760c5d2ad4c883335 Mon Sep 17 00:00:00 2001 From: Snazzah Date: Thu, 25 Mar 2021 10:26:18 -0500 Subject: [PATCH 08/10] fix: paracord filler fix --- src/Interface/Clients/Paracord.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Interface/Clients/Paracord.ts b/src/Interface/Clients/Paracord.ts index 367a502e..240ce027 100644 --- a/src/Interface/Clients/Paracord.ts +++ b/src/Interface/Clients/Paracord.ts @@ -6,7 +6,8 @@ import { ClientFiller } from '../ClientFiller' * @private */ export default class Paracord extends ClientFiller { - get userCount(): number { + get userCount() { + if (!this.client.guilds) return undefined return Array.from(this.client.guilds.values as ArrayLike).reduce( (count: number, guild: AnyObject) => count + guild.member_count, 0 From 3e159ff6a702c31711c20502ba3cf30dbc914718 Mon Sep 17 00:00:00 2001 From: Snazzah <7025343+Snazzah@users.noreply.github.com> Date: Thu, 25 Mar 2021 13:13:08 -0500 Subject: [PATCH 09/10] fix: use Object.values Co-authored-by: Federico Grandi --- src/Interface/Clients/DiscordIO.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Interface/Clients/DiscordIO.ts b/src/Interface/Clients/DiscordIO.ts index 2539190e..d264db6b 100644 --- a/src/Interface/Clients/DiscordIO.ts +++ b/src/Interface/Clients/DiscordIO.ts @@ -9,8 +9,7 @@ import { ClientFiller } from '../ClientFiller' export default class DiscordIO extends ClientFiller { get userCount() { if (!this.client.servers) return undefined - return Object.keys(this.client.servers) - .map((id) => this.client.servers[id]) + return Object.values(this.client.servers) .reduce( (count: number, guild: AnyObject) => count + guild.member_count, 0 From 014fca09e9cb70f296b1e0cdee349845ce6e2257 Mon Sep 17 00:00:00 2001 From: Snazzah <7025343+Snazzah@users.noreply.github.com> Date: Thu, 25 Mar 2021 13:19:43 -0500 Subject: [PATCH 10/10] fix: revert commit --- src/Interface/Clients/DiscordIO.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Interface/Clients/DiscordIO.ts b/src/Interface/Clients/DiscordIO.ts index d264db6b..2539190e 100644 --- a/src/Interface/Clients/DiscordIO.ts +++ b/src/Interface/Clients/DiscordIO.ts @@ -9,7 +9,8 @@ import { ClientFiller } from '../ClientFiller' export default class DiscordIO extends ClientFiller { get userCount() { if (!this.client.servers) return undefined - return Object.values(this.client.servers) + return Object.keys(this.client.servers) + .map((id) => this.client.servers[id]) .reduce( (count: number, guild: AnyObject) => count + guild.member_count, 0