telethonchat | Unsorted

Telegram-канал telethonchat - Telethon Chat

6095

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

Subscribe to a channel

Telethon Chat

I`cant, if user just comment the post in channel, without joining discussion chat

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

Telethon Chat

How can I ban or edit user permissions in channel`s discussion?

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

Telethon Chat

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

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

Telethon Chat

code markdown:

```python at the top

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

Telethon Chat

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'))

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

Telethon Chat

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)

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

Telethon Chat

well your event.message.message doesn't

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

Telethon Chat

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')

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

Telethon Chat

I get replied message and get message.message from it. Maybe event.raw_text ignore this

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

Telethon Chat

# -*- coding: utf-8 -*-

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

Telethon Chat

I decide just not to use emoji

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

Telethon Chat

can u show full code?

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

Telethon Chat

It doesn't show me anything :(

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

Telethon Chat

what can be used except event.raw.text?

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

Telethon Chat

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(...)

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

Telethon Chat

usually, as any chat, where do you get the user from?

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

Telethon Chat

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
```

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

Telethon Chat

and

``` at down

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

Telethon Chat

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

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

Telethon Chat

from telethon import Buttons and should he earn it?

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

Telethon Chat

do I need to import buttons?

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

Telethon Chat

Sorry.

I use this encoding everytime, everything works

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

Telethon Chat

Have you heard of prints, if it's in a thread or something show the code properly

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

Telethon Chat

but in event.raw_text not ignore emojis?

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

Telethon Chat

which encoding did you indicate it with

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

Telethon Chat

But I indicate encoding at the top of the code

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

Telethon Chat

my code is in a block try

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

Telethon Chat

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>

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

Telethon Chat

not work
i dont know why

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

Telethon Chat

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)

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