Skip to content

Commit

Permalink
add url logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ejnshtein committed Jan 8, 2025
1 parent 18ea7bd commit e05f223
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/tg-api.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { Bot } from 'grammy'
import { env } from './lib/env'

const buildUrlWithLogger = (
root: string,
token: string,
method: string,
env: "prod" | "test",
) => {
console.log({ root, token, method, env });
const prefix = env === "test" ? "test/" : "";
return `${root}/bot${token}/${prefix}${method}`;
};

export const botClient = new Bot(env.TOKEN, {
client: {
apiRoot: env.TELEGRAM_BOT_API
apiRoot: env.TELEGRAM_BOT_API,
buildUrl: buildUrlWithLogger
}
})

Expand Down

0 comments on commit e05f223

Please sign in to comment.