mirror of
https://github.com/projectdysnomia/dysnomia.git
synced 2026-12-02 13:48:31 +02:00
This should allow for not using the `Client.channelGuildMap`, `Client.threadGuildMap`, and `Client.guildShardMap` when `caching.disableMaps` is on. Some caveats: - Obviously `getChannel` will do linear searching now, but this can be skipped with guild hinting. `getChannel` now has a `guildIDHint` parameter for getting that specific guild rather than searching all of them. Which has some caveats: - `editChannelPosition`'s option param has `guildIDHint`, it's channel's corresponding function will use it. - Same for `joinVoiceChannel` and `leaveVoiceChannel`, but `leaveVoiceChannel` has it's hinting in a new parameter. - `ThreadMember`'s construction to find the guild *will* do linear searching, sad. - Many of the shard events that use `getChannel` either now hint at the guild or just gets the guild directly. --------- Co-authored-by: TTtie <me@tttie.cz>
37 lines
796 B
JavaScript
37 lines
796 B
JavaScript
"use strict";
|
|
|
|
const Base = require("./Base");
|
|
|
|
/**
|
|
* Represents a guild
|
|
* @extends Base
|
|
*/
|
|
class UnavailableGuild extends Base {
|
|
/**
|
|
* The ID of the guild
|
|
* @member {String} UnavailableGuild#id
|
|
*/
|
|
constructor(data, client) {
|
|
super(data.id);
|
|
/**
|
|
* The shard that owns this guild
|
|
* @type {Shard}
|
|
*/
|
|
this.shard = client.shards.get(client.guildShardMap[this.id] ?? client.shards.resolveFromGuild(this.id));
|
|
/**
|
|
* Whether the guild is unavailable or not
|
|
* @type {Boolean}
|
|
*/
|
|
this.unavailable = !!data.unavailable;
|
|
}
|
|
|
|
toJSON(props = []) {
|
|
return super.toJSON([
|
|
"unavailable",
|
|
...props
|
|
]);
|
|
}
|
|
}
|
|
|
|
module.exports = UnavailableGuild;
|