Coder Social home page Coder Social logo

vgram's Introduction

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:
module main

import 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 - a complete Telegram bot written in V

Documentation

You can find the documentation directly on the Telegram website or you can read it in the vgram source code. See methods.v and types.v.

Call a method using:

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

vgram's People

Contributors

bregydoc avatar daaniiieel avatar dariotarantini avatar davidebeatrici avatar medvednikov avatar meguminsama avatar quentinwidlocher avatar reaktnative avatar vladikasik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.