Skip to content

Commit

Permalink
feat(telegram): add getUser (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
XxLittleCxX authored Aug 18, 2023
1 parent 1d7f04c commit 76eaa4c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions adapters/telegram/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ export class TelegramBot<T extends TelegramBot.Config = TelegramBot.Config> exte
user.avatar = `${endpoint}/${file.file_path}`
}
}

async getUser(userId: string, guildId?: string) {
const data = await this.internal.getChat({ chat_id: userId })
if (!data.photo?.big_file_id && !data.photo?.small_file_id) return adaptUser(data)
const { url } = await this.$getFileFromId(data.photo?.big_file_id || data.photo?.small_file_id)
return {
...adaptUser(data),
avatar: url,
}
}
}

export namespace TelegramBot {
Expand Down

0 comments on commit 76eaa4c

Please sign in to comment.