Version Inicial
This commit is contained in:
28
utils.go
Normal file
28
utils.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/go-telegram/bot"
|
||||
"github.com/go-telegram/bot/models"
|
||||
)
|
||||
|
||||
func setProfileImage(ctx context.Context, b *bot.Bot) error {
|
||||
file, err := os.Open("./conf/DockerBot.jpg")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
attachName := "profile_photo"
|
||||
photo := &models.InputProfilePhotoStatic{
|
||||
Photo: "attach://" + attachName,
|
||||
MediaAttachment: file,
|
||||
}
|
||||
_, err = b.SetMyProfilePhoto(ctx, &bot.SetMyProfilePhotoParams{
|
||||
Photo: photo})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user