I want the bot to display the "typing..." action, i found other discussions about this topic, but not about this library, so if it's possible it would be so much helpful, thanks in advance.
i found this code
import logging
from telegram import *
from telegram.ext import *
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def message(update, context):
bot.sendChatAction(chat_id=update.message.chat_id, action = telegram.ChatAction.TYPING)
sleep(random() * 2 + 3.)
bot.sendMessage(chat_id=update.message.chat_id, text="Hi")
def error(update, context):
logger.warning('Update "%s" caused error "%s"', update, context.error)
def main():
updater = Updater("token", use_context=True)
dp = updater.dispatcher
dp.add_handler(MessageHandler(Filters.text, message))
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
and the error is "error "name 'bot' is not defined" obviously, but the question is, how can i create bot object without conflict with the updater? help