diff --git a/package.json b/package.json index e23e3fe9..136af019 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "revolt.js", - "version": "4.0.0-alpha.15", + "version": "4.0.0-alpha.16", "main": "dist/index.js", "repository": "https://gitlab.insrt.uk/revolt/revolt.js", "author": "Paul Makles ", diff --git a/src/index.ts b/src/index.ts index 8cb705b1..0a949721 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ export * from './Client'; export { Channel, User, Message } from './api/objects'; -export const LIBRARY_VERSION = '4.0.0-alpha.15'; +export const LIBRARY_VERSION = '4.0.0-alpha.16'; export const defaultConfig = { apiURL: 'https://api.revolt.chat', diff --git a/src/maps/Channels.ts b/src/maps/Channels.ts index 208f0742..fb5073ad 100644 --- a/src/maps/Channels.ts +++ b/src/maps/Channels.ts @@ -26,6 +26,15 @@ export default class Channels extends Collection { async fetchMutable(id: string) { if (this.map[id]) return this.get(id) as Channel; let res = await this.client.req<'GET', '/channels/:id'>('GET', `/channels/${id}` as any); + + // Fetch user information if this is the first time we are seeing this object. + // We shouldn't need to fetch for anything apart from groups. + if (res.channel_type === 'Group') { + for (let member of res.recipients) { + await this.client.users.fetch(member); + } + } + this.set(res); return this.get(id) as Channel; }