I searched about it , and i asked from AI and i noticed the problem is because of the new version after python-telegram-bot 12 library.
So some of them say , just simply remove the using-context but i did it and i don't know what is wrong. This is the code. I learned it from a video on YouTube that probably was a little old.
import constants as keys
from telegram.ext import *
import responses as R
print('Bot starting ... ')
def start_command(update, context):
update.message.reply('type something random so')
def help_command(update, context):
update.message.reply('this is my help command.')
def handle_message(update, context):
text = str(update.message.text).lower()
Response = R.sample_responses(text)
update.message.reply_text(response)
def error(update, context):
print(f'Update {update} caused error {context.error}')
# most important function most important function
def main():
##### this line is my error
updater = Updater(keys.API_KEY)
# before removing using-context:
# updater = Updater(keys.API_KEY, using-context=True)
dp = updater.dispatcher
dp.add_handler(CommandHandler("start", start_command))
dp.add_handler(CommandHandler("help", help_command))
dp.add_handler(MessageHandler(Filters.text, handle_message))
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
print("polling ... ")
main()
So the error with using-context:
File "/storage/emulated/0/1_code/someall/telegram/python/1/main.py", line 27
updater = Updater(keys.API_KEY, using-context=True)
^^^^^^^^^^^^^^
SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
So this is error when i removed the using-context :
Traceback (most recent call last):
File "/storage/emulated/0/1_code/someall/telegram/python/1/main.py", line 42, in <module>
main()
File "/storage/emulated/0/1_code/someall/telegram/python/1/main.py", line 27, in main
updater = Updater(keys.API_KEY)
^^^^^^^^^^^^^^^^^^^^^
TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
Try instead of "using-context=True" use this
use_context=True