Skip to content

Commit

Permalink
feat(event): support message_recalled, message_reaction_created, and …
Browse files Browse the repository at this point in the history
…message_reaction_deleted [ci skip]
  • Loading branch information
crispgm committed Jan 3, 2024
1 parent ddf5b30 commit 2a5a100
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## v1.13.3

- feat(event): support message_recalled, message_reaction_created, and message_reaction_deleted

## v1.13.2

- fix(event): chat_id and message_id

## v1.13.1

- feat(event): support card callback (#68)
Expand Down
20 changes: 20 additions & 0 deletions event_message_reaction_created.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package lark

// EventV2MessageReactionCreated .
type EventV2MessageReactionCreated struct {
MessageID string `json:"message_id,omitempty"`
OperatorType string `json:"operator_type,omitempty"`
UserID EventV2UserID `json:"user_id,omitempty"`
AppID string `json:"app_id,omitempty"`
ActionTime string `json:"action_time,omitempty"`
ReactionType struct {
EmojiType string `json:"emoji_type,omitempty"`
} `json:"reaction_type,omitempty"`
}

// GetMessageReactionCreated .
func (e EventV2) GetMessageReactionCreated() (*EventV2MessageReactionCreated, error) {
var body EventV2MessageReactionCreated
err := e.GetEvent(EventTypeMessageReactionCreated, &body)
return &body, err
}
20 changes: 20 additions & 0 deletions event_message_reaction_deleted.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package lark

// EventV2MessageReactionDeleted .
type EventV2MessageReactionDeleted struct {
MessageID string `json:"message_id,omitempty"`
OperatorType string `json:"operator_type,omitempty"`
UserID EventV2UserID `json:"user_id,omitempty"`
AppID string `json:"app_id,omitempty"`
ActionTime string `json:"action_time,omitempty"`
ReactionType struct {
EmojiType string `json:"emoji_type,omitempty"`
} `json:"reaction_type,omitempty"`
}

// GetMessageReactionDeleted .
func (e EventV2) GetMessageReactionDeleted() (*EventV2MessageReactionDeleted, error) {
var body EventV2MessageReactionDeleted
err := e.GetEvent(EventTypeMessageReactionDeleted, &body)
return &body, err
}
16 changes: 16 additions & 0 deletions event_message_recalled.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package lark

// EventV2MessageRecalled .
type EventV2MessageRecalled struct {
MessageID string `json:"message_id,omitempty"`
ChatID string `json:"chat_id,omitempty"`
RecallTime string `json:"recall_time,omitempty"`
RecallType string `json:"recall_type,omitempty"`
}

// GetMessageRecalled .
func (e EventV2) GetMessageRecalled() (*EventV2MessageRecalled, error) {
var body EventV2MessageRecalled
err := e.GetEvent(EventTypeMessageRecalled, &body)
return &body, err
}
17 changes: 10 additions & 7 deletions event_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ import (

// EventType definitions
const (
EventTypeMessageReceived = "im.message.receive_v1"
EventTypeMessageRead = "im.message.message_read_v1"
EventTypeChatDisbanded = "im.chat.disbanded_v1"
EventTypeBotAdded = "im.chat.member.bot.added_v1"
EventTypeBotDeleted = "im.chat.member.bot.deleted_v1"
EventTypeUserAdded = "im.chat.member.user.added_v1"
EventTypeUserDeleted = "im.chat.member.user.deleted_v1"
EventTypeMessageReceived = "im.message.receive_v1"
EventTypeMessageRead = "im.message.message_read_v1"
EventTypeMessageRecalled = "im.message.recalled_v1"
EventTypeMessageReactionCreated = "im.message.reaction.created_v1"
EventTypeMessageReactionDeleted = "im.message.reaction.deleted_v1"
EventTypeChatDisbanded = "im.chat.disbanded_v1"
EventTypeUserAdded = "im.chat.member.user.added_v1"
EventTypeUserDeleted = "im.chat.member.user.deleted_v1"
EventTypeBotAdded = "im.chat.member.bot.added_v1"
EventTypeBotDeleted = "im.chat.member.bot.deleted_v1"
// not supported yet
EventTypeChatUpdated = "im.chat.updated_v1"
EventTypeUserWithdrawn = "im.chat.member.user.withdrawn_v1"
Expand Down

0 comments on commit 2a5a100

Please sign in to comment.