bump go version

This commit is contained in:
shoopea
2025-12-14 14:41:29 +01:00
parent 47c6579b74
commit 1aa2e0b115
6 changed files with 43 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
FROM golang:alpine as builder
FROM golang:alpine AS builder
RUN apk add --no-cache \
git

24
bot.go
View File

@@ -93,6 +93,7 @@ func (b *Bot) BotHandlers() {
b.bot.Handle("/version", botVersion)
b.bot.Handle("/save_config", botSaveConfig)
b.bot.Handle("/save_game", botSaveGame)
b.bot.Handle("/rcon", botRcon)
b.bot.Handle("/reset", botReset)
b.bot.Handle("/ready", botReady)
@@ -688,6 +689,29 @@ func botSaveGame(m *tb.Message) {
return
}
func botRcon(m *tb.Message) {
if m.Sender.ID != int(cfg.Telegram.AdminID) {
bot.SendChat(m.Chat.ID, "Only the admin can use this command.")
return
}
r := regexp.MustCompile("^\\/rcon (?P<Command>.*)")
if !r.MatchString(m.Text) {
bot.SendChat(m.Chat.ID, "Wrong usage.")
return
}
px := PacketAdminRCon{
Packet: Packet{PType: AdminPacketAdminRCon},
Command: fmt.Sprintf("%s", r.ReplaceAllString(m.Text, "${Command}")),
}
srv.Send(px.Bytes())
return
}
func botTransfer(m *tb.Message) {
r := regexp.MustCompile("^\\/transfer @(?P<Username>[a-zA-Z0-9]+) (?P<Duration>[a-z0-9]+)")

14
go.mod
View File

@@ -1,9 +1,21 @@
module git.siteop.biz/shoopea/gottdad
go 1.16
go 1.22
require (
github.com/tidwall/pretty v1.2.0
gonum.org/v1/plot v0.10.0
gopkg.in/tucnak/telebot.v2 v2.4.0
)
require (
github.com/ajstarks/svgo v0.0.0-20210923152817-c3b6e2f0c527 // indirect
github.com/fogleman/gg v1.3.0 // indirect
github.com/go-fonts/liberation v0.2.0 // indirect
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 // indirect
github.com/go-pdf/fpdf v0.5.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/text v0.3.6 // indirect
)

View File

2
ttd.go
View File

@@ -111,7 +111,7 @@ func (s *ServerTTD) Start() {
stopHeartBeat := make(chan struct{})
go s.HeartBeat(stopHeartBeat)
for {
for range 1 {
select {
// call to stop polling
case <-s.Data.Stop:

View File

@@ -1,6 +1,6 @@
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "c210acb"
var buildstamp = "2025-12-14_12:41:35"
var commits = "263"
var version = "c210acb-b263 - 2025-12-14_12:41:35"
var githash = "47c6579"
var buildstamp = "2025-12-14_13:41:18"
var commits = "264"
var version = "47c6579-b264 - 2025-12-14_13:41:18"