dariotarantini / vgram Goto Github PK
View Code? Open in Web Editor NEWTelegram Bot library written in V.
License: MIT License
Telegram Bot library written in V.
License: MIT License
Lines 805 to 806 in 32429ae
From https://core.telegram.org/bots/api#sending-files:
Sending files
There are three ways to send files (photos, stickers, audio, media, etc.):
- 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.
- 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.
- 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.
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.
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:
User.id
Chat.id
Message.migrate_to_chat_id
Message.migrate_from_chat_id
Animation.file_size
Audio.file_size
Document.file_size
Video.file_size
Voice.file_size
Contact.user_id
UserShared.user_id
ChatShared.user_id
File.file_size
ChatJoinRequest.user_chat_id
ResponseParameters.migrate_to_chat_id
Should I make a PR for this?
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
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.