Conversation
| I realize that the openapi.json is not correct at all |
| never has been |
| channel_id, | ||
| message_id, | ||
| version: 3763, | ||
| version: 3763, // what is this number? |
There was a problem hiding this comment.
it's the user read state version apparently
https://docs.discord.food/gateway/gateway-events#message-ack
| ...new_message.toJSON(), | ||
| nonce: undefined, | ||
| }, | ||
| } satisfies MessageUpdateEvent); |
There was a problem hiding this comment.
Why is this no longer promise.all?
There was a problem hiding this comment.
this just avoids a case where saving the message fails for some reason, otherwise it'd still get sent to clients but then dissapear upon reload
| delete message.member; | ||
| | ||
| await message.save(); | ||
| const publicMsg = message.toJSON(); |
There was a problem hiding this comment.
Is there a reason this isn't being done inline?
There was a problem hiding this comment.
hm, i guess i could have?
There was a problem hiding this comment.
It's fine either way for me, but you've in the past have said that single use stuff like this might better be inlined
| mention_everyone: false, | ||
| }); | ||
| | ||
| await message.save(); |
There was a problem hiding this comment.
can this not be added to the Promise.all?
There was a problem hiding this comment.
prevents db invalid messages from being emitted
| | ||
| message.pinned_at = null; | ||
| | ||
| await message.save(); |
There was a problem hiding this comment.
same here, why not in the Promise.all?
| | ||
| channel.last_message_id = message.id; | ||
| | ||
| await message.save(); |
There was a problem hiding this comment.
is there a reason for not being in the Promise.all?
| mention_everyone: false, | ||
| }); | ||
| | ||
| await message.save(); |
There was a problem hiding this comment.
why not in the Promise.all?
| | ||
| message.pinned_at = null; | ||
| | ||
| await message.save(); |
There was a problem hiding this comment.
Why not in the Promise.all?
| guild_id: thread.guild_id!, | ||
| id: thread.id, | ||
| member_count: thread.member_count, | ||
| member_count: thread.member_count ?? 0, //TODO: is this the right fix? |
| parse: body.message.allowed_mentions.parse as ("users" | "roles" | "everyone")[], | ||
| } | ||
| : undefined, | ||
| } as Parameters<typeof handleMessage>[0]; |
There was a problem hiding this comment.
could satisfies be used here?
There was a problem hiding this comment.
hm, im not sure if it can be, i think the entire point was to have type suggestions there but satisfies might conflict with futher handling (might make more sense to add right below, though, since it is using the first param of handleMessage as type)
There was a problem hiding this comment.
Oh wait, this is an array of strings and you're narrowing it, right?
| data: { | ||
| id: interactionId, | ||
| nonce: interaction?.nonce, | ||
| nonce: interaction.nonce ?? "", // TODO: did i do this right? |
There was a problem hiding this comment.
it likely does not matter either way
There was a problem hiding this comment.
alright, will remove the comment then
| data: { | ||
| channel_id, | ||
| guild_id: webhook.guild_id, | ||
| guild_id: webhook.guild_id!, // TODO: is this even the right fix? |
There was a problem hiding this comment.
as in, is this even correct? cause im asserting that guild_id isnt null (why can that even be null?)
| parse: body.allowed_mentions.parse as ("users" | "roles" | "everyone")[], | ||
| } | ||
| : undefined, | ||
| } as Parameters<typeof handleMessage>[0]; |
There was a problem hiding this comment.
could satifies be used instead?
src/gateway/events/Close.ts Outdated
| | ||
| import { WebSocket } from "@spacebar/gateway"; | ||
| import { emitEvent, PresenceUpdateEvent, PrivateSessionProjection, Session, SessionsReplace, User, VoiceState, VoiceStateUpdateEvent } from "@spacebar/util"; | ||
| import member_id from "../../api/routes/guilds/#guild_id/members/#member_id"; |
There was a problem hiding this comment.
what's up with this weird import?
There was a problem hiding this comment.
good question, guessing it was automatically inserted
| } | ||
| | ||
| // TODO: split up by channel type? | ||
| export interface PublicChannel { |
There was a problem hiding this comment.
should this not be in schemas?
| }; | ||
| } | ||
| | ||
| export interface PublicMessage { |
There was a problem hiding this comment.
should this not be in schemas?
There was a problem hiding this comment.
it... is, lol - check the path again
| | ||
| export enum MessageActivityType { | ||
| JOIN = 1, | ||
| // @deprecated |
There was a problem hiding this comment.
While it is deprecated on the API should it be marked as a depricated part of the enum, that'll mean we'll get warns when we try to implement it
There was a problem hiding this comment.
i was mirroring the deprecation from discord.food here
| mentions: this.mentions?.map((user) => { | ||
| if (user && !user.toPublicUser) console.trace("toPublic user missing!!!"); | ||
| return user?.toPublicUser?.() ?? user ?? undefined; | ||
| return (user?.toPublicUser?.() ?? user ?? undefined) as unknown as PartialUser; |
There was a problem hiding this comment.
Might filter it out afterwards instead of doing this
There was a problem hiding this comment.
as PartialUser|undefined).filter(=>!==undefined)
MathMan05 left a comment
There was a problem hiding this comment.
for those of which I clicked the wrong button
d483ca4 to 7a92946 Compare
pushing the messages one soon