Testing a few things.

This commit is contained in:
Benjamin A. Shelton 2026-09-10 15:44:40 -06:00
commit 9e2bb347db
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -2,22 +2,32 @@ package main
import (
"context"
_ "os"
_ "os/signal"
"os"
"os/signal"
"sync"
"time"
"github.com/go-telegram/bot"
"github.com/go-telegram/bot/models"
"github.com/joho/godotenv"
"github.com/robfig/cron/v3"
"fmt"
"git.destrealm.net/zancarius/justusbot/internal/bible"
"git.destrealm.net/zancarius/justusbot/internal/settings"
_ "git.destrealm.net/zancarius/justusbot/internal/bible"
_ "git.destrealm.net/zancarius/justusbot/internal/settings"
)
// Send any text message to the bot after the bot has been started
func main() {
/*ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
if err := godotenv.Load(); err != nil {
panic(fmt.Sprintf("dotenv: %s", err))
}
wg := &sync.WaitGroup{}
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
opts := []bot.Option{
@ -26,18 +36,36 @@ func main() {
b, err := bot.New(os.Getenv("TOKEN"), opts...)
if nil != err {
// panics for the sake of simplicity.
// you should handle this error properly in your code.
panic(err)
fmt.Errorf("%v", err)
}
b.RegisterHandler(bot.HandlerTypeMessageText, "/start", bot.MatchTypeExact, startHandler)
b.Start(ctx)*/
fmt.Println(bible.FindAlias("mat"))
c := cron.New()
c.AddFunc("TZ=America/Denver 7 14 * * *", func(){fmt.Println("testing at 2pm")})
c.Start()
wg.Add(1)
go func(){
defer wg.Done()
b.Start(ctx)
}()
wg.Add(1)
go func(){
defer wg.Done()
time.Sleep(1*time.Second)
fmt.Println(b)
}()
wg.Wait()
/*fmt.Println(bible.FindAlias("mat"))
s, err := settings.LoadSettings("settings.toml")
fmt.Println(s, err)
fmt.Println(s, err)*/
}
func handler(ctx context.Context, b *bot.Bot, update *models.Update) {
fmt.Println(b.GetMe(ctx))
/*if update.Message != nil {
b.SendMessage(ctx, &bot.SendMessageParams{
ChatID: update.Message.Chat.ID,
@ -45,3 +73,7 @@ func handler(ctx context.Context, b *bot.Bot, update *models.Update) {
})
}*/
}
func startHandler(ctx context.Context, b *bot.Bot, update *models.Update) {
fmt.Println("received start:", b, update)
}