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 4b785aaf..00000000 --- a/lib/Interface/Clients/DiscordIO.js +++ /dev/null @@ -1,74 +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) { - 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 f55bb488..00000000 --- a/lib/Interface/Clients/DiscordJS.js +++ /dev/null @@ -1,81 +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) { - 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.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; - else - return (_e = this.client.users) === null || _e === void 0 ? void 0 : _e.size; - }, - 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 c7a6d228..00000000 --- a/lib/Interface/Clients/Discordie.js +++ /dev/null @@ -1,73 +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) { - 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 d55ff602..00000000 --- a/lib/Interface/Clients/Eris.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) { - 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 19b56c60..00000000 --- a/lib/Interface/Clients/Paracord.js +++ /dev/null @@ -1,74 +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) { - 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 19e594a9..00000000 --- a/lib/Interface/Lists/Arcane.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) { - 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 760f0a96..00000000 --- a/lib/Interface/Lists/AstroBotList.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) { - 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 47bd3ffc..00000000 --- a/lib/Interface/Lists/BladeBotList.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) { - 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 5dad1f4c..00000000 --- a/lib/Interface/Lists/Blist.js +++ /dev/null @@ -1,150 +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) { - 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 a396e475..00000000 --- a/lib/Interface/Lists/BotListSpace.js +++ /dev/null @@ -1,139 +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) { - 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 bb01ec1c..00000000 --- a/lib/Interface/Lists/BotsDataBase.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) { - 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 eecb21d1..00000000 --- a/lib/Interface/Lists/BotsForDiscord.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) { - 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 3c7f2d34..00000000 --- a/lib/Interface/Lists/BotsOnDiscord.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) { - 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 6007d293..00000000 --- a/lib/Interface/Lists/Carbon.js +++ /dev/null @@ -1,85 +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) { - 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 ae6d0b67..00000000 --- a/lib/Interface/Lists/DBots.js +++ /dev/null @@ -1,103 +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) { - 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 ffc121e0..00000000 --- a/lib/Interface/Lists/DiscordAppsDev.js +++ /dev/null @@ -1,117 +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) { - 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 53113c6c..00000000 --- a/lib/Interface/Lists/DiscordBoats.js +++ /dev/null @@ -1,116 +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) { - 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 6e664288..00000000 --- a/lib/Interface/Lists/DiscordBotDirectory.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) { - 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 09774d36..00000000 --- a/lib/Interface/Lists/DiscordBotList.js +++ /dev/null @@ -1,89 +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) { - 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 3c50ae76..00000000 --- a/lib/Interface/Lists/DiscordBotsCo.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) { - 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 ef4c930b..00000000 --- a/lib/Interface/Lists/DiscordBotsGG.js +++ /dev/null @@ -1,145 +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) { - 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 bb875419..00000000 --- a/lib/Interface/Lists/DiscordExtremeList.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) { - 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 e3cfbe97..00000000 --- a/lib/Interface/Lists/DiscordLabs.js +++ /dev/null @@ -1,97 +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) { - 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 95587ec1..00000000 --- a/lib/Interface/Lists/DiscordListology.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) { - 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 d0cf52d4..00000000 --- a/lib/Interface/Lists/DiscordServices.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) { - 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 d907495e..00000000 --- a/lib/Interface/Lists/Disforge.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) { - 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 661ffa87..00000000 --- a/lib/Interface/Lists/GlennBotList.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) { - 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 50f79125..00000000 --- a/lib/Interface/Lists/InfinityBots.js +++ /dev/null @@ -1,116 +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) { - 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 76e3294b..00000000 --- a/lib/Interface/Lists/ListMyBots.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) { - 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 7eec9929..00000000 --- a/lib/Interface/Lists/ParadiseBots.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) { - 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 8d5c2b76..00000000 --- a/lib/Interface/Lists/SpaceBotsList.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) { - 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 fab400aa..00000000 --- a/lib/Interface/Lists/TopCord.js +++ /dev/null @@ -1,100 +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) { - 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 adf53c49..00000000 --- a/lib/Interface/Lists/TopGG.js +++ /dev/null @@ -1,157 +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) { - 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 6d9f26a2..00000000 --- a/lib/Interface/Lists/VoidBots.js +++ /dev/null @@ -1,131 +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) { - 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 f368c4ec..00000000 --- a/lib/Interface/Lists/WonderBotList.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) { - 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 28743aec..00000000 --- a/lib/Interface/Lists/YABL.js +++ /dev/null @@ -1,135 +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) { - 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 e1559bf2..00000000 --- a/lib/Interface/Poster.js +++ /dev/null @@ -1,321 +0,0 @@ -"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 __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, __spreadArrays([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 bb741d27..00000000 --- a/lib/Interface/Service.js +++ /dev/null @@ -1,185 +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 __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 __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 = __spreadArrays(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 748ea49c..00000000 --- a/lib/Utils/DBotsError.js +++ /dev/null @@ -1,141 +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) { - 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(); 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/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/DiscordJS.ts b/src/Interface/Clients/DiscordJS.ts index 761520f5..142d9d2f 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 === 'GuildManager') + 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 { 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..240ce027 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' /** @@ -5,8 +6,12 @@ import { ClientFiller } from '../ClientFiller' * @private */ export default class Paracord extends ClientFiller { - get userCount(): number { - return this.client.users?.size + 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 + ) } get serverCount(): number { 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 }) })