Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
csznet committed Nov 22, 2023
1 parent ac74ba8 commit db8f696
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ func BotDo() {
}
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
updatesChan := bot.GetUpdatesChan(u)
for update := range updatesChan {
for update := range bot.GetUpdatesChan(u) {
var msg *tgbotapi.Message
if update.Message != nil {
msg = update.Message
Expand All @@ -99,7 +98,7 @@ func BotDo() {
newMsg := tgbotapi.NewMessage(msg.Chat.ID, strings.TrimSuffix(conf.BaseUrl, "/")+"/d/"+fileID)
newMsg.ReplyToMessageID = msg.MessageID
if !strings.HasPrefix(conf.ChannelName, "@") {
if man, err := strconv.Atoi(conf.ChannelName); err == nil && newMsg.ReplyToMessageID == man {
if man, err := strconv.ParseInt(conf.ChannelName, 10, 64); err == nil && msg.Chat.ID == man {
bot.Send(newMsg)
}
} else {
Expand Down

0 comments on commit db8f696

Please sign in to comment.