telegram-bot

How to send photo on telegram bot

独自空忆成欢 提交于 2020-05-10 09:26:10
问题 i'm just implementing a simple bot who should send some photos and videos to my chat_id . Well, i'm using python, this is the script import sys import time import random import datetime import telepot def handle(msg): chat_id = msg['chat']['id'] command = msg['text'] print 'Got command: %s' % command if command == 'command1': bot.sendMessage(chat_id, *******) elif command == 'command2': bot.sendMessage(chat_id, ******) elif command == 'photo': bot.sendPhoto(...) bot = telepot.Bot('*** INSERT

Telegram callback_data for link buttons

那年仲夏 提交于 2020-05-02 05:29:50
问题 I'm sending a link button throught a Telegram bot and I would like to get the callback_data after the user opens the url. My options are: var options = { parse_mode: "Markdown", reply_markup: { inline_keyboard: btns } }; where btns is [ [{ text: "Read first", url: "http://any", callback_data: "any_relevant_data }] ] The button shows perfectly, the link works, but no callback is triggered and I never hit bot.on('callback_query', (callback_message) => { //any action }); Is this a missing

Telegram Bot “chat not found”

[亡魂溺海] 提交于 2020-04-10 07:41:46
问题 I have the following code in Python to send a message to myself from a bot. import requests token = '320835125:AAFUUC-fdo_EFzsCjvmxu8HBk7qVzZXXXXX' method = 'sendMessage' myuserid = 1949275XX response = requests.post( url='https://api.telegram.org/bot{0}/{1}'.format(token, method), data={'chat_id': myuserid, 'text': 'hello friend'} ).json() print(response) but this returns {'description': 'Bad Request: chat not found', 'error_code': 400, 'ok': False} What am I doing wrong? I got myuserid by

How to extend the limit for reply from telegram bot and what is the limit of reply from telegram bot?[i am using dialogflow integration]

强颜欢笑 提交于 2020-03-26 03:35:45
问题 I was using dialogflow integration to create bot for telegram.I am getting replies from bot for small queries but i am not getting replies from the bot for larger multi-line answers expected from the bot. 回答1: Telegram has a limit when sending message of 4096 chars, are your answers longer than this? 400 BAD_REQUEST MESSAGE_TOO_LONG Message was too long. Current maximum length is 4096 UTF8 characters [See documentation] 来源: https://stackoverflow.com/questions/55672791/how-to-extend-the-limit

How to extend the limit for reply from telegram bot and what is the limit of reply from telegram bot?[i am using dialogflow integration]

坚强是说给别人听的谎言 提交于 2020-03-26 03:34:40
问题 I was using dialogflow integration to create bot for telegram.I am getting replies from bot for small queries but i am not getting replies from the bot for larger multi-line answers expected from the bot. 回答1: Telegram has a limit when sending message of 4096 chars, are your answers longer than this? 400 BAD_REQUEST MESSAGE_TOO_LONG Message was too long. Current maximum length is 4096 UTF8 characters [See documentation] 来源: https://stackoverflow.com/questions/55672791/how-to-extend-the-limit

How to send message in specific time TelegramBot

点点圈 提交于 2020-03-03 04:36:22
问题 Hi i want to send message from bot in specific time (without message from me), for example every Saturday morning at 8:00am. Here is my code: import telebot import config from datetime import time, date, datetime bot = telebot.TeleBot(config.bot_token) chat_id=config.my_id @bot.message_handler(commands=['start', 'help']) def print_hi(message): bot.send_message(message.chat.id, 'Hi!') @bot.message_handler(func=lambda message: False) #cause there is no message def saturday_message(): now =

How to send message in specific time TelegramBot

拟墨画扇 提交于 2020-03-03 04:34:35
问题 Hi i want to send message from bot in specific time (without message from me), for example every Saturday morning at 8:00am. Here is my code: import telebot import config from datetime import time, date, datetime bot = telebot.TeleBot(config.bot_token) chat_id=config.my_id @bot.message_handler(commands=['start', 'help']) def print_hi(message): bot.send_message(message.chat.id, 'Hi!') @bot.message_handler(func=lambda message: False) #cause there is no message def saturday_message(): now =

How to send message in specific time TelegramBot

自闭症网瘾萝莉.ら 提交于 2020-03-03 04:34:16
问题 Hi i want to send message from bot in specific time (without message from me), for example every Saturday morning at 8:00am. Here is my code: import telebot import config from datetime import time, date, datetime bot = telebot.TeleBot(config.bot_token) chat_id=config.my_id @bot.message_handler(commands=['start', 'help']) def print_hi(message): bot.send_message(message.chat.id, 'Hi!') @bot.message_handler(func=lambda message: False) #cause there is no message def saturday_message(): now =

How can I mention Telegram users without a username?

Deadly 提交于 2020-02-03 04:40:34
问题 I want mention users even those which d o not have a username . If a user has set up a username I return Hi @username as an answer but if a user does not have one I can't do that. I tried using the unique User ID e.g. @5642166 but that did not work. How can I achieve that? 回答1: According to official documentation it is possible to mention user by its numerical id with markup: Markdown style To use this mode, pass Markdown in the parse_mode field when using sendMessage . Use the following

Telegram bot: example json, inline_keyboard

回眸只為那壹抹淺笑 提交于 2020-01-22 15:44:06
问题 Example json for show inline_keyboard in telegram bot https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating enter image description here { "chat_id": "123456", "text": "Hi", "reply_markup": { "inline_keyboard": [[ { "text": "A", "callback_data": "A1" }, { "text": "B", "callback_data": "C1" }] ] } } 回答1: I just had a hard time trying to get it to work on my API and I've found the problem. You need to JSON.stringify() the contents of reply_markup that converts the keyboard