29 lines
548 B
Go
29 lines
548 B
Go
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
|
|
}
|