now my code looks like this:
@client.on(events.NewMessage(chats=-1002160123806))
@client.on(events.Album(chats=-1002160123806))
async def handler(event):
messages = ["bb", "ponyatno", "kruto",
"ANTONY GOAT", "ashaletttt 🔥", "imbaa"]
# Check if the message is from the user with ID 123
if event.sender_id == 6341937942:
random_message = random.choice(messages)
if hasattr(event, 'messages') and event.grouped_id:
return await event.reply(random_message, reply_to=event.messages[0].id)
else:
# Reply to the user
return await event.reply(random_message, reply_to=event.message.id)
This issue has already been fixed, but it's not yet available in PyPi. You can upgrade now with pip3 install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
.
yes, but telethon's markdown or html doesn't support it. you need a custom parsemode. the wiki has examples
Читать полностью…tell me, can I get the user entity by id and acces hash?
if I got this information from another account.
Telethon is free software. That means using it is a right: you are free to use it for absolutely any purpose whatsoever. However, help and support with using it is a privilege. If you misbehave or want to do bad things, despite possibly having good intentions, nobody is obligated to help you.
Читать полностью…why i get this exception? use only official pairs
telethon.errors.rpcerrorlist.ApiIdPublishedFloodError: This API id was published somewhere, you can't use it now (caused by SendCodeRequest)Читать полностью…
reply_to is the msg id to reply to, not the user to reply to
you cannot reply to users. you can only reply to messages, perhaps sent by users
use event.reply instead or event.respond, and remove reply_to
Hi and welcome to the group. Before asking any questions, please read the rules from the group's description, and don't forget to read the docs. Make sure you are using the latest version with pip3 install -U telethon
, since most problems have already been fixed in newer versions.
When I try to connect with invalid proxy I get such exception:
...
File "C:\Users\jexu\Documents\projects\spammer-bot\venv\Lib\site-packages\python_socks\async_\asyncio\_proxy.py", line 108, in _connect
raise ProxyError(e, error_code=e.error_code)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ConnectionError() takes no keyword arguments
except ReplyError as e:
await stream.close()
raise ProxyError(e, error_code=e.error_code)
class ProxyError(Exception):
def __init__(self, message, error_code=None):
super().__init__(message)
self.error_code = error_code
Access hash of some entity is different for any account ,
Otherwise id is same for all and you can use it with any account.
However it might occur some PeerId error or something...
unless you want to message user['id'], in which case you can use neither respond nor reply. you must use send_message to send it to them in their chat (and there, it's likely there's nothing to reply to)
Читать полностью…The id from the database completely matches the user's id. This is not the message id.
Читать полностью…