Skip to content

Commit

Permalink
docker pass and channel get
Browse files Browse the repository at this point in the history
  • Loading branch information
csznet committed Nov 11, 2023
1 parent 92d0479 commit 9c9121c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func init() {
if conf.ChannelName == "" {
conf.ChannelName = os.Getenv("CHANNEL")
}
if conf.Pass == "" {
conf.Pass = os.Getenv("PASS")
}
if conf.Mode == "" {
conf.Mode = os.Getenv("MODE")
}
Expand Down
11 changes: 6 additions & 5 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ func BotDo() {

u := tgbotapi.NewUpdate(0)
u.Timeout = 60

updates := bot.GetUpdatesChan(u)

for update := range updates {
if update.Message != nil { // If we got a message
updatesChan := bot.GetUpdatesChan(u)
for update := range updatesChan {
if update.Message != nil {
if update.Message.Text == "get" && update.Message.ReplyToMessage.Document.FileID != "" {
msg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.ReplyToMessage.Document.FileID)
msg.ReplyToMessageID = update.Message.MessageID
bot.Send(msg)
}
} else if update.ChannelPost != nil && update.ChannelPost.Text == "get" && update.ChannelPost.ReplyToMessage.Document.FileID != "" {
msg := tgbotapi.NewMessage(update.ChannelPost.Chat.ID, update.ChannelPost.ReplyToMessage.Document.FileID)
bot.Send(msg)
}
}
}

0 comments on commit 9c9121c

Please sign in to comment.