Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to PTB 20.0 #74

Open
Ericktz opened this issue Jan 28, 2023 · 2 comments
Open

Migrate to PTB 20.0 #74

Ericktz opened this issue Jan 28, 2023 · 2 comments

Comments

@Ericktz
Copy link

Ericktz commented Jan 28, 2023

I have been trying to migrate the bot to Python Telegram Bot v20.0... but I have been having problems with not being able to pass the classes correctly... I would appreciate some help...

One of the problems is that in the functional version here uses PTB v5.0... the bot is initialized with

updater = Updater(bot=TwitterForwarderBot(token, twapi))
dispatcher = updater.dispatcher
# set commands
dispatcher.add_handler(CommandHandler('start', cmd_start))

and now (v20) the ApplicationBuilder() is used, and I don't know how to start the class that forwards with the new bot instance form

application = ApplicationBuilder().token(token).build()
application.add_handler(CommandHandler("start", start))
@franciscod
Copy link
Owner

Hmm... It might be easier to swap PTB 5.0 for something small like aiotg rather than the whole PTB 20.0.

This was written at a time where PTB was simple and fit in my head :)

@Ericktz
Copy link
Author

Ericktz commented Jan 30, 2023

I totally understand Fransisco, and I appreciate a lot that you shared the code... I have seen several bots on telegram using your code... which by the way is still working your instance of the bot, but with some lags, every so often it crashes... and all the tweets arrive late.

I've had to make some tinker modifications to make it functional in the new telegram topics....

I was able to make it functional... but I would have liked to have used the new PTB20 functions, such as running a message once a day.... Job_Queue.run_daily... but I have not been able to .... I hope to try again when I have more time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants