telegram-bot

Telegram-bot (telepot api): Is it possible to send an image directly from URL without saving it

有些话、适合烂在心里 提交于 2019-11-29 23:31:53
问题 Im writing a telegram bot using the python telepot api. I'm now stuck at the point where I want to send a picture which directly comes from an URL without storing it locally. Telepot provides the following instruction to send a photo: >>> f = open('zzzzzzzz.jpg', 'rb') # some file on local disk >>> response = bot.sendPhoto(chat_id, f) Now im using f = urllib2.urlopen('http://i.imgur.com/B1fzGoh.jpg') bot.sendPhoto(chat_id, f) The problem here is that urllib2.urlopen('url') provide me file

How to add a bot to a Telegram Group?

五迷三道 提交于 2019-11-29 22:56:54
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? 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 just tap on it to add it. Old answer: Create a new group from the menu. Don't add any bots yet Find the bot

How to send an image from a telegram bot

不打扰是莪最后的温柔 提交于 2019-11-29 18:24:45
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') reply(img=output.getvalue()) When I change the code, nothing happened. img = Image.open('image.png') img

send bold & italic text on telegram bot with html

限于喜欢 提交于 2019-11-29 16:09:05
问题 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

Send an image link to telegram without display image url

北战南征 提交于 2019-11-29 07:55:24
问题 I need send an image url to telegram without display image url and hidden url. I see a telegram bot and it's do it very well and send long message with image I'm attach this bot result image see it. Now how can do it in my custom bot? It's possible hidden url with MARKDOWN style or any way? I want hidden image url in my text but telegram display my image. see my sample attach image. thank you 回答1: Most of them use the dot (or some things like this character) for link description and you

Telegram Bot custom keyboard in PHP

扶醉桌前 提交于 2019-11-29 07:09:06
问题 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

SyntaxError: missing ) after argument list, When using async

好久不见. 提交于 2019-11-29 02:55:29
问题 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",

How to set Telegram bot webhook?

拥有回忆 提交于 2019-11-28 21:37:01
I'm developing a Telegram bot, and I want to set the webhook to my domain's URL. I've already generated a self-signed certificate following the Telegram's guide . However, I'm not able to set the webhook. I've searched previous answers and found this one , but it doesn't work to me. Can anybody explain me how to upload the SSL certificate and set the webhook? I created a file on my server for conveniently setting up telegram webhooks. You can use the same file on your server. This should be on the same server from which you wish to run the Telegram Bot <html> <head> <title>Set Webhooks</title>

PHP: Telegram Bot: Insert line break to text message

[亡魂溺海] 提交于 2019-11-28 18:33:42
"\n" and "\r\n" , tested in text message sent by telegram bot, to create line break. Instead of showing line break, underline _ will appear after using them. How I could printing line feed in telegram message sent by bot? CODE $txt = 'با تشکر از عضویت شما، هر روز حدود ساعت 10 شب یک ویدئوی جالب برای شما ارسال خواهد شد.'; $txt .= " \n "; $txt .= 'Thanks for joining, Every day at almost 18:30 GMT an intersting video will be sent'; Message Demo Any help will be appreciated. Majid There is a better way! The problem is because of URL encodings... You can use normal PHP text using \n but by passing

How do I download a file or photo that was sent to my Telegram bot?

雨燕双飞 提交于 2019-11-28 16:40:02
I am using the telegram bot API but I cant see anyway to download a filé that was sent to my bot. I get a hash of the file but dont know what to do with it. Is there any way? Thanks. This is now available! https://core.telegram.org/bots/api#getfile Hooray! It was added on Sep 18th: https://core.telegram.org/bots/api Usage: In the JSON of the message you will receive a file_id as before. An example of a message object with a voice file: { message_id: 2675, from: { id: 10000001, first_name: 'john', username: 'john' }, chat: { id: 10000001, first_name: 'john', username: 'john' }, date: 1442848171