* Remove GroupDMChannels

they sparked no joy

* Start partials for message deletion

* MessageUpdate partials

* Add partials as an opt-in client option

* Add fetch() to Message

* Message.author should never be undefined

* Fix channels being the wrong type

* Allow fetching channels

* Refactor and add reaction add partials

* Reaction remove partials

* Check for emoji first

* fix message fetching

janky

* User partials in audit logs

* refactor overwrite code

* guild member partials

* partials as a whitelist

* document GuildMember#fetch

* fix: check whether a structure is a partial, not whether cache is true

* typings: Updated for latest commit (#3075)

* partials: fix messageUpdate behaviour (now "old" message can be partial)

* partials: add warnings and docs

* partials: add partials to index.yml

* partials: tighten "partial" definitions

* partials: fix embed-only messages counting as partials
This commit is contained in:
Amish Shah
2019-02-13 17:39:39 +00:00
committed by GitHub
parent 8910fed729
commit 5c3f5d7048
35 changed files with 295 additions and 383 deletions

View File

@@ -5,7 +5,7 @@ const Channel = require('../structures/Channel');
const { Events } = require('../util/Constants');
const kLru = Symbol('LRU');
const lruable = ['group', 'dm'];
const lruable = ['dm'];
/**
* Stores channels.
@@ -54,6 +54,7 @@ class ChannelStore extends DataStore {
add(data, guild, cache = true) {
const existing = this.get(data.id);
if (existing && existing.partial && cache) existing._patch(data);
if (existing) return existing;
const channel = Channel.create(this.client, data, guild);
@@ -85,11 +86,12 @@ class ChannelStore extends DataStore {
* .then(channel => console.log(channel.name))
* .catch(console.error);
*/
fetch(id, cache = true) {
async fetch(id, cache = true) {
const existing = this.get(id);
if (existing) return Promise.resolve(existing);
if (existing && !existing.partial) return existing;
return this.client.api.channels(id).get().then(data => this.add(data, null, cache));
const data = await this.client.api.channels(id).get();
return this.add(data, null, cache);
}
/**