2020-06-26 21:05:09 +02:00
|
|
|
module.exports =
|
|
|
|
/******/ (function(modules) { // webpackBootstrap
|
|
|
|
/******/ // The module cache
|
|
|
|
/******/ var installedModules = {};
|
|
|
|
/******/
|
|
|
|
/******/ // The require function
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
/******/ if(installedModules[moduleId]) {
|
|
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ }
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
/******/ var module = installedModules[moduleId] = {
|
|
|
|
/******/ i: moduleId,
|
|
|
|
/******/ l: false,
|
|
|
|
/******/ exports: {}
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Execute the module function
|
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/
|
|
|
|
/******/ // Flag the module as loaded
|
|
|
|
/******/ module.l = true;
|
|
|
|
/******/
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
/******/ return module.exports;
|
|
|
|
/******/ }
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/
|
|
|
|
/******/ // expose the module cache
|
|
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/
|
|
|
|
/******/ // define getter function for harmony exports
|
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
|
|
/******/ }
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // define __esModule on exports
|
|
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
/******/ }
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // create a fake namespace object
|
|
|
|
/******/ // mode & 1: value is a module id, require it
|
|
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
|
|
/******/ // mode & 4: return value when already ns object
|
|
|
|
/******/ // mode & 8|1: behave like require
|
|
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
|
|
/******/ if(mode & 8) return value;
|
|
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
|
|
/******/ var ns = Object.create(null);
|
|
|
|
/******/ __webpack_require__.r(ns);
|
|
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
|
|
/******/ return ns;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
|
|
/******/ __webpack_require__.n = function(module) {
|
|
|
|
/******/ var getter = module && module.__esModule ?
|
|
|
|
/******/ function getDefault() { return module['default']; } :
|
|
|
|
/******/ function getModuleExports() { return module; };
|
|
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
|
|
/******/ return getter;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
|
|
/******/
|
|
|
|
/******/ // __webpack_public_path__
|
|
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // Load entry module and return exports
|
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts");
|
|
|
|
/******/ })
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ ({
|
|
|
|
|
|
|
|
/***/ "./node_modules/@discordjs/collection/dist/index.js":
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
!*** ./node_modules/@discordjs/collection/dist/index.js ***!
|
|
|
|
\**********************************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
/**
|
|
|
|
* A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has
|
|
|
|
* an ID, for significantly improved performance and ease-of-use.
|
|
|
|
* @extends {Map}
|
|
|
|
* @property {number} size - The amount of elements in this collection.
|
|
|
|
*/
|
|
|
|
class Collection extends Map {
|
|
|
|
constructor(entries) {
|
|
|
|
super(entries);
|
|
|
|
/**
|
|
|
|
* Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called
|
|
|
|
* @name Collection#_array
|
|
|
|
* @type {?Array}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Object.defineProperty(this, '_array', { value: null, writable: true, configurable: true });
|
|
|
|
/**
|
|
|
|
* Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called
|
|
|
|
* @name Collection#_keyArray
|
|
|
|
* @type {?Array}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
Object.defineProperty(this, '_keyArray', { value: null, writable: true, configurable: true });
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Identical to [Map.get()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get).
|
|
|
|
* Gets an element with the specified key, and returns its value, or `undefined` if the element does not exist.
|
|
|
|
* @param {*} key - The key to get from this collection
|
|
|
|
* @returns {* | undefined}
|
|
|
|
*/
|
|
|
|
get(key) {
|
|
|
|
return super.get(key);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Identical to [Map.set()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set).
|
|
|
|
* Sets a new element in the collection with the specified key and value.
|
|
|
|
* @param {*} key - The key of the element to add
|
|
|
|
* @param {*} value - The value of the element to add
|
|
|
|
* @returns {Collection}
|
|
|
|
*/
|
|
|
|
set(key, value) {
|
|
|
|
this._array = null;
|
|
|
|
this._keyArray = null;
|
|
|
|
return super.set(key, value);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Identical to [Map.has()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has).
|
|
|
|
* Checks if an element exists in the collection.
|
|
|
|
* @param {*} key - The key of the element to check for
|
|
|
|
* @returns {boolean} `true` if the element exists, `false` if it does not exist.
|
|
|
|
*/
|
|
|
|
has(key) {
|
|
|
|
return super.has(key);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Identical to [Map.delete()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete).
|
|
|
|
* Deletes an element from the collection.
|
|
|
|
* @param {*} key - The key to delete from the collection
|
|
|
|
* @returns {boolean} `true` if the element was removed, `false` if the element does not exist.
|
|
|
|
*/
|
|
|
|
delete(key) {
|
|
|
|
this._array = null;
|
|
|
|
this._keyArray = null;
|
|
|
|
return super.delete(key);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Identical to [Map.clear()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear).
|
|
|
|
* Removes all elements from the collection.
|
|
|
|
* @returns {undefined}
|
|
|
|
*/
|
|
|
|
clear() {
|
|
|
|
return super.clear();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Creates an ordered array of the values of this collection, and caches it internally. The array will only be
|
|
|
|
* reconstructed if an item is added to or removed from the collection, or if you change the length of the array
|
|
|
|
* itself. If you don't want this caching behavior, use `[...collection.values()]` or
|
|
|
|
* `Array.from(collection.values())` instead.
|
|
|
|
* @returns {Array}
|
|
|
|
*/
|
|
|
|
array() {
|
|
|
|
if (!this._array || this._array.length !== this.size)
|
|
|
|
this._array = [...this.values()];
|
|
|
|
return this._array;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Creates an ordered array of the keys of this collection, and caches it internally. The array will only be
|
|
|
|
* reconstructed if an item is added to or removed from the collection, or if you change the length of the array
|
|
|
|
* itself. If you don't want this caching behavior, use `[...collection.keys()]` or
|
|
|
|
* `Array.from(collection.keys())` instead.
|
|
|
|
* @returns {Array}
|
|
|
|
*/
|
|
|
|
keyArray() {
|
|
|
|
if (!this._keyArray || this._keyArray.length !== this.size)
|
|
|
|
this._keyArray = [...this.keys()];
|
|
|
|
return this._keyArray;
|
|
|
|
}
|
|
|
|
first(amount) {
|
|
|
|
if (typeof amount === 'undefined')
|
|
|
|
return this.values().next().value;
|
|
|
|
if (amount < 0)
|
|
|
|
return this.last(amount * -1);
|
|
|
|
amount = Math.min(this.size, amount);
|
|
|
|
const iter = this.values();
|
|
|
|
return Array.from({ length: amount }, () => iter.next().value);
|
|
|
|
}
|
|
|
|
firstKey(amount) {
|
|
|
|
if (typeof amount === 'undefined')
|
|
|
|
return this.keys().next().value;
|
|
|
|
if (amount < 0)
|
|
|
|
return this.lastKey(amount * -1);
|
|
|
|
amount = Math.min(this.size, amount);
|
|
|
|
const iter = this.keys();
|
|
|
|
return Array.from({ length: amount }, () => iter.next().value);
|
|
|
|
}
|
|
|
|
last(amount) {
|
|
|
|
const arr = this.array();
|
|
|
|
if (typeof amount === 'undefined')
|
|
|
|
return arr[arr.length - 1];
|
|
|
|
if (amount < 0)
|
|
|
|
return this.first(amount * -1);
|
|
|
|
if (!amount)
|
|
|
|
return [];
|
|
|
|
return arr.slice(-amount);
|
|
|
|
}
|
|
|
|
lastKey(amount) {
|
|
|
|
const arr = this.keyArray();
|
|
|
|
if (typeof amount === 'undefined')
|
|
|
|
return arr[arr.length - 1];
|
|
|
|
if (amount < 0)
|
|
|
|
return this.firstKey(amount * -1);
|
|
|
|
if (!amount)
|
|
|
|
return [];
|
|
|
|
return arr.slice(-amount);
|
|
|
|
}
|
|
|
|
random(amount) {
|
|
|
|
let arr = this.array();
|
|
|
|
if (typeof amount === 'undefined')
|
|
|
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
|
|
if (arr.length === 0 || !amount)
|
|
|
|
return [];
|
|
|
|
arr = arr.slice();
|
|
|
|
return Array.from({ length: amount }, () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]);
|
|
|
|
}
|
|
|
|
randomKey(amount) {
|
|
|
|
let arr = this.keyArray();
|
|
|
|
if (typeof amount === 'undefined')
|
|
|
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
|
|
if (arr.length === 0 || !amount)
|
|
|
|
return [];
|
|
|
|
arr = arr.slice();
|
|
|
|
return Array.from({ length: amount }, () => arr.splice(Math.floor(Math.random() * arr.length), 1)[0]);
|
|
|
|
}
|
|
|
|
find(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (fn(val, key, this))
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
findKey(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (fn(val, key, this))
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
sweep(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
const previousSize = this.size;
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (fn(val, key, this))
|
|
|
|
this.delete(key);
|
|
|
|
}
|
|
|
|
return previousSize - this.size;
|
|
|
|
}
|
|
|
|
filter(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
const results = new this.constructor[Symbol.species]();
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (fn(val, key, this))
|
|
|
|
results.set(key, val);
|
|
|
|
}
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
partition(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
// TODO: consider removing the <K, V> from the constructors after TS 3.7.0 is released, as it infers it
|
|
|
|
const results = [new this.constructor[Symbol.species](), new this.constructor[Symbol.species]()];
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (fn(val, key, this)) {
|
|
|
|
results[0].set(key, val);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
results[1].set(key, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
flatMap(fn, thisArg) {
|
|
|
|
const collections = this.map(fn, thisArg);
|
|
|
|
return new this.constructor[Symbol.species]().concat(...collections);
|
|
|
|
}
|
|
|
|
map(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
const iter = this.entries();
|
|
|
|
return Array.from({ length: this.size }, () => {
|
|
|
|
const [key, value] = iter.next().value;
|
|
|
|
return fn(value, key, this);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
mapValues(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
const coll = new this.constructor[Symbol.species]();
|
|
|
|
for (const [key, val] of this)
|
|
|
|
coll.set(key, fn(val, key, this));
|
|
|
|
return coll;
|
|
|
|
}
|
|
|
|
some(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (fn(val, key, this))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
every(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (!fn(val, key, this))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Applies a function to produce a single value. Identical in behavior to
|
|
|
|
* [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce).
|
|
|
|
* @param {Function} fn Function used to reduce, taking four arguments; `accumulator`, `currentValue`, `currentKey`,
|
|
|
|
* and `collection`
|
|
|
|
* @param {*} [initialValue] Starting value for the accumulator
|
|
|
|
* @returns {*}
|
|
|
|
* @example collection.reduce((acc, guild) => acc + guild.memberCount, 0);
|
|
|
|
*/
|
|
|
|
reduce(fn, initialValue) {
|
|
|
|
let accumulator;
|
|
|
|
if (typeof initialValue !== 'undefined') {
|
|
|
|
accumulator = initialValue;
|
|
|
|
for (const [key, val] of this)
|
|
|
|
accumulator = fn(accumulator, val, key, this);
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
let first = true;
|
|
|
|
for (const [key, val] of this) {
|
|
|
|
if (first) {
|
|
|
|
accumulator = val;
|
|
|
|
first = false;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
accumulator = fn(accumulator, val, key, this);
|
|
|
|
}
|
|
|
|
// No items iterated.
|
|
|
|
if (first) {
|
|
|
|
throw new TypeError('Reduce of empty collection with no initial value');
|
|
|
|
}
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
each(fn, thisArg) {
|
|
|
|
this.forEach(fn, thisArg);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
tap(fn, thisArg) {
|
|
|
|
if (typeof thisArg !== 'undefined')
|
|
|
|
fn = fn.bind(thisArg);
|
|
|
|
fn(this);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Creates an identical shallow copy of this collection.
|
|
|
|
* @returns {Collection}
|
|
|
|
* @example const newColl = someColl.clone();
|
|
|
|
*/
|
|
|
|
clone() {
|
|
|
|
return new this.constructor[Symbol.species](this);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Combines this collection with others into a new collection. None of the source collections are modified.
|
|
|
|
* @param {...Collection} collections Collections to merge
|
|
|
|
* @returns {Collection}
|
|
|
|
* @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl);
|
|
|
|
*/
|
|
|
|
concat(...collections) {
|
|
|
|
const newColl = this.clone();
|
|
|
|
for (const coll of collections) {
|
|
|
|
for (const [key, val] of coll)
|
|
|
|
newColl.set(key, val);
|
|
|
|
}
|
|
|
|
return newColl;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Checks if this collection shares identical items with another.
|
|
|
|
* This is different to checking for equality using equal-signs, because
|
|
|
|
* the collections may be different objects, but contain the same data.
|
|
|
|
* @param {Collection} collection Collection to compare with
|
|
|
|
* @returns {boolean} Whether the collections have identical contents
|
|
|
|
*/
|
|
|
|
equals(collection) {
|
|
|
|
if (!collection)
|
|
|
|
return false;
|
|
|
|
if (this === collection)
|
|
|
|
return true;
|
|
|
|
if (this.size !== collection.size)
|
|
|
|
return false;
|
|
|
|
for (const [key, value] of this) {
|
|
|
|
if (!collection.has(key) || value !== collection.get(key)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* The sort method sorts the items of a collection in place and returns it.
|
|
|
|
* The sort is not necessarily stable. The default sort order is according to string Unicode code points.
|
|
|
|
* @param {Function} [compareFunction] Specifies a function that defines the sort order.
|
|
|
|
* If omitted, the collection is sorted according to each character's Unicode code point value,
|
|
|
|
* according to the string conversion of each element.
|
|
|
|
* @returns {Collection}
|
|
|
|
* @example collection.sort((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
|
|
|
|
*/
|
|
|
|
sort(compareFunction = (x, y) => Number(x > y) || Number(x === y) - 1) {
|
|
|
|
const entries = [...this.entries()];
|
|
|
|
entries.sort((a, b) => compareFunction(a[1], b[1], a[0], b[0]));
|
|
|
|
// Perform clean-up
|
|
|
|
super.clear();
|
|
|
|
this._array = null;
|
|
|
|
this._keyArray = null;
|
|
|
|
// Set the new entries
|
|
|
|
for (const [k, v] of entries) {
|
|
|
|
super.set(k, v);
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* The intersect method returns a new structure containing items where the keys are present in both original structures.
|
|
|
|
* @param {Collection} other The other Collection to filter against
|
|
|
|
* @returns {Collection}
|
|
|
|
*/
|
|
|
|
intersect(other) {
|
|
|
|
return other.filter((_, k) => this.has(k));
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* The difference method returns a new structure containing items where the key is present in one of the original structures but not the other.
|
|
|
|
* @param {Collection} other The other Collection to filter against
|
|
|
|
* @returns {Collection}
|
|
|
|
*/
|
|
|
|
difference(other) {
|
|
|
|
return other.filter((_, k) => !this.has(k)).concat(this.filter((_, k) => !other.has(k)));
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* The sorted method sorts the items of a collection and returns it.
|
|
|
|
* The sort is not necessarily stable. The default sort order is according to string Unicode code points.
|
|
|
|
* @param {Function} [compareFunction] Specifies a function that defines the sort order.
|
|
|
|
* If omitted, the collection is sorted according to each character's Unicode code point value,
|
|
|
|
* according to the string conversion of each element.
|
|
|
|
* @returns {Collection}
|
|
|
|
* @example collection.sorted((userA, userB) => userA.createdTimestamp - userB.createdTimestamp);
|
|
|
|
*/
|
|
|
|
sorted(compareFunction = (x, y) => Number(x > y) || Number(x === y) - 1) {
|
|
|
|
return new this.constructor[Symbol.species]([...this.entries()])
|
|
|
|
.sort((av, bv, ak, bk) => compareFunction(av, bv, ak, bk));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.Collection = Collection;
|
|
|
|
Collection.default = Collection;
|
|
|
|
exports.default = Collection;
|
|
|
|
module.exports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/client/client.ts ***!
|
|
|
|
\******************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const events_1 = __webpack_require__(/*! events */ "events");
|
|
|
|
const DiscordJSError_1 = __webpack_require__(/*! ../util/DiscordJSError */ "./src/util/DiscordJSError.ts");
|
|
|
|
const collection_1 = __webpack_require__(/*! @discordjs/collection */ "./node_modules/@discordjs/collection/dist/index.js");
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../util/DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
const util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts");
|
|
|
|
const ClientUser_1 = __webpack_require__(/*! ../structures/ClientUser */ "./src/structures/ClientUser.ts");
|
|
|
|
let hasInit = false;
|
|
|
|
function setupEvents(client) {
|
|
|
|
let dispatcher = DiscordToModules_1.DispatcherModule;
|
|
|
|
dispatcher.subscribe("CONNECTION_OPEN", () => {
|
|
|
|
client.emit("self.ready");
|
|
|
|
});
|
|
|
|
dispatcher.subscribe("MESSAGE_CREATE", action => {
|
|
|
|
if (action.optimistic)
|
|
|
|
return; // disable not sent messages
|
|
|
|
action.message && client.emit("self.messageCreate", action.message);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
class Client extends events_1.EventEmitter {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.user = null;
|
|
|
|
if (hasInit)
|
|
|
|
throw new DiscordJSError_1.default("Cannot initialized more than one client.");
|
|
|
|
hasInit = true;
|
|
|
|
setupEvents(this);
|
|
|
|
this.on("self.ready", () => {
|
|
|
|
try {
|
|
|
|
this.user = new ClientUser_1.default(DiscordToModules_1.UserModule.getCurrentUser());
|
|
|
|
console.log(this.user);
|
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
console.log(DiscordToModules_1.UserModule.getCurrentUser, DiscordToModules_1.UserModule, typeof DiscordToModules_1.UserModule.getCurrentUser);
|
|
|
|
}
|
|
|
|
this.emit("ready");
|
|
|
|
});
|
|
|
|
this.on("self.messageCreate", (message) => {
|
|
|
|
this.emit("messageCreate", util_1.createMessage(message));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
get broadcasts() {
|
|
|
|
return []; // not giving any since they're not supported.
|
|
|
|
}
|
|
|
|
get browser() {
|
|
|
|
return true; // since we're in electron, we're always in browser
|
|
|
|
}
|
|
|
|
get channels() {
|
|
|
|
const channels = Object.values(DiscordToModules_1.channelsModule.getAllChannels());
|
|
|
|
return new collection_1.default(channels.map(e => ([e.id, util_1.createChannel(e)])));
|
|
|
|
}
|
|
|
|
get emojis() {
|
|
|
|
return new collection_1.default();
|
|
|
|
}
|
|
|
|
get guilds() {
|
|
|
|
const channels = Object.values(DiscordToModules_1.guildModule.getAllGuilds());
|
|
|
|
return new collection_1.default(channels.map(e => ([e.id, util_1.createGuild(e)])));
|
|
|
|
}
|
|
|
|
get users() {
|
|
|
|
const users = Object.values(DiscordToModules_1.UserModule.getUsers());
|
|
|
|
return new collection_1.default(users.map(e => [e.id, util_1.createUser(e)]));
|
|
|
|
}
|
|
|
|
/** Warnings and overrides for functions that are not compatible. */
|
|
|
|
async login() {
|
2020-07-04 22:42:26 +02:00
|
|
|
throw new DiscordJSError_1.default("Client#login is not supported. DiscordJS on lightcord will use the logged in account.");
|
2020-06-26 21:05:09 +02:00
|
|
|
}
|
|
|
|
get token() {
|
2020-07-04 22:42:26 +02:00
|
|
|
throw new DiscordJSError_1.default("Client#token is not supported. DiscordJS on lightcord will use the logged in account.");
|
2020-06-26 21:05:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = Client;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/index.ts":
|
|
|
|
/*!**********************!*\
|
|
|
|
!*** ./src/index.ts ***!
|
|
|
|
\**********************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const client_1 = __webpack_require__(/*! ./client/client */ "./src/client/client.ts");
|
|
|
|
const client = new client_1.default();
|
|
|
|
const DiscordJSExporrts = {
|
|
|
|
Client: client_1.default,
|
|
|
|
client
|
|
|
|
};
|
|
|
|
window.DiscordJS = DiscordJSExporrts;
|
|
|
|
window.DiscordJSClient = client;
|
|
|
|
exports.default = DiscordJSExporrts;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/BaseChannel.ts":
|
|
|
|
/*!***************************************!*\
|
|
|
|
!*** ./src/structures/BaseChannel.ts ***!
|
|
|
|
\***************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../util/DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
const BaseStructure_1 = __webpack_require__(/*! ./BaseStructure */ "./src/structures/BaseStructure.ts");
|
|
|
|
const Snowflake_1 = __webpack_require__(/*! ../util/Snowflake */ "./src/util/Snowflake.ts");
|
|
|
|
class BaseChannel extends BaseStructure_1.default {
|
|
|
|
constructor(channel) {
|
|
|
|
super();
|
|
|
|
this.id = channel.id;
|
|
|
|
this.deleted = false;
|
|
|
|
this.DiscordChannel = channel;
|
|
|
|
}
|
|
|
|
get createdAt() {
|
|
|
|
return new Date(this.createdTimestamp);
|
|
|
|
}
|
|
|
|
get createdTimestamp() {
|
|
|
|
return Snowflake_1.default.deconstruct(this.id).timestamp;
|
|
|
|
}
|
|
|
|
delete() {
|
|
|
|
return DiscordToModules_1.channelsModule.delete(this.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = BaseChannel;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/BaseStructure.ts":
|
|
|
|
/*!*****************************************!*\
|
|
|
|
!*** ./src/structures/BaseStructure.ts ***!
|
|
|
|
\*****************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
class BaseStructure {
|
|
|
|
constructor() { }
|
|
|
|
get client() {
|
|
|
|
return window.DiscordJSClient;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = BaseStructure;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/ClientUser.ts":
|
|
|
|
/*!**************************************!*\
|
|
|
|
!*** ./src/structures/ClientUser.ts ***!
|
|
|
|
\**************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const User_1 = __webpack_require__(/*! ./User */ "./src/structures/User.ts");
|
|
|
|
class ClientUser extends User_1.default {
|
|
|
|
}
|
|
|
|
exports.default = ClientUser;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/Guild.ts":
|
|
|
|
/*!*********************************!*\
|
|
|
|
!*** ./src/structures/Guild.ts ***!
|
|
|
|
\*********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../util/DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
const BaseStructure_1 = __webpack_require__(/*! ./BaseStructure */ "./src/structures/BaseStructure.ts");
|
|
|
|
const util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts");
|
|
|
|
const collection_1 = __webpack_require__(/*! @discordjs/collection */ "./node_modules/@discordjs/collection/dist/index.js");
|
|
|
|
const Snowflake_1 = __webpack_require__(/*! ../util/Snowflake */ "./src/util/Snowflake.ts");
|
|
|
|
const Constants_1 = __webpack_require__(/*! ../util/Constants */ "./src/util/Constants.ts");
|
|
|
|
const DiscordJSError_1 = __webpack_require__(/*! ../util/DiscordJSError */ "./src/util/DiscordJSError.ts");
|
|
|
|
class Guild extends BaseStructure_1.default {
|
|
|
|
constructor(data) {
|
|
|
|
super();
|
|
|
|
this.deleted = false;
|
|
|
|
this.DiscordGuild = data;
|
|
|
|
}
|
|
|
|
get id() {
|
|
|
|
return this.DiscordGuild.id;
|
|
|
|
}
|
|
|
|
get afkChannel() {
|
|
|
|
if (!this.afkChannelID)
|
|
|
|
return null;
|
|
|
|
return util_1.createChannel(DiscordToModules_1.channelsModule.getChannel(this.afkChannelID));
|
|
|
|
}
|
|
|
|
get afkChannelID() {
|
|
|
|
return this.DiscordGuild.afkChannelId;
|
|
|
|
}
|
|
|
|
get afkTimeout() {
|
|
|
|
return this.DiscordGuild.afkTimeout;
|
|
|
|
}
|
|
|
|
get applicationID() {
|
|
|
|
return this.DiscordGuild.application_id;
|
|
|
|
}
|
|
|
|
get available() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
get channels() {
|
|
|
|
{
|
|
|
|
return this.client.channels.filter(channel => channel.guild_id === this.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
get createdAt() {
|
|
|
|
return Snowflake_1.default.deconstruct(this.id).date;
|
|
|
|
}
|
|
|
|
get createdTimestamp() {
|
|
|
|
return this.createdAt.getTime();
|
|
|
|
}
|
|
|
|
get defaultChannel() {
|
|
|
|
return this.channels.get(this.id);
|
|
|
|
}
|
|
|
|
get defaultMessageNotifications() {
|
|
|
|
return this.DiscordGuild.defaultMessageNotifications;
|
|
|
|
}
|
|
|
|
get embedEnabled() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
get emojis() {
|
|
|
|
return this.client.emojis.filter(e => e.guild_id === this.id);
|
|
|
|
}
|
|
|
|
get explicitContentFilter() {
|
|
|
|
return this.DiscordGuild.explicitContentFilter;
|
|
|
|
}
|
|
|
|
get features() {
|
|
|
|
return Array.from(this.DiscordGuild.features);
|
|
|
|
}
|
|
|
|
get icon() {
|
|
|
|
return this.DiscordGuild.icon;
|
|
|
|
}
|
|
|
|
get iconURL() {
|
|
|
|
return this.DiscordGuild.getIconURL().replace(".webp", ".jpg");
|
|
|
|
}
|
|
|
|
get joinedAt() {
|
|
|
|
return new Date(this.DiscordGuild.joinedAt);
|
|
|
|
}
|
|
|
|
get joinedTimestamp() {
|
|
|
|
return this.DiscordGuild.joinedAt.getTime();
|
|
|
|
}
|
|
|
|
get large() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
get me() {
|
|
|
|
return this.members.find(member => member.id === this.client.user.id);
|
|
|
|
}
|
|
|
|
get memberCount() {
|
|
|
|
return DiscordToModules_1.guildModule.getMemberCount(this.id);
|
|
|
|
}
|
|
|
|
get members() {
|
|
|
|
return new collection_1.default(DiscordToModules_1.guildModule.getMembers(this.id).map(member => [member.userId, util_1.createGuildMember(member)]));
|
|
|
|
}
|
|
|
|
get messageNotifications() {
|
|
|
|
return Constants_1.MessageNotificationType[DiscordToModules_1.guildModule.getMessageNotifications(this.id)];
|
|
|
|
}
|
|
|
|
get mfaLevel() {
|
|
|
|
return this.DiscordGuild.mfaLevel;
|
|
|
|
}
|
|
|
|
get mobilePush() {
|
|
|
|
return DiscordToModules_1.guildModule.getNotificationsState().userGuildSettings[this.id].mobile_push;
|
|
|
|
}
|
|
|
|
get muted() {
|
|
|
|
return DiscordToModules_1.guildModule.getNotificationsState().userGuildSettings[this.id].muted;
|
|
|
|
}
|
|
|
|
get name() {
|
|
|
|
return this.DiscordGuild.name;
|
|
|
|
}
|
|
|
|
get nameAcronym() {
|
|
|
|
return this.DiscordGuild.acronym;
|
|
|
|
}
|
|
|
|
get owner() {
|
|
|
|
return this.members.get(this.ownerID);
|
|
|
|
}
|
|
|
|
get ownerID() {
|
|
|
|
return this.DiscordGuild.ownerId;
|
|
|
|
}
|
|
|
|
get position() {
|
|
|
|
let guildPositions = DiscordToModules_1.UserSettingsModule.getAllSettings().guildPositions;
|
|
|
|
if (!guildPositions)
|
|
|
|
return 0;
|
|
|
|
return guildPositions.indexOf(this.id);
|
|
|
|
}
|
|
|
|
get presences() {
|
|
|
|
return new collection_1.default();
|
|
|
|
}
|
|
|
|
get region() {
|
|
|
|
return this.DiscordGuild.region;
|
|
|
|
}
|
|
|
|
get roles() {
|
|
|
|
return new collection_1.default(Object.values(this.DiscordGuild.roles).map(role => [role.id, util_1.createRole(role)]));
|
|
|
|
}
|
|
|
|
get splash() {
|
|
|
|
return this.DiscordGuild.splash;
|
|
|
|
}
|
|
|
|
get splashURL() {
|
|
|
|
return DiscordToModules_1.CdnModule.getGuildSplashURL({
|
|
|
|
id: this.id,
|
|
|
|
splash: this.splash,
|
|
|
|
size: DiscordToModules_1.ConstantsModule.SPLASH_SIZE
|
|
|
|
});
|
|
|
|
}
|
|
|
|
get suppressEveryone() {
|
|
|
|
return DiscordToModules_1.guildModule.getNotificationsState().userGuildSettings[this.id].suppress_everyone;
|
|
|
|
}
|
|
|
|
get systemChannel() {
|
|
|
|
return this.client.channels.get(this.systemChannelID);
|
|
|
|
}
|
|
|
|
get systemChannelID() {
|
|
|
|
return this.DiscordGuild.systemChannelId;
|
|
|
|
}
|
|
|
|
get verificationLevel() {
|
|
|
|
return this.DiscordGuild.verificationLevel;
|
|
|
|
}
|
|
|
|
get verified() {
|
|
|
|
return this.features.includes("VERIFIED");
|
|
|
|
}
|
|
|
|
get voiceConnection() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get banner() {
|
|
|
|
return this.DiscordGuild.banner;
|
|
|
|
}
|
|
|
|
get bannerURL() {
|
|
|
|
return DiscordToModules_1.CdnModule.getGuildBannerURL({
|
|
|
|
id: this.id,
|
|
|
|
banner: this.banner
|
|
|
|
});
|
|
|
|
}
|
|
|
|
get description() {
|
|
|
|
return this.DiscordGuild.description;
|
|
|
|
}
|
|
|
|
get embedChannel() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get embedChannelID() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get maximumMembers() {
|
|
|
|
return 250000;
|
|
|
|
}
|
|
|
|
get maximumPresences() {
|
|
|
|
return 5000;
|
|
|
|
}
|
|
|
|
get widgetEnabled() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
get widgetChannelID() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get widgetChannel() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get vanityURLCode() {
|
|
|
|
return this.DiscordGuild.vanityURLCode;
|
|
|
|
}
|
|
|
|
/** FUNCTIONS */
|
|
|
|
async acknowledge() {
|
|
|
|
DiscordToModules_1.AckModule.bulkAck(this.channels.filter(e => e.type === "text").map(e => {
|
|
|
|
return {
|
|
|
|
channelId: e.id,
|
|
|
|
messageId: DiscordToModules_1.channelsModule.lastMessageId(e.id)
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
addMember(...args) {
|
|
|
|
return Promise.reject(new DiscordJSError_1.default("This method is not available on Lightcord."));
|
|
|
|
}
|
|
|
|
allowDMs(allow) {
|
|
|
|
let restricted = DiscordToModules_1.UserSettingsModule.getAllSettings().restrictedGuilds;
|
|
|
|
if (allow) {
|
|
|
|
if (!restricted.includes(this.id))
|
|
|
|
return Promise.resolve(this);
|
|
|
|
restricted = restricted.filter(e => e !== this.id);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (restricted.includes(this.id))
|
|
|
|
return Promise.resolve(this);
|
|
|
|
restricted.push(this.id);
|
|
|
|
}
|
|
|
|
return DiscordToModules_1.UserSettingsModule.updateRemoteSettings({
|
|
|
|
restrictedGuilds: restricted
|
|
|
|
}).then(() => this);
|
|
|
|
}
|
2020-07-04 22:42:26 +02:00
|
|
|
async ban(user, { days = 0, reason = null } = {}) {
|
2020-06-26 21:05:09 +02:00
|
|
|
let id = util_1.resolveUserID(user);
|
|
|
|
if (!id)
|
|
|
|
return Promise.reject(new DiscordJSError_1.default("Given user could not be resolved to an user ID."));
|
2020-07-04 22:42:26 +02:00
|
|
|
let result = await DiscordToModules_1.guildModule.banUser(this.id, id, days, reason).catch(err => err);
|
|
|
|
if (result instanceof Error || result.status !== 204) {
|
|
|
|
let message = result.body;
|
|
|
|
if (Array.isArray(message)) {
|
|
|
|
message = message[0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (message.user_id) {
|
|
|
|
message = "User: " + message.user_id[0];
|
|
|
|
}
|
|
|
|
else if (message.delete_message_days) {
|
|
|
|
message = "Days: " + message.delete_message_days[0];
|
|
|
|
}
|
|
|
|
else if (message.reason) {
|
|
|
|
message = "Reason: " + message.reason[0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
message = result.text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new DiscordJSError_1.default(message);
|
|
|
|
}
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
createChannel(name, typeOrOptions = 'text', permissionOverwrites, reason) {
|
2020-06-26 21:05:09 +02:00
|
|
|
}
|
|
|
|
fetch() {
|
|
|
|
let guild = DiscordToModules_1.guildModule.getGuild(this.id);
|
|
|
|
if (!guild) {
|
|
|
|
this.deleted = true;
|
|
|
|
return Promise.resolve(this);
|
|
|
|
}
|
|
|
|
this.DiscordGuild = guild;
|
|
|
|
return Promise.resolve(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = Guild;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/GuildChannel.ts":
|
|
|
|
/*!****************************************!*\
|
|
|
|
!*** ./src/structures/GuildChannel.ts ***!
|
|
|
|
\****************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const BaseChannel_1 = __webpack_require__(/*! ./BaseChannel */ "./src/structures/BaseChannel.ts");
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../util/DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
const util_1 = __webpack_require__(/*! ../util/util */ "./src/util/util.ts");
|
|
|
|
class GuildChannel extends BaseChannel_1.default {
|
|
|
|
constructor(channel) {
|
|
|
|
super(channel);
|
|
|
|
}
|
|
|
|
get guild() {
|
|
|
|
return util_1.createGuild(DiscordToModules_1.guildModule.getGuild(this.DiscordChannel.guild_id));
|
|
|
|
}
|
|
|
|
get guild_id() {
|
|
|
|
return this.DiscordChannel.guild_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = GuildChannel;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/GuildMember.ts":
|
|
|
|
/*!***************************************!*\
|
|
|
|
!*** ./src/structures/GuildMember.ts ***!
|
|
|
|
\***************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const BaseStructure_1 = __webpack_require__(/*! ./BaseStructure */ "./src/structures/BaseStructure.ts");
|
|
|
|
class GuildMember extends BaseStructure_1.default {
|
|
|
|
constructor(data) {
|
|
|
|
super();
|
|
|
|
this.DiscordGuildMember = data;
|
|
|
|
}
|
|
|
|
get id() {
|
|
|
|
return this.DiscordGuildMember.userId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = GuildMember;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/Message.ts":
|
|
|
|
/*!***********************************!*\
|
|
|
|
!*** ./src/structures/Message.ts ***!
|
|
|
|
\***********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const BaseStructure_1 = __webpack_require__(/*! ./BaseStructure */ "./src/structures/BaseStructure.ts");
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../util/DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
const User_1 = __webpack_require__(/*! ./User */ "./src/structures/User.ts");
|
|
|
|
class Message extends BaseStructure_1.default {
|
|
|
|
constructor(data) {
|
|
|
|
super();
|
|
|
|
this.DiscordMessage = data;
|
|
|
|
}
|
|
|
|
get author() {
|
|
|
|
return new User_1.default(DiscordToModules_1.UserModule.getUser(this.DiscordMessage.author.id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = Message;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/Role.ts":
|
|
|
|
/*!********************************!*\
|
|
|
|
!*** ./src/structures/Role.ts ***!
|
|
|
|
\********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const BaseStructure_1 = __webpack_require__(/*! ./BaseStructure */ "./src/structures/BaseStructure.ts");
|
|
|
|
class Role extends BaseStructure_1.default {
|
|
|
|
constructor(data) {
|
|
|
|
super();
|
|
|
|
this.DiscordRole = data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = Role;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/TextChannel.ts":
|
|
|
|
/*!***************************************!*\
|
|
|
|
!*** ./src/structures/TextChannel.ts ***!
|
|
|
|
\***************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const GuildChannel_1 = __webpack_require__(/*! ./GuildChannel */ "./src/structures/GuildChannel.ts");
|
|
|
|
const Constants_1 = __webpack_require__(/*! ../util/Constants */ "./src/util/Constants.ts");
|
|
|
|
class TextChannel extends GuildChannel_1.default /* implements TextBasedChannel*/ {
|
|
|
|
constructor(data) {
|
|
|
|
super(data);
|
|
|
|
}
|
|
|
|
get type() {
|
|
|
|
return Constants_1.ChannelTypes.TEXT;
|
|
|
|
}
|
|
|
|
}
|
2020-07-04 22:42:26 +02:00
|
|
|
exports.default = TextChannel;
|
2020-06-26 21:05:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/structures/User.ts":
|
|
|
|
/*!********************************!*\
|
|
|
|
!*** ./src/structures/User.ts ***!
|
|
|
|
\********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const BaseStructure_1 = __webpack_require__(/*! ./BaseStructure */ "./src/structures/BaseStructure.ts");
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../util/DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
class User extends BaseStructure_1.default {
|
|
|
|
constructor(data) {
|
|
|
|
super();
|
|
|
|
this.DiscordUser = data;
|
|
|
|
}
|
|
|
|
get id() {
|
|
|
|
return this.DiscordUser.id;
|
|
|
|
}
|
|
|
|
get avatar() {
|
|
|
|
return this.DiscordUser.avatar;
|
|
|
|
}
|
|
|
|
get avatarURL() {
|
|
|
|
return this.DiscordUser.avatarURL;
|
|
|
|
}
|
|
|
|
get bot() {
|
|
|
|
return this.DiscordUser.bot;
|
|
|
|
}
|
|
|
|
get createdAt() {
|
|
|
|
return new Date(this.DiscordUser.createdAt);
|
|
|
|
}
|
|
|
|
get createdTimestamp() {
|
|
|
|
return this.createdAt.getTime();
|
|
|
|
}
|
|
|
|
get defaultAvatarURL() {
|
|
|
|
return DiscordToModules_1.CdnModule.getDefaultAvatarURL(this.discriminator);
|
|
|
|
}
|
|
|
|
get discriminator() {
|
|
|
|
return this.DiscordUser.discriminator;
|
|
|
|
}
|
|
|
|
get displayAvatarURL() {
|
|
|
|
return DiscordToModules_1.CdnModule.getUserAvatarURL({
|
|
|
|
id: this.id,
|
|
|
|
avatar: this.avatar,
|
|
|
|
bot: this.bot,
|
|
|
|
discriminator: this.discriminator
|
|
|
|
}, "png", 4096);
|
|
|
|
}
|
|
|
|
get dmChannel() {
|
|
|
|
return this.client.channels.find(e => e.type === "dm" && e.recipient.id === this.id);
|
|
|
|
}
|
|
|
|
get lastMessage() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get lastMessageID() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
get note() {
|
|
|
|
let note = DiscordToModules_1.UserModule.getNote(this.id);
|
|
|
|
if (!note || !note.note)
|
|
|
|
return null;
|
|
|
|
return note.note;
|
|
|
|
}
|
|
|
|
get presence() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = User;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/Constants.ts":
|
|
|
|
/*!*******************************!*\
|
|
|
|
!*** ./src/util/Constants.ts ***!
|
|
|
|
\*******************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.AVATAR_SIZE = exports.MessageNotificationType = exports.ChannelTypes = void 0;
|
|
|
|
var ChannelTypes;
|
|
|
|
(function (ChannelTypes) {
|
|
|
|
ChannelTypes["TEXT"] = "text";
|
|
|
|
ChannelTypes["DM"] = "dm";
|
|
|
|
ChannelTypes["VOICE"] = "voice";
|
|
|
|
ChannelTypes["GROUP_DM"] = "group";
|
|
|
|
ChannelTypes["CATEGORY"] = "category";
|
|
|
|
ChannelTypes["NEWS"] = "news";
|
|
|
|
ChannelTypes["STORE"] = "store";
|
|
|
|
})(ChannelTypes = exports.ChannelTypes || (exports.ChannelTypes = {}));
|
|
|
|
var MessageNotificationType;
|
|
|
|
(function (MessageNotificationType) {
|
|
|
|
MessageNotificationType[MessageNotificationType["EVERYTHING"] = 0] = "EVERYTHING";
|
|
|
|
MessageNotificationType[MessageNotificationType["MENTIONS"] = 1] = "MENTIONS";
|
|
|
|
MessageNotificationType[MessageNotificationType["NOTHING"] = 2] = "NOTHING";
|
|
|
|
MessageNotificationType[MessageNotificationType["INHERIT"] = 3] = "INHERIT";
|
|
|
|
})(MessageNotificationType = exports.MessageNotificationType || (exports.MessageNotificationType = {}));
|
|
|
|
exports.AVATAR_SIZE = 4096;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/DiscordJSError.ts":
|
|
|
|
/*!************************************!*\
|
|
|
|
!*** ./src/util/DiscordJSError.ts ***!
|
|
|
|
\************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
class DiscordJSError extends Error {
|
|
|
|
constructor(message) {
|
|
|
|
super(message);
|
|
|
|
this.name = "DiscordJSError";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = DiscordJSError;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/DiscordToModules.ts":
|
|
|
|
/*!**************************************!*\
|
|
|
|
!*** ./src/util/DiscordToModules.ts ***!
|
|
|
|
\**************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.DispatcherModule = exports.AckModule = exports.CdnModule = exports.UserModule = exports.ConstantsModule = exports.UserSettingsModule = exports.guildModule = exports.channelsModule = exports.requireModule = void 0;
|
|
|
|
const LazyLoader_1 = __webpack_require__(/*! ./LazyLoader */ "./src/util/LazyLoader.ts");
|
|
|
|
function getModule(name) {
|
|
|
|
return exports[name + "Module"];
|
|
|
|
}
|
|
|
|
exports.default = getModule;
|
|
|
|
const BDModules = window.BDModules;
|
|
|
|
function requireModule(filter) {
|
|
|
|
let module = BDModules.get(filter)[0];
|
|
|
|
return module && module.default || module;
|
|
|
|
}
|
|
|
|
exports.requireModule = requireModule;
|
|
|
|
exports.channelsModule = LazyLoader_1.lazyLoad("channels");
|
|
|
|
exports.guildModule = LazyLoader_1.lazyLoad("guilds");
|
|
|
|
exports.UserSettingsModule = LazyLoader_1.lazyLoad("userSettings");
|
|
|
|
exports.ConstantsModule = LazyLoader_1.lazyLoad("constants");
|
|
|
|
exports.UserModule = LazyLoader_1.lazyLoad("users");
|
|
|
|
exports.CdnModule = LazyLoader_1.lazyLoad("cdn");
|
|
|
|
exports.AckModule = LazyLoader_1.lazyLoad("acknowledge");
|
|
|
|
exports.DispatcherModule = LazyLoader_1.lazyLoad("dispatcher");
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/LazyLoader.ts":
|
|
|
|
/*!********************************!*\
|
|
|
|
!*** ./src/util/LazyLoader.ts ***!
|
|
|
|
\********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.lazyLoad = void 0;
|
|
|
|
const cache = {};
|
|
|
|
function lazyLoad(id) {
|
|
|
|
if (cache[id])
|
|
|
|
return cache[id];
|
|
|
|
let mdl = null;
|
|
|
|
let setModule = () => {
|
|
|
|
if (!mdl)
|
|
|
|
mdl = __webpack_require__("./src/util/modules sync recursive ^\\.\\/.*$")("./" + id);
|
|
|
|
};
|
|
|
|
const handlers = {
|
|
|
|
get(target, prop) {
|
|
|
|
setModule();
|
|
|
|
return mdl[prop];
|
|
|
|
},
|
|
|
|
set(target, prop, value) {
|
|
|
|
setModule();
|
|
|
|
mdl[prop] = value;
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
apply(target, thisArg, args) {
|
|
|
|
setModule();
|
|
|
|
mdl.apply(this, args);
|
|
|
|
},
|
|
|
|
construct(target, args) {
|
|
|
|
setModule();
|
|
|
|
const prototype = Object.create(mdl.prototype);
|
|
|
|
handlers.apply(target, prototype, args);
|
|
|
|
return prototype;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let proxy = new Proxy({}, handlers);
|
|
|
|
return cache[id] = proxy;
|
|
|
|
}
|
|
|
|
exports.lazyLoad = lazyLoad;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/Snowflake.ts":
|
|
|
|
/*!*******************************!*\
|
|
|
|
!*** ./src/util/Snowflake.ts ***!
|
|
|
|
\*******************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const Util = __webpack_require__(/*! ../util/util */ "./src/util/util.ts");
|
|
|
|
// Discord epoch (2015-01-01T00:00:00.000Z)
|
|
|
|
const EPOCH = 1420070400000;
|
|
|
|
let INCREMENT = 0;
|
|
|
|
/**
|
|
|
|
* A container for useful snowflake-related methods.
|
|
|
|
*/
|
|
|
|
class SnowflakeUtil {
|
|
|
|
constructor() {
|
|
|
|
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z
|
|
|
|
* ```
|
|
|
|
* If we have a snowflake '266241948824764416' we can represent it as binary:
|
|
|
|
*
|
|
|
|
* 64 22 17 12 0
|
|
|
|
* 000000111011000111100001101001000101000000 00001 00000 000000000000
|
|
|
|
* number of ms since Discord epoch worker pid increment
|
|
|
|
* ```
|
|
|
|
* @typedef {string} Snowflake
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Generates a Discord snowflake.
|
|
|
|
* <info>This hardcodes the worker ID as 1 and the process ID as 0.</info>
|
|
|
|
* @param {number|Date} [timestamp=Date.now()] Timestamp or date of the snowflake to generate
|
|
|
|
* @returns {Snowflake} The generated snowflake
|
|
|
|
*/
|
|
|
|
static generate(timestamp = Date.now()) {
|
|
|
|
if (timestamp instanceof Date)
|
|
|
|
timestamp = timestamp.getTime();
|
|
|
|
if (typeof timestamp !== 'number' || isNaN(timestamp)) {
|
|
|
|
throw new TypeError(`"timestamp" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})`);
|
|
|
|
}
|
|
|
|
if (INCREMENT >= 4095)
|
|
|
|
INCREMENT = 0;
|
|
|
|
// eslint-disable-next-line max-len
|
|
|
|
const BINARY = `${(timestamp - EPOCH).toString(2).padStart(42, '0')}0000100000${(INCREMENT++)
|
|
|
|
.toString(2)
|
|
|
|
.padStart(12, '0')}`;
|
|
|
|
return Util.binaryToID(BINARY);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* A deconstructed snowflake.
|
|
|
|
* @typedef {Object} DeconstructedSnowflake
|
|
|
|
* @property {number} timestamp Timestamp the snowflake was created
|
|
|
|
* @property {Date} date Date the snowflake was created
|
|
|
|
* @property {number} workerID Worker ID in the snowflake
|
|
|
|
* @property {number} processID Process ID in the snowflake
|
|
|
|
* @property {number} increment Increment in the snowflake
|
|
|
|
* @property {string} binary Binary representation of the snowflake
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Deconstructs a Discord snowflake.
|
|
|
|
* @param {Snowflake} snowflake Snowflake to deconstruct
|
|
|
|
* @returns {DeconstructedSnowflake} Deconstructed snowflake
|
|
|
|
*/
|
|
|
|
static deconstruct(snowflake) {
|
|
|
|
const BINARY = Util.idToBinary(snowflake)
|
|
|
|
.toString()
|
|
|
|
.padStart(64, '0');
|
|
|
|
const res = {
|
|
|
|
timestamp: parseInt(BINARY.substring(0, 42), 2) + EPOCH,
|
|
|
|
workerID: parseInt(BINARY.substring(42, 47), 2),
|
|
|
|
processID: parseInt(BINARY.substring(47, 52), 2),
|
|
|
|
increment: parseInt(BINARY.substring(52, 64), 2),
|
|
|
|
binary: BINARY,
|
|
|
|
};
|
|
|
|
Object.defineProperty(res, 'date', {
|
|
|
|
get: function get() {
|
|
|
|
return new Date(this.timestamp);
|
|
|
|
},
|
|
|
|
enumerable: true,
|
|
|
|
});
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
exports.default = SnowflakeUtil;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules sync recursive ^\\.\\/.*$":
|
|
|
|
/*!****************************************!*\
|
|
|
|
!*** ./src/util/modules sync ^\.\/.*$ ***!
|
|
|
|
\****************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
var map = {
|
|
|
|
"./acknowledge": "./src/util/modules/acknowledge.ts",
|
|
|
|
"./acknowledge.ts": "./src/util/modules/acknowledge.ts",
|
|
|
|
"./cdn": "./src/util/modules/cdn.ts",
|
|
|
|
"./cdn.ts": "./src/util/modules/cdn.ts",
|
|
|
|
"./channels": "./src/util/modules/channels.ts",
|
|
|
|
"./channels.ts": "./src/util/modules/channels.ts",
|
|
|
|
"./constants": "./src/util/modules/constants.ts",
|
|
|
|
"./constants.ts": "./src/util/modules/constants.ts",
|
|
|
|
"./dispatcher": "./src/util/modules/dispatcher.ts",
|
|
|
|
"./dispatcher.ts": "./src/util/modules/dispatcher.ts",
|
|
|
|
"./guilds": "./src/util/modules/guilds.ts",
|
|
|
|
"./guilds.ts": "./src/util/modules/guilds.ts",
|
|
|
|
"./messages": "./src/util/modules/messages.ts",
|
|
|
|
"./messages.ts": "./src/util/modules/messages.ts",
|
|
|
|
"./userSettings": "./src/util/modules/userSettings.ts",
|
|
|
|
"./userSettings.ts": "./src/util/modules/userSettings.ts",
|
|
|
|
"./users": "./src/util/modules/users.ts",
|
|
|
|
"./users.ts": "./src/util/modules/users.ts"
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function webpackContext(req) {
|
|
|
|
var id = webpackContextResolve(req);
|
|
|
|
return __webpack_require__(id);
|
|
|
|
}
|
|
|
|
function webpackContextResolve(req) {
|
|
|
|
if(!__webpack_require__.o(map, req)) {
|
|
|
|
var e = new Error("Cannot find module '" + req + "'");
|
|
|
|
e.code = 'MODULE_NOT_FOUND';
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
return map[req];
|
|
|
|
}
|
|
|
|
webpackContext.keys = function webpackContextKeys() {
|
|
|
|
return Object.keys(map);
|
|
|
|
};
|
|
|
|
webpackContext.resolve = webpackContextResolve;
|
|
|
|
module.exports = webpackContext;
|
|
|
|
webpackContext.id = "./src/util/modules sync recursive ^\\.\\/.*$";
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/acknowledge.ts":
|
|
|
|
/*!*****************************************!*\
|
|
|
|
!*** ./src/util/modules/acknowledge.ts ***!
|
|
|
|
\*****************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
let acknowledgeModuleInternal1 = DiscordToModules_1.requireModule(e => e && e.bulkAck);
|
|
|
|
module.exports = {
|
|
|
|
bulkAck: acknowledgeModuleInternal1.bulkAck
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/cdn.ts":
|
|
|
|
/*!*********************************!*\
|
|
|
|
!*** ./src/util/modules/cdn.ts ***!
|
|
|
|
\*********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
let cdnModuleInternal1 = DiscordToModules_1.requireModule(e => e.default && e.default.getGuildSplashURL);
|
|
|
|
let cdnModuleInternal2 = DiscordToModules_1.requireModule(e => e.default && e.default.DEFAULT_AVATARS);
|
|
|
|
module.exports = {
|
|
|
|
getUserAvatarURL: cdnModuleInternal1.getUserAvatarURL,
|
|
|
|
getGuildSplashURL: cdnModuleInternal1.getGuildSplashURL,
|
|
|
|
getGuildBannerURL: cdnModuleInternal1.getGuildBannerURL,
|
|
|
|
getDefaultAvatarURL(discriminator) {
|
|
|
|
let asset = cdnModuleInternal2.DEFAULT_AVATARS[(typeof discriminator === "string" ? parseInt(discriminator) || 0 : isNaN(discriminator) ? 0 : discriminator) % cdnModuleInternal2.DEFAULT_AVATARS.length];
|
|
|
|
return `${location.protocol}://${window["GLOBAL_ENV"].ASSET_ENDPOINT}/assets/${asset}`;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/channels.ts":
|
|
|
|
/*!**************************************!*\
|
|
|
|
!*** ./src/util/modules/channels.ts ***!
|
|
|
|
\**************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
let channelsModuleInternal1 = DiscordToModules_1.requireModule(e => e.default && e.default.getChannels && e.default.getChannel);
|
|
|
|
let channelsModuleInternal2;
|
|
|
|
let channelsModuleInternal3 = DiscordToModules_1.requireModule(e => e.default && e.default.lastMessageId);
|
|
|
|
function set3() {
|
|
|
|
if (channelsModuleInternal3)
|
|
|
|
return;
|
|
|
|
channelsModuleInternal3 = DiscordToModules_1.requireModule(e => e.default && e.default.lastMessageId);
|
|
|
|
}
|
|
|
|
module.exports = {
|
|
|
|
getChannel: channelsModuleInternal1.getChannel,
|
|
|
|
getAllChannels: channelsModuleInternal1.getChannels,
|
|
|
|
get delete() {
|
|
|
|
return channelsModuleInternal2 ? channelsModuleInternal2.deleteChannel : (channelsModuleInternal2 = DiscordToModules_1.requireModule(e => e.default && e.default.deleteChannel), channelsModuleInternal2.deleteChannel);
|
|
|
|
},
|
|
|
|
get lastMessageId() {
|
|
|
|
set3();
|
|
|
|
return channelsModuleInternal3.lastMessageId;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/constants.ts":
|
|
|
|
/*!***************************************!*\
|
|
|
|
!*** ./src/util/modules/constants.ts ***!
|
|
|
|
\***************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
module.exports = DiscordToModules_1.requireModule(e => e.API_HOST);
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/dispatcher.ts":
|
|
|
|
/*!****************************************!*\
|
|
|
|
!*** ./src/util/modules/dispatcher.ts ***!
|
|
|
|
\****************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
module.exports = DiscordToModules_1.requireModule(m => m.Dispatcher && m.default && m.default.dispatch);
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/guilds.ts":
|
|
|
|
/*!************************************!*\
|
|
|
|
!*** ./src/util/modules/guilds.ts ***!
|
|
|
|
\************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
let guildModuleInternal1 = DiscordToModules_1.requireModule(e => e.default && e.default.getGuilds && e.default.getGuild && !e.default.isFetching);
|
|
|
|
let guildModuleInternal2 = DiscordToModules_1.requireModule(e => e.default && e.default.getMemberCounts && e.default.getMemberCount);
|
|
|
|
let guildModuleInternal3 = DiscordToModules_1.requireModule(e => e.default && e.default.getMembers);
|
|
|
|
let guildModuleInternal4 = DiscordToModules_1.requireModule(e => e.default && e.default.isGuildOrCategoryOrChannelMuted);
|
|
|
|
let guildModuleInternal5 = DiscordToModules_1.requireModule(e => e.default && e.default.banUser);
|
|
|
|
module.exports = {
|
|
|
|
getAllGuilds: guildModuleInternal1.getGuilds,
|
|
|
|
getGuild: guildModuleInternal1.getGuild,
|
|
|
|
getMemberCount: guildModuleInternal2.getMemberCount,
|
|
|
|
getMemberCounts: guildModuleInternal2.getMemberCounts,
|
|
|
|
getMembers: guildModuleInternal3.getMembers,
|
|
|
|
getMember: guildModuleInternal3.getMember,
|
|
|
|
getMemberIds: guildModuleInternal3.getMemberIds,
|
|
|
|
isMember: guildModuleInternal3.isMember,
|
|
|
|
memberOf: guildModuleInternal3.memberOf,
|
|
|
|
getNick: guildModuleInternal3.getNick,
|
|
|
|
getMessageNotifications: guildModuleInternal4.getMessageNotifications,
|
|
|
|
getNotificationsState: guildModuleInternal4.getState,
|
|
|
|
banUser: guildModuleInternal5.banUser,
|
|
|
|
kickUser: guildModuleInternal5.kickUser
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/messages.ts":
|
|
|
|
/*!**************************************!*\
|
|
|
|
!*** ./src/util/modules/messages.ts ***!
|
|
|
|
\**************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/userSettings.ts":
|
|
|
|
/*!******************************************!*\
|
|
|
|
!*** ./src/util/modules/userSettings.ts ***!
|
|
|
|
\******************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
let userSettingModuleInternal1 = DiscordToModules_1.requireModule(e => e.default && e.default.isGuildRestricted);
|
|
|
|
let userSettingModuleInternal2 = DiscordToModules_1.requireModule(e => e.default && e.default.updateLocalSettings);
|
|
|
|
module.exports = Object.assign({ getAllSettings: userSettingModuleInternal1.getAllSettings, getSetting: (setting) => {
|
|
|
|
return userSettingModuleInternal1.getAllSettings()[setting];
|
|
|
|
} }, userSettingModuleInternal2);
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/modules/users.ts":
|
|
|
|
/*!***********************************!*\
|
|
|
|
!*** ./src/util/modules/users.ts ***!
|
|
|
|
\***********************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const DiscordToModules_1 = __webpack_require__(/*! ../DiscordToModules */ "./src/util/DiscordToModules.ts");
|
|
|
|
let userModuleInteral1 = DiscordToModules_1.requireModule(e => e.default && e.default.getUser);
|
|
|
|
let userModuleInteral2 = DiscordToModules_1.requireModule(e => e.default && e.default.getNote);
|
|
|
|
module.exports = {
|
|
|
|
getUser: userModuleInteral1.getUser,
|
|
|
|
getUsers: userModuleInteral1.getUsers,
|
|
|
|
forEach: userModuleInteral1.forEach,
|
|
|
|
findByTag: userModuleInteral1.findByTag,
|
|
|
|
filter: userModuleInteral1.filter,
|
|
|
|
getCurrentUser: userModuleInteral1.getCurrentUser,
|
|
|
|
getNullableCurrentUser: userModuleInteral1.getNullableCurrentUser,
|
|
|
|
getNote: userModuleInteral2.getNote
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "./src/util/util.ts":
|
|
|
|
/*!**************************!*\
|
|
|
|
!*** ./src/util/util.ts ***!
|
|
|
|
\**************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.resolveUserID = exports.binaryToID = exports.idToBinary = exports.applyMixins = exports.createUser = exports.createMessage = exports.createRole = exports.createGuildMember = exports.createGuild = exports.createChannel = void 0;
|
|
|
|
const BaseChannel_1 = __webpack_require__(/*! ../structures/BaseChannel */ "./src/structures/BaseChannel.ts");
|
|
|
|
const Guild_1 = __webpack_require__(/*! ../structures/Guild */ "./src/structures/Guild.ts");
|
|
|
|
const TextChannel_1 = __webpack_require__(/*! ../structures/TextChannel */ "./src/structures/TextChannel.ts");
|
|
|
|
const GuildMember_1 = __webpack_require__(/*! ../structures/GuildMember */ "./src/structures/GuildMember.ts");
|
|
|
|
const Role_1 = __webpack_require__(/*! ../structures/Role */ "./src/structures/Role.ts");
|
|
|
|
const User_1 = __webpack_require__(/*! ../structures/User */ "./src/structures/User.ts");
|
|
|
|
const Message_1 = __webpack_require__(/*! ../structures/Message */ "./src/structures/Message.ts");
|
|
|
|
function createChannel(channel) {
|
|
|
|
let constructor = channels[channel.type] || BaseChannel_1.default;
|
|
|
|
return new constructor(channel);
|
|
|
|
}
|
|
|
|
exports.createChannel = createChannel;
|
|
|
|
const channels = [
|
2020-07-04 22:42:26 +02:00
|
|
|
TextChannel_1.default
|
2020-06-26 21:05:09 +02:00
|
|
|
];
|
|
|
|
function createGuild(guild) {
|
|
|
|
return new Guild_1.default(guild);
|
|
|
|
}
|
|
|
|
exports.createGuild = createGuild;
|
|
|
|
function createGuildMember(member) {
|
|
|
|
return new GuildMember_1.default(member);
|
|
|
|
}
|
|
|
|
exports.createGuildMember = createGuildMember;
|
|
|
|
function createRole(role) {
|
|
|
|
return new Role_1.default(role);
|
|
|
|
}
|
|
|
|
exports.createRole = createRole;
|
|
|
|
function createMessage(message) {
|
|
|
|
return new Message_1.default(message);
|
|
|
|
}
|
|
|
|
exports.createMessage = createMessage;
|
|
|
|
function createUser(user) {
|
|
|
|
return new User_1.default(user);
|
|
|
|
}
|
|
|
|
exports.createUser = createUser;
|
|
|
|
function applyMixins(derivedCtor, baseCtors) {
|
|
|
|
baseCtors.forEach(baseCtor => {
|
|
|
|
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
|
|
if (name !== 'constructor') {
|
|
|
|
derivedCtor.prototype[name] = baseCtor.prototype[name];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.applyMixins = applyMixins;
|
|
|
|
/**
|
|
|
|
* Transforms a snowflake from a decimal string to a bit string.
|
|
|
|
* @param {string} num Snowflake to be transformed
|
|
|
|
* @returns {string}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
function idToBinary(num) {
|
|
|
|
let bin = '';
|
|
|
|
let high = parseInt(num.slice(0, -10)) || 0;
|
|
|
|
let low = parseInt(num.slice(-10));
|
|
|
|
while (low > 0 || high > 0) {
|
|
|
|
bin = String(low & 1) + bin;
|
|
|
|
low = Math.floor(low / 2);
|
|
|
|
if (high > 0) {
|
|
|
|
low += 5000000000 * (high % 2);
|
|
|
|
high = Math.floor(high / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bin;
|
|
|
|
}
|
|
|
|
exports.idToBinary = idToBinary;
|
|
|
|
/**
|
|
|
|
* Transforms a snowflake from a bit string to a decimal string.
|
|
|
|
* @param {string} num Bit string to be transformed
|
|
|
|
* @returns {string}
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
function binaryToID(num) {
|
|
|
|
let dec = '';
|
|
|
|
while (num.length > 50) {
|
|
|
|
const high = parseInt(num.slice(0, -32), 2);
|
|
|
|
const low = parseInt((high % 10).toString(2) + num.slice(-32), 2);
|
|
|
|
dec = (low % 10).toString() + dec;
|
|
|
|
num = Math.floor(high / 10).toString(2) +
|
|
|
|
Math.floor(low / 10)
|
|
|
|
.toString(2)
|
|
|
|
.padStart(32, '0');
|
|
|
|
}
|
|
|
|
let num2 = parseInt(num, 2);
|
|
|
|
while (num2 > 0) {
|
|
|
|
dec = (num2 % 10).toString() + dec;
|
|
|
|
num2 = Math.floor(num2 / 10);
|
|
|
|
}
|
|
|
|
return dec;
|
|
|
|
}
|
|
|
|
exports.binaryToID = binaryToID;
|
|
|
|
function resolveUserID(user) {
|
|
|
|
if (typeof user === "string")
|
|
|
|
return user; // ID
|
|
|
|
if (user instanceof User_1.default)
|
|
|
|
return user.id; // User
|
|
|
|
if (user instanceof Message_1.default)
|
|
|
|
return user.author.id; // Message Author
|
|
|
|
if (user instanceof Guild_1.default)
|
|
|
|
return user.ownerID; // Guild
|
|
|
|
if (user instanceof GuildMember_1.default)
|
|
|
|
return user.id; // GuildMember
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
exports.resolveUserID = resolveUserID;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "events":
|
|
|
|
/*!*************************!*\
|
|
|
|
!*** external "events" ***!
|
|
|
|
\*************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
module.exports = require("events");
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
/******/ });
|
2020-07-04 22:42:26 +02:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9MaWdodGNvcmRBcGkvd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vTGlnaHRjb3JkQXBpLy4vbm9kZV9tb2R1bGVzL0BkaXNjb3JkanMvY29sbGVjdGlvbi9kaXN0L2luZGV4LmpzIiwid2VicGFjazovL0xpZ2h0Y29yZEFwaS8uL3NyYy9jbGllbnQvY2xpZW50LnRzIiwid2VicGFjazovL0xpZ2h0Y29yZEFwaS8uL3NyYy9pbmRleC50cyIsIndlYnBhY2s6Ly9MaWdodGNvcmRBcGkvLi9zcmMvc3RydWN0dXJlcy9CYXNlQ2hhbm5lbC50cyIsIndlYnBhY2s6Ly9MaWdodGNvcmRBcGkvLi9zcmMvc3RydWN0dXJlcy9CYXNlU3RydWN0dXJlLnRzIiwid2VicGFjazovL0xpZ2h0Y29yZEFwaS8uL3NyYy9zdHJ1Y3R1cmVzL0NsaWVudFVzZXIudHMiLCJ3ZWJwYWNrOi8vTGlnaHRjb3JkQXBpLy4vc3JjL3N0cnVjdHVyZXMvR3VpbGQudHMiLCJ3ZWJwYWNrOi8vTGl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