feat: add msg name

This commit is contained in:
Vaala Cat
2023-05-17 16:14:11 +08:00
parent b7e73e8c31
commit e516a51ebe
3 changed files with 37 additions and 35 deletions

View File

@@ -1,6 +1,7 @@
package tgbot
import (
"fmt"
"log"
"net/http"
"net/url"
@@ -30,7 +31,7 @@ func Run(sendFunc func(string) error) {
log.Panic(err)
}
conf.Bot.Debug = true
conf.Bot.Debug = false
log.Printf("Authorized on account %s", conf.Bot.Self.UserName)
@@ -43,7 +44,9 @@ func Run(sendFunc func(string) error) {
logrus.Infof("[%s] %s", update.Message.From.UserName, update.Message.Text)
if update.Message.Command() == "talk" {
logrus.Infof("id is %d", update.Message.Chat.ID)
sendFunc(update.Message.CommandArguments())
m := fmt.Sprintf("%v: %v", update.Message.From.UserName, update.Message.CommandArguments())
err := sendFunc(m)
logrus.WithError(err).Error("send message error")
}
if update.Message.Command() == "list" {
logrus.Infof("id is %d", update.Message.Chat.ID)