https://github.com/dfvgbh/deno-telegram-bot-api
Deno Telegram bot API
https://github.com/dfvgbh/deno-telegram-bot-api
deno telegram telegram-bot telegram-bot-api
Last synced: 4 months ago
JSON representation
Deno Telegram bot API
- Host: GitHub
- URL: https://github.com/dfvgbh/deno-telegram-bot-api
- Owner: dfvgbh
- License: mit
- Created: 2020-05-16T14:45:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-28T17:04:34.000Z (over 2 years ago)
- Last Synced: 2025-11-09T22:47:29.907Z (8 months ago)
- Topics: deno, telegram, telegram-bot, telegram-bot-api
- Language: TypeScript
- Homepage:
- Size: 103 KB
- Stars: 35
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://core.telegram.org/bots/api)
# !!!NOT SUPPORTED!!!
## it won't work with latest Deno versions, feel free to fork and update as you wish
# deno-telegram-bot-api
🦕 wrapper for Telegram Bot API
Join Discord channel https://discord.gg/6VMcmxAnT8
## Features
- Fully typed API follows the official [Telegram API](https://core.telegram.org/bots/api) (v5.0)
- Minimal domain-specific knowledge required
- Polling and Webhook server for getting updates
- A simple way for sending media files
## Examples
For all examples check the [examples directory](https://github.com/dfvgbh/deno-telegram-bot-api/tree/master/examples)
The example of a bot which responds with a file containing a user message inside.
```ts
import { TelegramBot, UpdateType } from "https://deno.land/x/telegram_bot_api/mod.ts"
const TOKEN = Deno.env.get("TOKEN");
if (!TOKEN) throw new Error("Bot token is not provided");
const bot = new TelegramBot(TOKEN);
bot.on(UpdateType.Message, async ({ message }) => {
const text = message.text || "I can't hear you";
await bot.sendDocument({
chat_id: message.chat.id,
document: new File([text], "echo.txt"),
});
});
bot.run({
polling: true,
});
```
Let's run the example above right from the terminal:
```shell script
# MacOS, Linux
TOKEN=your-bot-token deno run --allow-net --allow-env https://deno.land/x/telegram_bot_api/examples/sending-files/01-simple-media.ts
```
```shell script
# Windows
set TOKEN=your-bot-token && deno run --allow-net --allow-env https://deno.land/x/telegram_bot_api/examples/sending-files/01-simple-media.ts
```