diff --git a/event_payload.go b/event_payload.go index 5924f4d..20f0e6f 100644 --- a/event_payload.go +++ b/event_payload.go @@ -40,6 +40,17 @@ type ChannelCreatedPayload struct { Channel ChannelPayload `json:"channel"` } +// ChannelTopicChangedPayload CHANNEL_TOPIC_CHANGEDイベントペイロード +type ChannelTopicChangedPayload struct { + BasePayload + // Channel 変更されたチャンネル + Channel ChannelPayload `json:"channel"` + // Topic 変更後のトピック + Topic string `json:"topic"` + // Updater トピック更新者 + Updater UserPayload `json:"updater"` +} + // UserCreatedPayload USER_CREATEDイベントペイロード type UserCreatedPayload struct { BasePayload diff --git a/events.go b/events.go index da06cb8..365806e 100644 --- a/events.go +++ b/events.go @@ -13,6 +13,8 @@ const ( DirectMessageCreated = "DIRECT_MESSAGE_CREATED" // ChannelCreated CHANNEL_CREATEDイベント ChannelCreated = "CHANNEL_CREATED" + // ChannelTopicChanged CHANNEL_TOPIC_CHANGEDイベント + ChannelTopicChanged = "CHANNEL_TOPIC_CHANGED" // UserCreated USER_CREATEDイベント UserCreated = "USER_CREATED" ) diff --git a/helper.go b/helper.go index 43412e2..9334afa 100644 --- a/helper.go +++ b/helper.go @@ -41,6 +41,11 @@ func (hs EventHandlers) SetChannelCreatedHandler(h func(payload *ChannelCreatedP hs.SetHandler(ChannelCreated, func(event string, payload interface{}) { h(payload.(*ChannelCreatedPayload)) }) } +// SetChannelTopicChangedHandler イベントハンドラをセットします +func (hs EventHandlers) SetChannelTopicChangedHandler(h func(payload *ChannelTopicChangedPayload)) { + hs.SetHandler(ChannelTopicChanged, func(event string, payload interface{}) { h(payload.(*ChannelTopicChangedPayload)) }) +} + // SetUserCreatedHandler イベントハンドラをセットします func (hs EventHandlers) SetUserCreatedHandler(h func(payload *UserCreatedPayload)) { hs.SetHandler(UserCreated, func(event string, payload interface{}) { h(payload.(*UserCreatedPayload)) }) diff --git a/server.go b/server.go index 94420d6..6f3e4b5 100644 --- a/server.go +++ b/server.go @@ -76,6 +76,8 @@ func (bs *BotServer) ServeHTTP(rw http.ResponseWriter, req *http.Request) { payload = &DirectMessageCreatedPayload{} case ChannelCreated: payload = &ChannelCreatedPayload{} + case ChannelTopicChanged: + payload = &ChannelTopicChangedPayload{} case UserCreated: payload = &UserCreatedPayload{} default: