telethonchat | Unsorted

Telegram-канал telethonchat - Telethon Chat

6097

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

Dude explain what do you want to achieve

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

Telethon Chat

When i try to GetFullUser to newly created bot id i get error ValueError: Could not find the input entity for PeerUser(user_id=7828538638) (PeerUser), but when i try to GetFullUser with bot username everything is good, but if i do it too fast i got UserFull object with previously created bot info

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

Telethon Chat

Can telethon send photo album information? It's the photo album I edited myself.

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

Telethon Chat

ah i see. thanks! makes sense now

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

Telethon Chat

.delete() is for Messages and reply_to isnt a Message

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

Telethon Chat

/channel/TelethonChat/549521

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

Telethon Chat

Hi, how i can get all the join requests from a private channel?

im trying with this function:

result = client(functions.messages.GetChatInviteImportersRequest(
peer='username',
offset_date=datetime.datetime(2018, 6, 25),
offset_user='username',
limit=100,
requested=True,
subscription_expired=True,
link='some string here',
q='some string here'
))


but i can't get all of them without using a offset_user. (i don't have one)

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

Telethon Chat

read the docs of get_chat_members and then pass proper enums to filter

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

Telethon Chat

it doesn't work! ttl_period=None

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

Telethon Chat

Then the program stops

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

Telethon Chat

yes, because this group is for telethon only, and the error may be pyrogram-related

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

Telethon Chat

please stay on topic

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

Telethon Chat

This is a non-pyrogram Telethon library group

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

Telethon Chat

This is telethon chat

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

Telethon Chat

Can someone help me code this?
I want to collect information about those who are banned from joining a specific channel, but this error appears

error: 'str' object has no attribute 'value'

code:
from pyrogram import Client, filters
from pyrogram.errors import ChatAdminRequired, PeerIdInvalid
from pyrogram.types import Message

API_ID =
API_HASH = .
BOT_TOKEN = .

app = Client("ooo", api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)


@app.on_message(filters.command("Get") & filters.private)
async def banned(client: Client, message: Message):
if len(message.command) < 2:
await message.reply("Please specify the channel username after the command.")
return

channel_username = message.command[1].strip()
banned_users_file = "banned_users.txt"

try:
banned_user_ids = []


if not isinstance(channel_username, str) or not channel_username.startswith("@"):
await message.reply("Make sure to enter the channel username correctly (starting with @).")
return


async for member in client.get_chat_members(channel_username, filter="banned"):

if member.user:
banned_user_ids.append(str(member.user.id))
else:
print("Member without user attribute:", member)


with open(banned_users_file, "w") as file:
file.write("\n".join(banned_user_ids))

await message.reply("User IDs have been collected. Sending the file...")


await client.send_document(chat_id=message.chat.id, document=banned_users_file)

except ChatAdminRequired:
await message.reply("The bot needs admin privileges in the channel with permission to ban members.")
except PeerIdInvalid:
await message.reply("Invalid channel username. Please enter it correctly.")
except Exception as e:

print(f"Error: {e}")
await message.reply(f"An error occurred: {str(e)}")

app.run()

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

Telethon Chat

Any solutions? Or just add asyncio.sleep() to wait for update info?

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

Telethon Chat

explain more
I couldn't recognise what have you meant of 'information'
Did you mean 'description' ?

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

Telethon Chat

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.

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

Telethon Chat

reply message isn't sent by server, so you would need to do await message.get_reply_message(), but it's a waste of request and reply message could already be deleted anyways and since delete_messages doesn't raise error for that case it's shorter to delete right away by id.

.reply_to isn't library property, it's a raw api thing, which can be None

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

Telethon Chat

was that a concious decision to not include message.reply_to.delete()?

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

Telethon Chat

if message.is_reply:
await self.bot.client.delete_messages(message.chat_id, message.reply_to_msg_id)

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

Telethon Chat

Whats the best way to delete a replied to message? await message.reply_to.delete() does not work. do i have to get the message.reply_to_msg_id and delete that manually?
something like

if hasattr(message, 'reply_to'): await self.bot.client.delete(message.reply_to_msg_id)

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

Telethon Chat

you won't know it unless a chat was initiated with you or send a message to them, for obvious privacy reasons

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

Telethon Chat

telegram simply does not allow fetching all members

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

Telethon Chat

I tried the same code on Telethon, but there is an error: it collects only 10% of the information of banned people.

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

Telethon Chat

Is there any objection to asking for help with a pyrogram library since it is the same method for making a telethon?

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

Telethon Chat

Hey Ai, don't do that again (offtopic, insults, unnecessarily tagging admins) or I will ban you. You have been warned.

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

Telethon Chat

The captcha bot in the Pyrogram group is broken. Please help or remain silent

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

Telethon Chat

@disk6969

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

Telethon Chat

oh sound great, i'm gonna try it

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