mirror of
https://github.com/maubot/maubot
synced 2025-08-29 21:20:37 +00:00
Small fixes
This commit is contained in:
parent
3a27831112
commit
feaf75b327
5 changed files with 53 additions and 29 deletions
|
@ -57,7 +57,21 @@ func (client *Client) ParseEvent(evt *gomatrix.Event) *Event {
|
|||
}
|
||||
|
||||
func (client *Client) AddEventHandler(evt maubot.EventType, handler maubot.EventHandler) {
|
||||
client.syncer.OnEventType(evt, handler)
|
||||
client.syncer.OnEventType(evt, func(evt *maubot.Event) bool {
|
||||
if evt.Sender == client.UserID {
|
||||
return false
|
||||
}
|
||||
return handler(evt)
|
||||
})
|
||||
}
|
||||
|
||||
func (client *Client) GetEvent(roomID, eventID string) *maubot.Event {
|
||||
evt, err := client.Client.GetEvent(roomID, eventID)
|
||||
if err != nil {
|
||||
log.Warnf("Failed to get event %s @ %s: %v", eventID, roomID, err)
|
||||
return nil
|
||||
}
|
||||
return client.ParseEvent(evt).Interface()
|
||||
}
|
||||
|
||||
func (client *Client) onJoin(evt *maubot.Event) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue