Skip to content

Commit

Permalink
refactor: restrict no_responders data
Browse files Browse the repository at this point in the history
  • Loading branch information
viztea committed Aug 2, 2023
1 parent b3b5849 commit f4602d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion kantoku.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ func main() {

/* prepare no_responders reply. */
if k.Config.Kantoku.Nats.NoResponders != nil {
b, err := json.Marshal(k.Config.Kantoku.Nats.NoResponders)
b, err := json.Marshal(map[string]any{
"type": 4,
"data": k.Config.Kantoku.Nats.NoResponders,
})

if err != nil {
k.Logger.Warnln("unable to encode 'no_responders' reply: ", err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion kantoku.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public_key = ""
[kantoku.nats]
servers = ["nats://127.0.0.1:4222"]
subject = "gateway.INTERACTION_CREATE"
no_responders = { type = 4, data = { content = "this command no workery" } }
no_responders = { content = "this command no workery" }

[kantoku.logging]
time_format = "01-02-06 15:04:05"
Expand Down

0 comments on commit f4602d6

Please sign in to comment.