mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 05:56:09 +00:00
feat(gateway): message update pog
This commit is contained in:
parent
01f5a7bb22
commit
be10b9bfe6
@ -1,5 +1,4 @@
|
|||||||
import type {
|
import type {
|
||||||
APIMessage,
|
|
||||||
GatewayMessageCreateDispatchData,
|
GatewayMessageCreateDispatchData,
|
||||||
GatewayMessageDeleteBulkDispatchData,
|
GatewayMessageDeleteBulkDispatchData,
|
||||||
GatewayMessageDeleteDispatchData,
|
GatewayMessageDeleteDispatchData,
|
||||||
@ -10,7 +9,7 @@ import type {
|
|||||||
GatewayMessageReactionRemoveEmojiDispatchData,
|
GatewayMessageReactionRemoveEmojiDispatchData,
|
||||||
GatewayMessageUpdateDispatchData,
|
GatewayMessageUpdateDispatchData,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
import { type MakeRequired, type PartialClass, toCamelCase, type ObjectToLower } from '../../common';
|
import { type OmitInsert, toCamelCase, type ObjectToLower } from '../../common';
|
||||||
import type { UsingClient } from '../../commands';
|
import type { UsingClient } from '../../commands';
|
||||||
import { type MessageStructure, Transformers } from '../../client/transformers';
|
import { type MessageStructure, Transformers } from '../../client/transformers';
|
||||||
|
|
||||||
@ -54,27 +53,8 @@ export const MESSAGE_REACTION_REMOVE_EMOJI = (
|
|||||||
export const MESSAGE_UPDATE = async (
|
export const MESSAGE_UPDATE = async (
|
||||||
self: UsingClient,
|
self: UsingClient,
|
||||||
data: GatewayMessageUpdateDispatchData,
|
data: GatewayMessageUpdateDispatchData,
|
||||||
): Promise<
|
): Promise<[message: OmitInsert<MessageStructure, 'tts', { tts: false }>, old: undefined | MessageStructure]> => {
|
||||||
[
|
return [Transformers.Message(self, data) as any, await self.cache.messages?.get(data.id)];
|
||||||
message: MakeRequired<
|
|
||||||
PartialClass<MessageStructure>, //sus
|
|
||||||
| 'id'
|
|
||||||
| 'channelId'
|
|
||||||
| 'createdAt'
|
|
||||||
| 'createdTimestamp'
|
|
||||||
| 'rest'
|
|
||||||
| 'cache'
|
|
||||||
| 'api'
|
|
||||||
| 'client'
|
|
||||||
| 'mentions'
|
|
||||||
| 'url'
|
|
||||||
| 'user'
|
|
||||||
| 'author'
|
|
||||||
>,
|
|
||||||
old: undefined | MessageStructure,
|
|
||||||
]
|
|
||||||
> => {
|
|
||||||
return [Transformers.Message(self, data as APIMessage), await self.cache.messages?.get(data.id)];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MESSAGE_POLL_VOTE_REMOVE = (_: UsingClient, data: GatewayMessagePollVoteDispatchData) => {
|
export const MESSAGE_POLL_VOTE_REMOVE = (_: UsingClient, data: GatewayMessagePollVoteDispatchData) => {
|
||||||
|
@ -1151,17 +1151,7 @@ export type GatewayMessageUpdateDispatch = DataPayload<
|
|||||||
/**
|
/**
|
||||||
* https://discord.com/developers/docs/topics/gateway-events#message-update
|
* https://discord.com/developers/docs/topics/gateway-events#message-update
|
||||||
*/
|
*/
|
||||||
export type GatewayMessageUpdateDispatchData = GatewayMessageEventExtraFields &
|
export type GatewayMessageUpdateDispatchData = Omit<GatewayMessageCreateDispatchData, 'tts'> & { tts: false };
|
||||||
Omit<Partial<APIMessage>, 'mentions'> & {
|
|
||||||
/**
|
|
||||||
* ID of the message
|
|
||||||
*/
|
|
||||||
id: Snowflake;
|
|
||||||
/**
|
|
||||||
* ID of the channel the message was sent in
|
|
||||||
*/
|
|
||||||
channel_id: Snowflake;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface GatewayMessageEventExtraFields {
|
export interface GatewayMessageEventExtraFields {
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user