Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dariotarantini/vgram
Telegram Bot library written in V.
https://github.com/dariotarantini/vgram
api bot library telegram v vlang
Last synced: 19 days ago
JSON representation
Telegram Bot library written in V.
- Host: GitHub
- URL: https://github.com/dariotarantini/vgram
- Owner: dariotarantini
- License: mit
- Created: 2019-06-27T13:23:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-01T07:29:58.000Z (over 2 years ago)
- Last Synced: 2024-08-05T10:07:37.233Z (5 months ago)
- Topics: api, bot, library, telegram, v, vlang
- Language: V
- Homepage:
- Size: 251 KB
- Stars: 144
- Watchers: 12
- Forks: 19
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-v - vgram - Telegram bot library. (Libraries / Telegram)
README
# vgram
**vgram** is a bot library for the Telegram Bot API written in V.
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.It currently implements every method from Telegram Bot API 4.8
## Installing
- Using vpm: `v install dariotarantini.vgram`
- Using vpkg: `vpkg get vgram`## TBA
Currently, due to some vlang issues, this library have some limitations.
Some part of the code are commented, check types.v## Getting started
1. Search for the “@botfather” telegram bot and start it
2. Click on or type /newbot to create a new bot and follow his instructions
3. Copy the token and create a file named sendMessage.v with the following code:
```v
module mainimport dariotarantini.vgram
fn main(){
bot := vgram.new_bot('TELEGRAM_BOT_TOKEN_HERE')
bot.send_message(
chat_id: "USER_ID_HERE",
text: 'yo! Made using vgram!'
)
}
```
## Examples
* [`hi_man.v`](examples/hi_man.v) - a complete Telegram bot written in V## Documentation
You can find the documentation directly on the [Telegram website](https://core.telegram.org/bots/api) or you can read it in the vgram source code. See methods.v and types.v.Call a method using:
```v
bot_instance.method_name(
method_arg1: "some text"
method_arg1: 123 // or int
)- *bot_instance* can be created using bot_instance := vgram.Bot{"TOKEN"} or bot_instance.new_bot("TOKEN")
- *method_name* and *method_args* shoud be in snake_case
```
Thats it. You are ready to go.## Custom endpoint
You can set a custom telegram endpoint via `Bot.endpoint` value. Default is set to `https://api.telegram.org/bot`