Save user profile photo
You can save any user profile photo by index
SaveProfilePhoto class-methods or .saveProfilePhoto method take arguments:
Argument
Description
Required
1
2
import { Controller, OnCommand, GetAnswer, Answer, ChatAction, SaveProfilePhoto, Photo } from 'nestgram';
import { AppService } from './app.service';
import * as path from 'path';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@OnCommand('start')
async getChatAction(@GetAnswer() answer: Answer): Promise<ChatAction> {
const imgPath: string = path.resolve(__dirname, 'profile-photo.jpeg');
return new ChatAction('upload_photo')
.next(new SaveProfilePhoto(imgPath))
.next(new Photo('path', imgPath, null, false))
}
}Last updated