Skip to content

Commit

Permalink
feat: add #545 and #546
Browse files Browse the repository at this point in the history
Adds the RECENT_MENTION_DELETE and USER_NOTE_UPDATE gateway events.

The events can be accessed at:
message.recent_mention_delete
&
user.note_update
  • Loading branch information
kozabrada123 committed Aug 9, 2024
1 parent 1dfbd21 commit 6c6a87c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gateway/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ pub struct Message {
pub reaction_remove: Publisher<types::MessageReactionRemove>,
pub reaction_remove_all: Publisher<types::MessageReactionRemoveAll>,
pub reaction_remove_emoji: Publisher<types::MessageReactionRemoveEmoji>,
pub recent_mention_delete: Publisher<types::RecentMentionDelete>,
pub ack: Publisher<types::MessageACK>,
}

#[derive(Default, Debug)]
pub struct User {
pub update: Publisher<types::UserUpdate>,
pub note_update: Publisher<types::UserNoteUpdate>,
pub guild_settings_update: Publisher<types::UserGuildSettingsUpdate>,
pub presence_update: Publisher<types::PresenceUpdate>,
pub typing_start: Publisher<types::TypingStartEvent>,
Expand Down
2 changes: 2 additions & 0 deletions src/gateway/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ impl Gateway {
"MESSAGE_REACTION_REMOVE" => message.reaction_remove, // TODO
"MESSAGE_REACTION_REMOVE_ALL" => message.reaction_remove_all, // TODO
"MESSAGE_REACTION_REMOVE_EMOJI" => message.reaction_remove_emoji, // TODO
"RECENT_MENTION_DELETE" => message.recent_mention_delete,
"MESSAGE_ACK" => message.ack,
"PRESENCE_UPDATE" => user.presence_update, // TODO
"RELATIONSHIP_ADD" => relationship.add,
Expand All @@ -413,6 +414,7 @@ impl Gateway {
"STAGE_INSTANCE_DELETE" => stage_instance.delete,
"TYPING_START" => user.typing_start,
"USER_UPDATE" => user.update, // TODO
"USER_NOTE_UPDATE" => user.note_update,
"USER_GUILD_SETTINGS_UPDATE" => user.guild_settings_update,
"VOICE_STATE_UPDATE" => voice.state_update, // TODO
"VOICE_SERVER_UPDATE" => voice.server_update,
Expand Down
9 changes: 9 additions & 0 deletions src/types/events/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ pub struct MessageReactionRemoveEmoji {
pub emoji: Emoji,
}

#[derive(Debug, Serialize, Deserialize, Default, Clone, Copy, WebSocketEvent)]
/// Sent when a message that mentioned the current user in the last week is acknowledged and deleted.
///
/// # Reference
/// See <https://docs.discord.sex/topics/gateway-events#recent-mention-delete>
pub struct RecentMentionDelete {
pub message_id: Snowflake,
}

#[derive(Debug, Deserialize, Serialize, Default, Clone, WebSocketEvent)]
/// Officially Undocumented
///
Expand Down
12 changes: 12 additions & 0 deletions src/types/events/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ pub struct UserUpdate {
pub user: PublicUser,
}

#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
/// See <https://docs.discord.sex/topics/gateway-events#user-note-update-structure>;
///
/// Sent when a note the current user has on another user is modified;
///
/// If the field "note" is an empty string, the note was removed.
pub struct UserNoteUpdate {
/// Id of the user the note is for
pub id: Snowflake,
pub note: String,
}

#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq, Eq, WebSocketEvent)]
/// Undocumented;
///
Expand Down

0 comments on commit 6c6a87c

Please sign in to comment.