feat(messaging): add masquerade field

This commit is contained in:
Paul
2021-11-04 20:10:28 +00:00
parent 6fd39b40d7
commit 0c5f0b1259
5 changed files with 18 additions and 9 deletions
+2 -2
View File
@@ -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 <insrt.uk>",
@@ -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",
+3 -1
View File
@@ -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;
+1 -1
View File
@@ -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',
+8 -1
View File
@@ -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<Embed[]>;
mention_ids: Nullable<string[]>;
reply_ids: Nullable<string[]>;
masquerade: Nullable<Masquerade>;
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,
+4 -4
View File
@@ -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"