telegram-bot

Telegram inline keyboard and keyboard

会有一股神秘感。 提交于 2019-12-01 03:22:23
I have question about Telegram bot. I want keyboard and inline keyboard, Can I enable both of the features at the same time ? According to Telegram documentation , it's currently impossible to pass two or more objects for reply_markup at the same time. reply_markup only accepts one of these objects at the same time: InlineKeyboardMarkup ReplyKeyboardMarkup ReplyKeyboardRemove ForceReply And of course you cannot combine two or more objects together. If you wanna show keyboard and have inline keyboard too, you can show the keyboard in a message and after that send another message with inline

how save photo in telegram python bot?

半腔热情 提交于 2019-12-01 01:33:41
i want to write a telegram bot that save photos . this is my code , but its not working. and i don't know what is my problem? def image_handler(bot, update): file = bot.getFile(update.message.photo.file_id) print ("file_id: " + str(update.message.photo.file_id)) file.download('image.jpg') updater.dispatcher.add_handler(MessageHandler(Filters.photo, image_handler)) updater.start_polling() updater.idle() pleas help me to solve my problem. update.message.photo is an array of photos sizes (PhotoSize objects). Use file = bot.getFile(update.message.photo[-1].file_id) . This will get the image with

Clear “pending_update_count” in Telegram Bot

霸气de小男生 提交于 2019-12-01 00:18:19
问题 I want to clear all pending_update_count in my bot! The output of below command : https://api.telegram.org/botxxxxxxxxxxxxxxxx/getWebhookInfo Obviously I replaced the real API token with xxx is this : { "ok":true,"result": { "url":"", "has_custom_certificate":false, "pending_update_count":5154 } } As you can see, I have 5154 unread updates til now!! ( I'm pretty sure this pending updates are errors! Because no one uses this Bot! It's just a test Bot) By the way, this pending_update_count

'stream.ReadTimeout' threw an exception of type 'System.InvalidOperationException' sending photo to telegram bot

故事扮演 提交于 2019-11-30 19:19:47
I wrote below code for sending a photo to my bot, but in my stream, I have two exceptions for read and write and my photo was not send. I think maybe the reason was this error, but I couldn't fix it: stream.ReadTimeout threw an exception of type 'System.InvalidOperationException' using (var stream = System.IO.File.Open("a.jpg", FileMode.Open)) { var fileToSend = new FileToSend("a.jpg", stream); Task.Run(() => bot.SendPhotoAsync(u.Message.Chat.Id, fileToSend).ConfigureAwait(false)); } René Vogt The reason for this exception is probably that you Dispose the stream immediatly after starting the

Telegram Bot API Webhooks Self-signed Certificate issue

喜你入骨 提交于 2019-11-30 15:19:12
I'm working on a Ruby language server to manage multiple Telegram Bots via setwebhooks BTW, I'll delivery the server as opensource at BOTServer PROBLEM I have troubles receiving webhook updates from Telegram Bot API Server. I have set a webhook token (Telegram reply "success") but I do not receive any update on the succesfully configured webhook. I think the problem could be around self-signed Certificate mysteries. See old reddit question and answers. I have similar problem and I fair the point is in some "misunderstanding" between Telegram Bot API Server that send HTTPs webhooks updates and

send bold & italic text on telegram bot with html

这一生的挚爱 提交于 2019-11-30 10:55:09
I've created a bot in telegram I want to send bold and italic text with HTML page to bot My HTML code is: <html> <head><title>Telegram</title></head> <body> <form method="GET" action="https://api.telegram.org/bot(token)/sendMessage"> <input type="hidden" name="chat_id" value="@testadminch"> <input type="hidden" name="parse_mod" value="markdown"> <textarea name="text"></textarea> <input type="submit" value="Submit"> </form> </body> </html> If I send *bold* the output should be bold but it doesn't work Maak There are two possibilities to get: bold Set the parse_mode to markdown and send *bold*

How to add a bot to a Telegram Group?

烂漫一生 提交于 2019-11-30 10:47:30
问题 I been trying to add a bot to my Telegram group in Android Device but I am not able to do so. I tried @bot_name, /bot_name but it doesn't work. Can anyone tell me is it possible to add a bot to the group or should I create a new bot using Telegram API(not bot API) so I can add the contact number to the group? 回答1: Edit: now there is yet an easier way to do this - when creating your group, just mention the full bot name (eg. @UniversalAgent1Bot) and it will list it as you type. Then you can

How to send an image from a telegram bot

穿精又带淫゛_ 提交于 2019-11-30 10:10:08
问题 I have my bot working by now, but the thing is it can only send text. I have seen in the Bot API there are functions to send photos, videos... but I can't get it to work. Someone has achieved it? I'm using python source code from yukuku/telebot elif text == '/image': img = Image.new('RGB', (512, 512)) base = random.randint(0, 16777216) pixels = [base+i*j for i in range(512) for j in range(512)] # generate sample image img.putdata(pixels) output = StringIO.StringIO() img.save(output, 'JPEG')

Telegram Bot custom keyboard in PHP

穿精又带淫゛_ 提交于 2019-11-30 06:45:47
I'm trying to make a Telgram Bot in PHP with a custom keyboard. The message is delivered, but the custom keyboard won't work. $keyb = array('keyboard' => array(array("A", "B"))); also no succes. The sendMessage method referrers to ReplyKeyboardMarkup for the object. Making an array for ReplyKeyboardMarkup doesn't work. Also tried to json_encode($keyb) but that's also not the solution. I searched in GitHub for examples but I haven't found one where the custom keyboard is used. Telegram runs on iPhone and desktop, both uptodate. Sample code: $url = "https://api.telegram.org/bot<token>

SyntaxError: missing ) after argument list, When using async

六月ゝ 毕业季﹏ 提交于 2019-11-30 04:56:33
Why am I getting this error When I use async ? My Code: bot.onText(/\/start/, async msg => { const opts = { parse_mode: 'Markdown' , reply_markup: JSON.stringify({ keyboard: StartKeyboard, resize_keyboard: true, one_time_keyboard: true }) }; await bot.sendMessage(msg.chat.id, 'Hi', opts); }); Error: bot.onText(/\/start/, async msg => { ^^^^^ SyntaxError: missing ) after argument list I'm using node.js v6.11.0 with "dependencies": { "babel-polyfill": "^6.23.0", "cheerio": "^1.0.0-rc.2", "dotenv": "^4.0.0", "firebase": "^4.1.2", "firebase-admin": "^5.0.0", "node-telegram-bot-api": "^0.27.1",