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

feat: detect concurrent polling/webhook setups and throw error #646

Merged
merged 5 commits into from
Oct 21, 2024

Conversation

KnorpelSenf
Copy link
Member

People sometimes do

webhookCallback(bot)
bot.start()

or

bot.start()
webhookCallback(bot)

and in 99 % of cases, this is just wrong.

This PQ interdicts this type of usage and throws a helpful error message.

If this is actually desired (run the bot on built-in polling but then also supply old updates from a webhook queue, whatever) then it can be done anyway:

const middleware = new Composer()
middleware.use(..) // etc

const pollingBot = new Bot(token)
const webhookBot = new Bot(token)
pollingBot.use(middleware)
webhookBot.use(middleware)

pollingBot.start()
webhookCallback(webhookBot)

@KnorpelSenf KnorpelSenf changed the title feat: detect concurrent polling/webhook setups and print warning feat: detect concurrent polling/webhook setups and throw error Oct 17, 2024
@KnorpelSenf KnorpelSenf merged commit f31feed into main Oct 21, 2024
6 checks passed
@KnorpelSenf KnorpelSenf deleted the warn-parallel-polling-webhook branch October 21, 2024 05:49
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

Successfully merging this pull request may close these issues.

2 participants