@minhvuong/pirate-storage-telegram-server
v0.1.0
Published
Bun/server runtime for `@minhvuong/pirate-storage-telegram`, backed by mtcute TCP transport and a persistent SQLite auth session.
Downloads
147
Readme
@minhvuong/pirate-storage-telegram-server
Bun/server runtime for @minhvuong/pirate-storage-telegram, backed by mtcute TCP transport and a persistent SQLite auth session.
import { createTelegramServerProvider } from "@minhvuong/pirate-storage-telegram-server";
const telegram = createTelegramServerProvider({
apiId: Number(process.env.TELEGRAM_API_ID),
apiHash: process.env.TELEGRAM_API_HASH!,
botToken: process.env.TELEGRAM_BOT_TOKEN!,
channel: Number(process.env.TELEGRAM_CHANNEL_ID),
channelId: process.env.TELEGRAM_CHANNEL_ID!,
sessionPath: ".data/telegram.sqlite",
manifestSecret: process.env.STORAGE_MANIFEST_SECRET!,
});
const storage = createStorage({ providers: { telegram: telegram.provider } });Create one runtime per process and reuse it. The bot must be able to post and delete messages in the target private channel.
For a Worker deployment, call resolveTelegramWorkerChannel(await telegram.getClient(), channel)
once to obtain the channel ID and access hash needed by the Worker adapter. Treat the access hash and
exported session as secrets.
