Added debug logging
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
a6ae1fe7b2
commit
a9f79c3c27
7
main.go
7
main.go
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -115,7 +116,6 @@ func HandlePayloadPost(c *fiber.Ctx) error {
|
|||||||
fmt.Println("Invalid payload - ", err)
|
fmt.Println("Invalid payload - ", err)
|
||||||
return c.Status(fiber.StatusBadRequest).SendString(err.Error())
|
return c.Status(fiber.StatusBadRequest).SendString(err.Error())
|
||||||
}
|
}
|
||||||
fmt.Println("Payload:", payload)
|
|
||||||
|
|
||||||
overrideRoom := c.Query("roomID")
|
overrideRoom := c.Query("roomID")
|
||||||
if overrideRoom != "" {
|
if overrideRoom != "" {
|
||||||
@ -123,11 +123,14 @@ func HandlePayloadPost(c *fiber.Ctx) error {
|
|||||||
payload.RoomID = overrideRoom
|
payload.RoomID = overrideRoom
|
||||||
}
|
}
|
||||||
overrideType := c.Query("type")
|
overrideType := c.Query("type")
|
||||||
fmt.Printf("Override type from query string: %s\n", overrideType)
|
|
||||||
if overrideType != "" {
|
if overrideType != "" {
|
||||||
|
fmt.Printf("Override type from query string: %s\n", overrideType)
|
||||||
payload.Type = PayloadType(overrideType)
|
payload.Type = PayloadType(overrideType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s, _ := json.MarshalIndent(payload, "", "\t")
|
||||||
|
fmt.Println(string(s))
|
||||||
|
|
||||||
switch payload.Type {
|
switch payload.Type {
|
||||||
case PayloadTypeText:
|
case PayloadTypeText:
|
||||||
_, err := matrixClient.SendText(id.RoomID(payload.RoomID), payload.Message)
|
_, err := matrixClient.SendText(id.RoomID(payload.RoomID), payload.Message)
|
||||||
|
Loading…
Reference in New Issue
Block a user