Code Monkey home page Code Monkey logo

vgram's Introduction

Hi there πŸ‘‹

vgram's People

Contributors

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vgram's Issues

Support for multipart/form-data

vgram/types.v

Lines 805 to 806 in 32429ae

// media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass β€œattach://” to upload a new one using multipart/form-data under name. More info on Sending Files Β»
media string

From https://core.telegram.org/bots/api#sending-files:

Sending files

There are three ways to send files (photos, stickers, audio, media, etc.):

  1. If the file is already stored somewhere on the Telegram servers, you don't need to reupload it: each file object has a file_id field, simply pass this file_id as a parameter instead of uploading. There are no limits for files sent this way.
  2. Provide Telegram with an HTTP URL for the file to be sent. Telegram will download and send the file. 5 MB max size for photos and 20 MB max for other types of content.
  3. Post the file using multipart/form-data in the usual way that files are uploaded via the browser. 10 MB max size for photos, 50 MB for other files.

Bot response on already responded last message on startup

The problem can be reproduced with the example code too.

If I copy-paste example code to example.v file, then go to the console and run v run example.v - a bot will start successfully. After I print a command "/start" - I will get an expected response.
But if then I will terminate the bot process via Ctrl + C and start it one more time - it will immediately respond on the last /start command one more time.

image

IDs should be i64s, not ints.

According to doc, IDs and file sizes are at most 52 bits.

This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.

So they should be i64, not an int(32 bits integer).

The full list:

  1. User.id
  2. Chat.id
  3. Message.migrate_to_chat_id
  4. Message.migrate_from_chat_id
  5. Animation.file_size
  6. Audio.file_size
  7. Document.file_size
  8. Video.file_size
  9. Voice.file_size
  10. Contact.user_id
  11. UserShared.user_id
  12. ChatShared.user_id
  13. File.file_size
  14. ChatJoinRequest.user_chat_id
  15. ResponseParameters.migrate_to_chat_id

Should I make a PR for this?

Using inline_keyboard

import json
import dariotarantini.vgram
bot.send_message(
  chat_id: chat_id
  text: 'Message'
  reply_markup: json.encode(vgram.InlineKeyboardMarkup{
    inline_keyboard: [
      [
        vgram.InlineKeyboardButton{text: 'A', callback_data: '/a'}
        vgram.InlineKeyboardButton{text: 'B', callback_data: '/b'}
      ]
      [
        vgram.InlineKeyboardButton{text: 'C', callback_data: '/c'}
        vgram.InlineKeyboardButton{text: 'D', callback_data: '/d'}
      ]
    ]
  })

Requires change in /home/moixllik/.vmodules/dariotarantini/vgram/types.v

pub struct InlineKeyboardMarkup {
pub:
  inline_keyboard [][]InlineKeyboardButton
}

Telegram Bot API

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.