pythontelegrambotgroup | Unsorted

Telegram-канал pythontelegrambotgroup - >>> telegram.Bot()

11054

This group is for questions, answers and discussions around the python-telegram-bot library. Off-topic group: @pythontelegrambottalk | Website: https://python-telegram-bot.org

Subscribe to a channel

>>> telegram.Bot()

Wiki of python-telegram-bot - Category FAQ
My bot doesn't receive messages from groups. Why?

Читать полностью…

>>> telegram.Bot()

Hi, I’m trying to get the tutorial in https://docs.python-telegram-bot.org/en/v21.0.1/examples.echobot.html to work and I copy-pasted the code. The /start and /help commands both work, but if I send a non-command text the echo function doesn’t trigger. Adding a logging statement where the update_queue is consumed at https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/ext/_application.py#L1179, I can see that any arbitrary command I send is picked up (not just /start and /help) but non-commands don’t show up at all. Any idea what might be the issue?

Читать полностью…

>>> telegram.Bot()

telegram.ext.ApplicationBuilder.arbitrary_callback_data
Parameter arbitrary_callback_data of telegram.ext.ExtBot
Parameter maxsize of telegram.ext.CallbackDataCache
arbitrarycallbackdatabot.py

Читать полностью…

>>> telegram.Bot()

but my question is solved now anyway

Читать полностью…

>>> telegram.Bot()

hey, does arbitrary_callback_data has a limit on the number of items it caches?

Читать полностью…

>>> telegram.Bot()

Wiki of python-telegram-bot - Category Networking
Handling network errors

Читать полностью…

>>> telegram.Bot()

i am trying to upload file with bot.send_document but i keep running into exceptions. i have tried everything i could think of . the error is The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/telegram/request/_httpxrequest.py", line 276, in do_request
res = await self._client.request(
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1574, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1661, in send
response = await self._send_handling_auth(
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects
response = await self._send_single_request(request)
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_client.py", line 1763, in _send_single_request
response = await transport.handle_async_request(request)
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_transports/default.py", line 372, in handle_async_request
with map_httpcore_exceptions():
File "/usr/local/python/3.10.13/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/codespace/.local/share/virtualenvs/simpletap-WA04qNPT/lib/python3.10/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadTimeout

Читать полностью…

>>> telegram.Bot()

https://hastebin.com/share/etihuciqix.ruby

Читать полностью…

>>> telegram.Bot()

Hmmm, feels like a bug in the library to me, this should be handled properly. Mind creating a mwe and I can debug further later

Читать полностью…

>>> telegram.Bot()

Hi, I want to trigger a command every day at a specific time
but I don't understand how
I read the https://docs.python-telegram-bot.org/en/stable/examples.timerbot.html timerbot example
but I don't understand how to check if time has passed

Читать полностью…

>>> telegram.Bot()

My Guess is that you have app.run_polling() they is bpocking on main and After that you have and updater.run_polling() forgotten somewhere

Читать полностью…

>>> telegram.Bot()

Nothing changed means you got the same error?

Читать полностью…

>>> telegram.Bot()

https://docs.python.org/3/library/asyncio.html

Читать полностью…

>>> telegram.Bot()

app.run_polling is not an async function.

Читать полностью…

>>> telegram.Bot()

u should await Updater.start_polling

Читать полностью…

>>> telegram.Bot()

commands both work, but if I send a non-command text the echo function doesn’t trigger You can find an explanation of @roolsbot's functionality on 'GitHub.

Читать полностью…

>>> telegram.Bot()

this question does not have a general answer. much relies on how you use the concurrency features of PTB. but glad to hear that you solved your problem :)

Читать полностью…

>>> telegram.Bot()

Yes. See the docs of +AppBuilder.arbitray_callback_data+, +ExtBot.param.arbitrary_callback_data+, +CDC.param.maxsize+ and also the wiki page on +arbitray callback_data+. !search

Читать полностью…

>>> telegram.Bot()

in most of places in ptb docs, they specify like
if block = False then you can't rely on building custom context.
with that
there are
arbitary calbacks
concurrent updates
non blocking handlers
custom context
groups of handler

so , not all features can be used together, it's hard to find which combos break, that's why I asked like that.

Читать полностью…

>>> telegram.Bot()

Hey. In order for someone to be able to help you, you must ask a good technical question. Please read this short article and try again ;)

Читать полностью…

>>> telegram.Bot()

you're in this gorup long enough to know this: Please post code or tracebacks using a pastebin rather than via plain text or a picture. https://pastebin.com/ is quite popular, but there are many alternatives out there. Of course, for very short snippets, text is fine. Please at least format it as monospace in that case.

Читать полностью…

>>> telegram.Bot()

does this combo work?
block=True,concurrent updates & groups?

Читать полностью…

>>> telegram.Bot()

Hey. Please provide a minimal working example (MWE). Have a look at Minimal Working Example (MWE) if you need help.

Читать полностью…

>>> telegram.Bot()

ext.JobQueue.run_daily
python-telegram-bot documentation for this method:
telegram.ext.JobQueue.run_daily

Читать полностью…

>>> telegram.Bot()

I checked. Only app.run_polling is called.

Читать полностью…

>>> telegram.Bot()

There is no such thing in v20

Читать полностью…

>>> telegram.Bot()

v20 release notes and probably some discussion about it on the repo

Читать полностью…

>>> telegram.Bot()

Where I can read why PTB goes to async? What's the point?

Читать полностью…

>>> telegram.Bot()

I'm not using Updater.start_polling. I'm using app.run_polling.

Читать полностью…

>>> telegram.Bot()

Hi.
I want to check the connection to my database in a post_init function, and do other actions such as creating indexes on the db as well. And if the database is not connected, I want to shutdown the program.

My current code is this:

async def post_init(app: Application) -> None:
try:
await MongoDB().create_indexes()
except Exception as e:
logger.error(msg=f"Error Creating Indexes: {e}")

logger.critical(msg="Shutting down the bot due to error in post_init.")

sys.exit(1)

await app.bot.send_message(
chat_id=DEVELOPER_CHAT_ID,
text="Bot Started Successfully.",
)


But next to shutting down, I get the error:

sys:1: RuntimeWarning: coroutine 'Updater.start_polling' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback


What should I do about this? What is the correct way to shut down the program in post_init. The wiki guides suggests using app.stop_running, but I don't think that works here, and when I tried it nothing changed.

Читать полностью…
Subscribe to a channel