I have tried reinstalling the libraries but I am still receiving the same error.
I am receiving this error:
<code>TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
</code>
<code>TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
</code>
TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
This is the code:
<code>from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, filters, CallbackContext
TOKEN = 'TOKEN ID from botfather'
def start(update: Update, context: CallbackContext) -> None:
user = update.effective_user
update.message.reply_markdown_v2(
fr'Hi {user.mention_markdown_v2()}!',
reply_markup=main_menu_keyboard(),
)
def main_menu_keyboard():
keyboard = [
[InlineKeyboardButton("R2SA", callback_data='R2SA'),
InlineKeyboardButton("BRRR", callback_data='BRRR'),
InlineKeyboardButton("BTL", callback_data='BTL')]
]
return InlineKeyboardMarkup(keyboard)
def handle_deal_selection(update: Update, context: CallbackContext) -> None:
query = update.callback_query
query.answer()
context.user_data['deal_type'] = query.data
query.edit_message_text(text=f"Selected deal type: {query.data}nnPlease enter the description of the deal:")
def handle_description(update: Update, context: CallbackContext) -> None:
description = update.message.text
deal_type = context.user_data['deal_type']
context.bot.send_message(chat_id='-1002022822590', text=f"**{deal_type} Deal**n{description}")
update.message.reply_text("Thank you! Your deal description has been posted.")
def main():
updater = Updater(TOKEN, use_context=True)
dispatcher = updater.dispatcher
# Register handlers
dispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(CallbackQueryHandler(handle_deal_selection, pattern='^(R2SA|BRRR|BTL)$'))
dispatcher.add_handler(MessageHandler(filters.text & ~filters.command, handle_description))
# Start the Bot
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
</code>
<code>from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, filters, CallbackContext
TOKEN = 'TOKEN ID from botfather'
def start(update: Update, context: CallbackContext) -> None:
user = update.effective_user
update.message.reply_markdown_v2(
fr'Hi {user.mention_markdown_v2()}!',
reply_markup=main_menu_keyboard(),
)
def main_menu_keyboard():
keyboard = [
[InlineKeyboardButton("R2SA", callback_data='R2SA'),
InlineKeyboardButton("BRRR", callback_data='BRRR'),
InlineKeyboardButton("BTL", callback_data='BTL')]
]
return InlineKeyboardMarkup(keyboard)
def handle_deal_selection(update: Update, context: CallbackContext) -> None:
query = update.callback_query
query.answer()
context.user_data['deal_type'] = query.data
query.edit_message_text(text=f"Selected deal type: {query.data}nnPlease enter the description of the deal:")
def handle_description(update: Update, context: CallbackContext) -> None:
description = update.message.text
deal_type = context.user_data['deal_type']
context.bot.send_message(chat_id='-1002022822590', text=f"**{deal_type} Deal**n{description}")
update.message.reply_text("Thank you! Your deal description has been posted.")
def main():
updater = Updater(TOKEN, use_context=True)
dispatcher = updater.dispatcher
# Register handlers
dispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(CallbackQueryHandler(handle_deal_selection, pattern='^(R2SA|BRRR|BTL)$'))
dispatcher.add_handler(MessageHandler(filters.text & ~filters.command, handle_description))
# Start the Bot
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
</code>
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, filters, CallbackContext
TOKEN = 'TOKEN ID from botfather'
def start(update: Update, context: CallbackContext) -> None:
user = update.effective_user
update.message.reply_markdown_v2(
fr'Hi {user.mention_markdown_v2()}!',
reply_markup=main_menu_keyboard(),
)
def main_menu_keyboard():
keyboard = [
[InlineKeyboardButton("R2SA", callback_data='R2SA'),
InlineKeyboardButton("BRRR", callback_data='BRRR'),
InlineKeyboardButton("BTL", callback_data='BTL')]
]
return InlineKeyboardMarkup(keyboard)
def handle_deal_selection(update: Update, context: CallbackContext) -> None:
query = update.callback_query
query.answer()
context.user_data['deal_type'] = query.data
query.edit_message_text(text=f"Selected deal type: {query.data}nnPlease enter the description of the deal:")
def handle_description(update: Update, context: CallbackContext) -> None:
description = update.message.text
deal_type = context.user_data['deal_type']
context.bot.send_message(chat_id='-1002022822590', text=f"**{deal_type} Deal**n{description}")
update.message.reply_text("Thank you! Your deal description has been posted.")
def main():
updater = Updater(TOKEN, use_context=True)
dispatcher = updater.dispatcher
# Register handlers
dispatcher.add_handler(CommandHandler("start", start))
dispatcher.add_handler(CallbackQueryHandler(handle_deal_selection, pattern='^(R2SA|BRRR|BTL)$'))
dispatcher.add_handler(MessageHandler(filters.text & ~filters.command, handle_description))
# Start the Bot
updater.start_polling()
updater.idle()
if __name__ == '__main__':
main()
I am receiving this error:
<code>(myenv) C:UsersAndaDesktoppython>python test.py
Traceback (most recent call last):
File "C:UsersAndaDesktoppythontest.py", line 11, in <module>
main()
File "C:UsersAndaDesktoppythontest.py", line 5, in main
updater = Updater(TOKEN)
^^^^^^^^^^^^^^
TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
</code>
<code>(myenv) C:UsersAndaDesktoppython>python test.py
Traceback (most recent call last):
File "C:UsersAndaDesktoppythontest.py", line 11, in <module>
main()
File "C:UsersAndaDesktoppythontest.py", line 5, in main
updater = Updater(TOKEN)
^^^^^^^^^^^^^^
TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
</code>
(myenv) C:UsersAndaDesktoppython>python test.py
Traceback (most recent call last):
File "C:UsersAndaDesktoppythontest.py", line 11, in <module>
main()
File "C:UsersAndaDesktoppythontest.py", line 5, in main
updater = Updater(TOKEN)
^^^^^^^^^^^^^^
TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
New contributor
Shamshi Shu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.