Skip to content

Commit

Permalink
docs(route/telegram): add docs for telegram session
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Oct 27, 2024
1 parent 26bc26a commit 60f4327
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/routes/telegram/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ For backward compatibility reasons, invalid \`routeParams\` will be treated as \
{
name: 'TELEGRAM_SESSION',
optional: true,
description: '',
description: 'Telegram API Authentication',
},
],
requirePuppeteer: false,
Expand All @@ -116,7 +116,7 @@ For backward compatibility reasons, invalid \`routeParams\` will be treated as \
handler,
description: `
:::tip
Due to Telegram restrictions, some channels involving pornography, copyright, and politics cannot be subscribed. You can confirm by visiting \`https://t.me/s/:username\`, it's recommended to deploy your own instance with configs (create your telegram via \`https://core.telegram.org/api/obtaining_api_id\`, run this command \`node ./lib/routes/telegram/scripts/get-telegram-session.mjs\` to get \`TELEGRAM_SESSION\` and set it as Environment Variable).
Due to Telegram restrictions, some channels involving pornography, copyright, and politics cannot be subscribed. You can confirm by visiting \`https://t.me/s/:username\`, it's recommended to deploy your own instance with telegram api configs (create your telegram application via \`https://core.telegram.org/api/obtaining_api_id\`, run this command \`node ./lib/routes/telegram/scripts/get-telegram-session.mjs\` to get \`TELEGRAM_SESSION\` and set it as Environment Variable).
:::`,
};

Expand Down Expand Up @@ -159,7 +159,7 @@ async function handler(ctx) {
searchQuery = fallback(undefined, routeParams.searchQuery, null);
}

// TODO: some channels are not available in t.me/s/, need extra handling logics
// some channels are not available in t.me/s/, fallback to use Telegram api
const resourceUrl = searchQuery ? `https://t.me/s/${username}?q=${encodeURIComponent(searchQuery)}` : `https://t.me/s/${username}`;

const data = await cache.tryGet(
Expand Down

0 comments on commit 60f4327

Please sign in to comment.