don't log self messages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
47c9142763
commit
df73a5fa9e
6
main.go
6
main.go
@ -59,6 +59,9 @@ func main() {
|
|||||||
fmt.Println("Login successful")
|
fmt.Println("Login successful")
|
||||||
syncer := client.Syncer.(*mautrix.DefaultSyncer)
|
syncer := client.Syncer.(*mautrix.DefaultSyncer)
|
||||||
syncer.OnEventType(event.EventMessage, func(source mautrix.EventSource, evt *event.Event) {
|
syncer.OnEventType(event.EventMessage, func(source mautrix.EventSource, evt *event.Event) {
|
||||||
|
if evt.Sender == client.UserID {
|
||||||
|
return //ignore events from self
|
||||||
|
}
|
||||||
fmt.Printf("<%[1]s> %[4]s (%[2]s/%[3]s)\n", evt.Sender, evt.Type.String(), evt.ID, evt.Content.AsMessage().Body)
|
fmt.Printf("<%[1]s> %[4]s (%[2]s/%[3]s)\n", evt.Sender, evt.Type.String(), evt.ID, evt.Content.AsMessage().Body)
|
||||||
body := evt.Content.AsMessage().Body
|
body := evt.Content.AsMessage().Body
|
||||||
body_s := strings.Split(body, " ")
|
body_s := strings.Split(body, " ")
|
||||||
@ -68,9 +71,6 @@ func main() {
|
|||||||
if len(body_s) < 2 {
|
if len(body_s) < 2 {
|
||||||
return //nothing to parse
|
return //nothing to parse
|
||||||
}
|
}
|
||||||
if evt.Sender == client.UserID {
|
|
||||||
return //ignore events from self
|
|
||||||
}
|
|
||||||
switch body_s[1] {
|
switch body_s[1] {
|
||||||
case "info":
|
case "info":
|
||||||
// print info page
|
// print info page
|
||||||
|
Loading…
Reference in New Issue
Block a user