You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for making this it looks really good and I'd love to use it but I'm running into some trouble
When I open a session my CPU usage on a single core jumps to 100%,
Also I have some handlers but only the very first date event is triggered none of the others seem to be working, this is my code:
package main
import (
"fmt""os""os/signal""syscall""github.com/ropenttd/gopenttd/pkg/admin""github.com/ropenttd/gopenttd/pkg/util"
)
funcmain() {
sess, err:=admin.New("127.0.0.1", 3977, "admin123")
iferr!=nil {
panic(err)
}
err=sess.Open()
iferr!=nil {
panic(err)
}
sess.AddHandler(clientJoin)
sess.AddHandler(getDate)
sess.AddHandler(onMessage)
// Wait here until CTRL-C or other term signal is received.fmt.Println("Bot is now running. Press CTRL-C to exit.")
sc:=make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
<-sc
}
funcgetDate(sess*admin.Session, d*admin.Date) {
fmt.Println(util.DateFormat(d.CurrentDate))
}
funcclientJoin(sess*admin.Session, d*admin.ClientJoin) {
fmt.Println("Meow")
}
funconMessage(sess*admin.Session, d*admin.Chat) {
fmt.Println("Message sent")
}
It's meant to print Meow or Message Sent when someone sends a chat message or joins the server, it should also print the current date whenever it's triggered but the only output is a single Current Date:
Starting: /home/baa/go/bin/dlv-dap dap --check-go-version=false --listen=127.0.0.1:42275 --log-dest=3 from /home/baa/Documents/Dev/OpenTTD-Discord-Bot
DAP server listening at: 127.0.0.1:42275
Type 'dlv help' for list of commands.
Bot is now running. Press CTRL-C to exit.
1991-01-05 00:00:00 +0000 UTC
The text was updated successfully, but these errors were encountered:
To be honest, I hadn't fully finished writing this when some major life stuff happened and I had to drop basically everything on the floor for a while - so a fair amount of stuff is probably fairly buggy or missing entirely. That being said, I'll try to find a spare afternoon to fire up my IDE and track down the cause of the leaks, as well as the handlers not firing (iirc this was something i was working on).
If you manage to find them yourself, feel free to fire a PR and I'll review it ASAP.
And regarding the Handlers, I found that for some of them I needed to set them to UpdateFrequencyAutomatically by default, and after that they fired ok. The thing I'm writing is here.
I've just pushed my latest head revision that I had on my laptop, can you test against ccf1a51? It's untested due to a lack of a test setup at present, but it might be a bit more working.
Hi, thanks for making this it looks really good and I'd love to use it but I'm running into some trouble
When I open a session my CPU usage on a single core jumps to 100%,
Also I have some handlers but only the very first date event is triggered none of the others seem to be working, this is my code:
It's meant to print Meow or Message Sent when someone sends a chat message or joins the server, it should also print the current date whenever it's triggered but the only output is a single Current Date:
The text was updated successfully, but these errors were encountered: