Skip to content

Commit

Permalink
fix(telegram): No user avatar when using local bot API.
Browse files Browse the repository at this point in the history
  • Loading branch information
su226 committed Aug 21, 2024
1 parent 6995364 commit a5a2374
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adapters/telegram/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class TelegramBot<C extends Context = Context, T extends TelegramBot.Conf
if (config.files.server ?? selfUrl) {
const route = `/telegram/${this.selfId}`
this.server = selfUrl + route
ctx.get('server').get(route + '/:file+', async ctx => {
ctx.get('server').get(route + '/:file(.+)', async ctx => {
const { data, type } = await this.$getFile(ctx.params.file)
ctx.set('content-type', type)
ctx.body = Buffer.from(data)
Expand Down Expand Up @@ -177,8 +177,8 @@ export class TelegramBot<C extends Context = Context, T extends TelegramBot.Conf
if (!avatar) return
const { file_id } = avatar[avatar.length - 1]
const file = await this.internal.getFile({ file_id })
if (this.server) {
user.avatar = `${this.server}/${file.file_path}`
if (this.local || this.server) {
user.avatar = (await this.$getFileFromPath(file.file_path)).src
} else {
const { endpoint } = this.file.config
user.avatar = `${endpoint}/${file.file_path}`
Expand Down

0 comments on commit a5a2374

Please sign in to comment.