telepot

async with" if the event loop is running

强颜欢笑 提交于 2021-02-08 06:51:05
问题 I'm writing my first telegram bot with telepot and telethon my main code is: import sys import asyncio import random import telepot import telepot.aio from telepot.aio.loop import MessageLoop from telepot.namedtuple import ReplyKeyboardMarkup, KeyboardButton, ReplyKeyboardRemove, ForceReply from telepot.namedtuple import InlineKeyboardMarkup, InlineKeyboardButton from telepot.namedtuple import InlineQueryResultArticle, InlineQueryResultPhoto, InputTextMessageContent async def on_chat_message

async with" if the event loop is running

那年仲夏 提交于 2021-02-08 06:50:46
问题 I'm writing my first telegram bot with telepot and telethon my main code is: import sys import asyncio import random import telepot import telepot.aio from telepot.aio.loop import MessageLoop from telepot.namedtuple import ReplyKeyboardMarkup, KeyboardButton, ReplyKeyboardRemove, ForceReply from telepot.namedtuple import InlineKeyboardMarkup, InlineKeyboardButton from telepot.namedtuple import InlineQueryResultArticle, InlineQueryResultPhoto, InputTextMessageContent async def on_chat_message

Why does venue telepot isn't correct?

一世执手 提交于 2021-01-29 12:59:01
问题 I'm trying to do a bot which could get your street name by telpot. I've inserted location in line 22 (location) and it works. But when i want to try with 'venue' it doesnt work. Can someone help me to get the name street (or venue) of my users? import json import time from pprint import pprint import telepot from telepot.loop import MessageLoop import telepot.namedtuple bot = telepot.Bot(token) lista = ["New York","Los Angeles","Miami","Toronto","Berlin","Rome","Ciao"] seq = iter(lista)

How to send a hyperlink in bot.sendMessage()

落爺英雄遲暮 提交于 2020-12-07 06:30:53
问题 My bot sends out links. so I wanted to include a hyperlink like the one you can do with HTML for example -a href="google.com" Google /a shows up a click able text called "Google" how can I do this in bot.sendMessage() ? and also if you have any idea of sending bold font messages too.. 回答1: You can use formatting option to do this. 来源: https://stackoverflow.com/questions/45268368/how-to-send-a-hyperlink-in-bot-sendmessage

How to send a hyperlink in bot.sendMessage()

一世执手 提交于 2020-12-07 06:30:10
问题 My bot sends out links. so I wanted to include a hyperlink like the one you can do with HTML for example -a href="google.com" Google /a shows up a click able text called "Google" how can I do this in bot.sendMessage() ? and also if you have any idea of sending bold font messages too.. 回答1: You can use formatting option to do this. 来源: https://stackoverflow.com/questions/45268368/how-to-send-a-hyperlink-in-bot-sendmessage

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

Can I store bot state data on the involved telegram chat itself?

无人久伴 提交于 2019-12-25 17:18:21
问题 I'm trying to store a bit of data regarding the bot's conversation within a group (i.e. the bot manages kind of a text-based chat scape room and I want to save which "world" and "stage" the group is in at the time), and so I was wondering whether you can just store this little amount of data within the chat itself (instead of saving it on the bot server side*, which seems quite a lot of work for something that should be so simple). So following this python zen philosophy, I'm trying to find a

Can I store bot state data on the involved telegram chat itself?

血红的双手。 提交于 2019-12-25 17:18:05
问题 I'm trying to store a bit of data regarding the bot's conversation within a group (i.e. the bot manages kind of a text-based chat scape room and I want to save which "world" and "stage" the group is in at the time), and so I was wondering whether you can just store this little amount of data within the chat itself (instead of saving it on the bot server side*, which seems quite a lot of work for something that should be so simple). So following this python zen philosophy, I'm trying to find a

Multithreading with Selenium using Python and Telpot

回眸只為那壹抹淺笑 提交于 2019-12-24 10:24:37
问题 I'm coding my first telegram bot, but now I have to serve multiple user at the same time. This code it's just a little part, but it should help me to use multithread with selenium class MessageCounter(telepot.helper.ChatHandler): def __init__(self, *args, **kwargs): super(MessageCounter, self).__init__(*args, **kwargs) def on_chat_message(self, msg): content_type, chat_type, chat_id = telepot.glance(msg) chat_id = str(chat_id) browser = browserSelenium.start_browser(chat_id) userIsLogged =

How can make conversation between bot and user with telepot

▼魔方 西西 提交于 2019-12-13 02:58:35
问题 I want to create the bot with telepot that ask the users frequent questions. For example first ask 'whats your name.?' then the user reply 'user-name',then ask how old are you? and the user reply his age and ... I had written a code for this chat between user and bot,but sometimes I am getting error. Please guide me how can I make this bot with telepot .? I want to make conversation between bot and users with telepot 回答1: What you're looking for is DelegatorBot . Consider this tutorial.