mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Experimental active ratelimits (adapted from Eris)
This commit is contained in:
@@ -15,6 +15,10 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var _UtilBucket = require("../Util/Bucket");
|
||||
|
||||
var _UtilBucket2 = _interopRequireDefault(_UtilBucket);
|
||||
|
||||
var _UtilEquality = require("../Util/Equality");
|
||||
|
||||
var _UtilEquality2 = _interopRequireDefault(_UtilEquality);
|
||||
@@ -55,13 +59,21 @@ var Server = (function (_Equality) {
|
||||
|
||||
_Equality.call(this);
|
||||
|
||||
var self = this;
|
||||
this.client = client;
|
||||
this.id = data.id;
|
||||
|
||||
if (data.owner_id) {
|
||||
// new server data
|
||||
client.internal.buckets["bot:msg:guild:" + this.id] = new _UtilBucket2["default"](5, 5000);
|
||||
client.internal.buckets["dmsg:" + this.id] = new _UtilBucket2["default"](5, 1000);
|
||||
client.internal.buckets["bdmsg:" + this.id] = new _UtilBucket2["default"](1, 1000);
|
||||
client.internal.buckets["guild_member:" + this.id] = new _UtilBucket2["default"](10, 10000);
|
||||
client.internal.buckets["guild_member_nick:" + this.id] = new _UtilBucket2["default"](1, 1000);
|
||||
}
|
||||
|
||||
this.region = data.region;
|
||||
this.ownerID = data.owner_id || data.ownerID;
|
||||
this.name = data.name;
|
||||
this.id = data.id;
|
||||
this.members = new _UtilCache2["default"]();
|
||||
this.channels = new _UtilCache2["default"]();
|
||||
this.roles = new _UtilCache2["default"]();
|
||||
@@ -72,8 +84,6 @@ var Server = (function (_Equality) {
|
||||
this.memberCount = data.member_count || data.memberCount;
|
||||
this.large = data.large || this.memberCount > 250;
|
||||
|
||||
var self = this;
|
||||
|
||||
if (data.roles instanceof _UtilCache2["default"]) {
|
||||
data.roles.forEach(function (role) {
|
||||
return _this.roles.add(role);
|
||||
|
||||
Reference in New Issue
Block a user