File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,26 @@ func setupLogging() {
7272 }
7373}
7474
75+ func getUserName (user tgbotapi.User ) string {
76+ username := user .FirstName
77+ if user .UserName != "" {
78+ username = fmt .Sprintf ("@%v" , user .UserName )
79+ } else if user .LastName != "" {
80+ username = fmt .Sprintf ("%s %s" , user .FirstName , user .LastName )
81+ }
82+ return username
83+ }
84+
85+ func reply (bot * tgbotapi.BotAPI , update * tgbotapi.Update , text string ) {
86+ msg := tgbotapi .NewMessage (update .Message .Chat .ID , text )
87+ msg .ReplyToMessageID = update .Message .MessageID
88+
89+ _ , err := bot .Send (msg )
90+ if err != nil {
91+ log .Printf ("[!] Send msg failed: %v" , err )
92+ }
93+ }
94+
7595func main () {
7696 setupLogging ()
7797 token , exists := os .LookupEnv ("TELEGRAM_BOT_TOKEN" )
You can’t perform that action at this time.
0 commit comments