Skip to content
Telegram Bot library written in V.
Coq Verilog
Branch: master
Clone or download
Latest commit a8dd20f Aug 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Update bot.v Aug 13, 2019
CNAME Update CNAME Jul 13, 2019
LICENSE Initial commit Jun 27, 2019
README.md Update README.md Aug 14, 2019
_config.yml Set theme jekyll-theme-merlot Aug 4, 2019
methods.v fix Aug 13, 2019
types_new.v add something Aug 5, 2019
typesgen.v fix string Aug 5, 2019
vgram.v Update vgram.v Aug 22, 2019

README.md

vgram

vgram is a bot library for Telegram Bot API written in V.
The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.

Why don't you update the library?

Currently I have all the code ready to release a complete version of the library, with all the methods and objects of telegrams bot API.
However, I need that someone fix this problem https://github.com/vlang/v/issues/1522

Installing

v install vpervenditti.vgram

Creating a bot

  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. Get the token Now, create a file named mybot.v and put this code:
import vpervenditti.vgram
bot := vgram.new_bot('TOKEN', false) // <- set true to see debug log
mut updates := []vgram.Update{}
mut last_offset := 0
for {
    updates = bot.get_updates(vgram.NewGetUpdates{offset: last_offset, limit: 100})
    for update in updates {
        if last_offset < update.update_id {
            last_offset = update.update_id
            match update.message.text {
                '/start' => bot.send_message(vgram.NewSendMessage{
                    chat_id: update.message.from.id.str(),
                    text: 'Hi man'
                })
            }
        }
    }
}
You can’t perform that action at this time.