Official Telethon's chat! Rules: • Speak English • Stay on topic (questions about Telethon) • Be respectful • Don't ask to ask • Spam-related uses lead to ban • Read https://docs.telethon.dev before asking things here Read more about us @TelethonUpdates
I`cant, if user just comment the post in channel, without joining discussion chat
Читать полностью…How can I ban or edit user permissions in channel`s discussion?
Читать полностью…from module import my_thing, my_other_thingЧитать полностью…
def test_my_thing(fixture):
assert my_thing(fixture) == 42
@pytest.mark.asyncio
async def test_my_thing(event_loop):
assert await my_other_thing(loop=event_loop) == 42
doesn't matter, if emoji in a string is failing to be represented, it's python issue, try to print(msg.message.encode('utf-8').decode('utf-8'))
Читать полностью…Not event.message.message.
Just
msg = await client.get_messages(event.message.peer_id, ids=event.message.reply_to.reply_to_msg_id)Читать полностью…
print(msg.message)
not replying to you, and as for your encoding issue, you haven't set your encoding right it's python issue
try to
sys.stdin.reconfigure(encoding='utf-8')
sys.stdout.reconfigure(encoding='utf-8')
I get replied message and get message.message from it. Maybe event.raw_text ignore this
Читать полностью…you can do type checking
chat = await client.get_input_entity(chat_id)Читать полностью…
if isinstance(chat, telethon.types.InputPeerChat):
await client.kick_participant(...)
else:
await client.edit_permissions(...)
usually, as any chat, where do you get the user from?
Читать полностью…Hello, how can i write autotests using telethon? I would like to catch events but how i can do it inside test? Docs says only this:
```python
from module import my_thing, my_other_thing
def test_my_thing(fixture):
assert my_thing(fixture) == 42
@pytest.mark.asyncio
async def test_my_thing(event_loop):
assert await my_other_thing(loop=event_loop) == 42
```
That's not related to anything, just put some print around, see which line isn't getting reached, you will also know if something is erroring
Читать полностью…from telethon import Buttons and should he earn it?
Читать полностью…Sorry.
I use this encoding everytime, everything works
Have you heard of prints, if it's in a thread or something show the code properly
Читать полностью…How can U get message.message, if u have some emoji in it? I have an error
UnicodeEncodeError: 'charmap' codec can't encode characters in position 31-32: character maps to <undefined>Читать полностью…
Then, Is it correct?
try:Читать полностью…
# kick user from supergroup or channel
await client.kick_participant(chat_id, user_id)
except ValueError:
# kick user from small group
await client.edit_permissions(chat_id, user_id, timedelta(days=800), send_messages=False, view_messages=False, invite_users=False)