mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
37 lines
932 B
JavaScript
37 lines
932 B
JavaScript
"use strict";
|
|
|
|
var User = require("./user.js").User;
|
|
var List = require("./list.js").List;
|
|
exports.Server = function (data) {
|
|
this.region = data.region;
|
|
this.ownerID = data.owner_id;
|
|
this.name = data.name;
|
|
this.id = data.id;
|
|
this.members = new Map();
|
|
this.channels = new Map();
|
|
this.icon = data.icon;
|
|
this.afkTimeout = afkTimeout;
|
|
this.afkChannelId = afkChannelId;
|
|
|
|
for (var x in members) {
|
|
var member = members[x].user;
|
|
this.members.add(new User(member));
|
|
}
|
|
};
|
|
|
|
exports.Server.prototype.getIconURL = function () {
|
|
if (!this.icon) return false;
|
|
return "https://discordapp.com/api/guilds/" + this.id + "/icons/" + this.icon + ".jpg";
|
|
};
|
|
|
|
exports.Server.prototype.getAFKChannel = function () {
|
|
|
|
if (!this.afkChannelId) return false;
|
|
|
|
return this.channels.filter("id", this.afkChannelId, true);
|
|
};
|
|
|
|
exports.Server.prototype.getDefaultChannel = function () {
|
|
|
|
return this.channels.filter("name", "general", true);
|
|
}; |