diff --git a/package.json b/package.json index de645db4..c1cc7b12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "revolt.js", - "version": "5.1.0-alpha.6", + "version": "5.1.0-alpha.7", "main": "dist/index.js", "repository": "https://github.com/revoltchat/revolt.js", "author": "Paul Makles ", @@ -29,7 +29,7 @@ "in-publish": "^2.0.1", "jsdoc-babel": "^0.5.0", "node-fetch": "^2.6.1", - "revolt-api": "0.5.3-alpha.2", + "revolt-api": "^0.5.3-alpha.8-patch.0", "rimraf": "^3.0.2", "tsc-watch": "^4.1.0", "typedoc": "^0.21.4", diff --git a/src/api/permissions.ts b/src/api/permissions.ts index 0f1edd09..624260b5 100644 --- a/src/api/permissions.ts +++ b/src/api/permissions.ts @@ -14,6 +14,7 @@ export const ChannelPermission = { InviteOthers: 1 << 5, EmbedLinks: 1 << 6, UploadFiles: 1 << 7, + Masquerade: 1 << 8, } export const ServerPermission = { @@ -38,4 +39,5 @@ export const DEFAULT_PERMISSION_DM = + ChannelPermission.VoiceCall + ChannelPermission.InviteOthers + ChannelPermission.EmbedLinks - + ChannelPermission.UploadFiles; + + ChannelPermission.UploadFiles + + ChannelPermission.Masquerade; diff --git a/src/config.ts b/src/config.ts index d1536dd9..67c36298 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,4 @@ -export const LIBRARY_VERSION = '5.1.0-alpha.6'; +export const LIBRARY_VERSION = '5.1.0-alpha.7'; export const defaultConfig = { apiURL: 'https://api.revolt.chat', diff --git a/src/maps/Messages.ts b/src/maps/Messages.ts index 8574a9c9..236f4274 100644 --- a/src/maps/Messages.ts +++ b/src/maps/Messages.ts @@ -1,4 +1,4 @@ -import type { Message as MessageI, SystemMessage } from 'revolt-api/types/Channels'; +import type { Masquerade, Message as MessageI, SystemMessage } from 'revolt-api/types/Channels'; import type { Attachment } from 'revolt-api/types/Autumn'; import type { Embed } from 'revolt-api/types/January'; import type { Route } from '../api/routes'; @@ -25,6 +25,7 @@ export class Message { embeds: Nullable; mention_ids: Nullable; reply_ids: Nullable; + masquerade: Nullable; get channel() { return this.client.channels.get(this.channel_id); @@ -55,6 +56,11 @@ export class Message { return decodeTime(this._id); } + @computed generateMasqAvatarURL() { + const avatar = this.masquerade?.avatar; + return avatar ? this.client.proxyFile(avatar) : undefined; + } + @computed get asSystemMessage() { const content = this.content; @@ -89,6 +95,7 @@ export class Message { this.embeds = toNullable(data.embeds); this.mention_ids = toNullable(data.mentions); this.reply_ids = toNullable(data.replies); + this.masquerade = toNullable(data.masquerade); makeAutoObservable(this, { _id: false, diff --git a/yarn.lock b/yarn.lock index 38ef36b9..8c3ce21b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2005,10 +2005,10 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -revolt-api@0.5.3-alpha.2: - version "0.5.3-alpha.2" - resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-alpha.2.tgz#b2ffcacbc0302c4876c2ca62e7c6ac088db4c053" - integrity sha512-Fa1lARPJoey+8mlEml4fEJqr0H5zUmorLd8fEZ/boOB/JCSJU4/S6O3FKFLGp1FYadmpY4LGeETZlvuFbHADwg== +revolt-api@^0.5.3-alpha.8-patch.0: + version "0.5.3-alpha.8-patch.0" + resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.3-alpha.8-patch.0.tgz#3c9f981f8100a89aec1299bc110453cf01c51f89" + integrity sha512-ghupcB1nJS7fCiD41L4u+QudFoBWGE381uW4s8cuHsQS3bFXgzAH1lgtjYNoFgrVUekqQAcHWote8Kn2sOABAQ== rimraf@^3.0.2: version "3.0.2"