summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-17 02:21:56 +0100
committerRory& <root@rory.gay>2025-12-17 02:21:56 +0100
commit11a3a48731ddc56470a518262683c5bf4e19070d (patch)
treeb7d01f25dad82a48b71f19ae89daad33ddf8c1a5
parentunixsock: use length-prefixed message framing + buffer (diff)
downloadserver-ts-11a3a48731ddc56470a518262683c5bf4e19070d.tar.xz
Rename PRIVATE_ROUTE -> EPHEMERAL, fix typo
-rw-r--r--src/api/util/handlers/Message.ts5
-rw-r--r--src/util/entities/Message.ts2
-rw-r--r--src/util/util/MessageFlags.ts5
3 files changed, 5 insertions, 7 deletions
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts

index fb011112..ef31cdba 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts
@@ -47,6 +47,7 @@ import { ReadState, Member, Session, + MessageFlags, } from "@spacebar/util"; import { HTTPError } from "lambert-server"; import { In, Or, Equal, IsNull } from "typeorm"; @@ -538,12 +539,12 @@ export async function postHandleMessage(message: Message) { export async function sendMessage(opts: MessageOptions) { const message = await handleMessage({ ...opts, timestamp: new Date() }); - const ephermal = (message.flags & (1 << 6)) !== 0; + const ephemeral = (message.flags & (MessageFlags.FLAGS.EPHEMERAL)) !== 0; await Promise.all([ Message.insert(message), emitEvent({ event: "MESSAGE_CREATE", - ...(ephermal ? { user_id: message.interaction_metadata?.user_id } : { channel_id: message.channel_id }), + ...(ephemeral ? { user_id: message.interaction_metadata?.user_id } : { channel_id: message.channel_id }), data: message.toJSON(), } as MessageCreateEvent), ]); diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index b67ad2dc..79a66b85 100644 --- a/src/util/entities/Message.ts +++ b/src/util/entities/Message.ts
@@ -314,7 +314,7 @@ export class Message extends BaseClass { const arr = options.where instanceof Array ? options.where : [options.where]; for (const thing of arr) { if (!("flags" in thing)) { - thing.flags = Not(Raw((alias) => `${alias} & ${MessageFlags.FLAGS.PRIVATE_ROUTE} = ${MessageFlags.FLAGS.PRIVATE_ROUTE}`)); + thing.flags = Not(Raw((alias) => `${alias} & ${MessageFlags.FLAGS.EPHEMERAL} = ${MessageFlags.FLAGS.EPHEMERAL}`)); } } } diff --git a/src/util/util/MessageFlags.ts b/src/util/util/MessageFlags.ts
index b2ea41d0..f2588011 100644 --- a/src/util/util/MessageFlags.ts +++ b/src/util/util/MessageFlags.ts
@@ -12,10 +12,7 @@ export class MessageFlags extends BitField { // SOURCE_MESSAGE_DELETED: BigInt(1) << BigInt(3), // spacebar will delete them from destination too, making this redundant URGENT: BigInt(1) << BigInt(4), // HAS_THREAD: BigInt(1) << BigInt(5) // does not apply to spacebar due to infrastructural differences - PRIVATE_ROUTE: BigInt(1) << BigInt(6), // it that has been routed to only some of the users that can see the channel + EPHEMERAL: BigInt(1) << BigInt(6), // it that has been routed to only some of the users that can see the channel INTERACTION_WAIT: BigInt(1) << BigInt(7), // discord.com calls this LOADING - // FAILED_TO_MENTION_SOME_ROLES_IN_THREAD: BigInt(1) << BigInt(8) - SCRIPT_WAIT: BigInt(1) << BigInt(24), // waiting for the self command to complete - IMPORT_WAIT: BigInt(1) << BigInt(25), // latest message of a bulk import, waiting for the rest of the channel to be backfilled }; }