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

uploaded = await client.upload_file(first_sticker_path)

# 2. Оборачиваем в InputDocumentUploaded
doc_uploaded = InputDocument(
id = uploaded.id,
access_hash = 1
)


what`s wrong?

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

Telethon Chat

Get updated premium member count telethon

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

Telethon Chat

How to identify that dialogs is group, channel or Telegram?

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

Telethon Chat

cmdRes['buttons'] = [] (empty array)

so buttons=None is being sent

but I also tried that Button.clear() thingy

and client.edit_message

and removing the event.answer()

none of them fixed it

buttons do get override tho when there are buttons

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

Telethon Chat

What about callback query

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

Telethon Chat

Iter.messages is restricted for bots, which is enable for bots?

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

Telethon Chat

@disk6969

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

Telethon Chat

How to clone session with qr login ?

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

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

analyzing the id but it will need time and many tests

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

Telethon Chat

Documentation for qr_login

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

Telethon Chat

The key is not registered in the system (caused by AcceptLoginTokenRequest)

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

Telethon Chat

How to clone session with qr login ?

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

Telethon Chat

events.NewMessage takes a from_users parameter

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

Telethon Chat

from telethon import TelegramClient, events

# API credentials
API_ID =
API_HASH =

# Configuration
GROUP_ID = None # Set to None initially, will use the group ID or name later
GROUP_NAME = '' # Name of the group
TEXT_TO_SEND = '+' # Text to send

# Initialize the Telegram client
client = TelegramClient('userbot', API_ID, API_HASH)

async def get_group():
"""Find the group by name or ID."""
global GROUP_ID
if isinstance(GROUP_ID, int): # If it's already set to an ID, we don't need to search
print(f"Group ID identified: {GROUP_ID}")
return GROUP_ID

async for dialog in client.iter_dialogs():
if dialog.name == GROUP_NAME: # Check if the group name matches
GROUP_ID = dialog.id # Save the group ID
print(f"Group found: {GROUP_NAME} (ID: {GROUP_ID})")
return GROUP_ID

print(f"Error: '{GROUP_NAME}' group not found. Make sure the bot is a member of the group!")
return None


@client.on(events.NewMessage())
async def monitor_group(event):
"""Monitor incoming messages and send predefined text if the message is from the specified group."""
global GROUP_ID
if not GROUP_ID:
return # If the group ID is not found, exit

if event.chat_id == GROUP_ID: # Only process messages from the specified group
print(f"New message received: Message: {event.raw_text}")

# Send the predefined text to the group
await client.send_message(GROUP_ID, TEXT_TO_SEND) # Send the predefined text to the group
print("Text sent!")

# Stop the client and disconnect after sending the message
await client.disconnect()
print("Bot stopped.")

async def main():
"""Main function: Find the group and start monitoring for messages."""
print("Userbot starting. Searching for group...")
await get_group() # Search for the group by name or ID
if GROUP_ID:
print(f"Group ID: {GROUP_ID}")
print("Message monitoring started...")
await client.run_until_disconnected() # Keep the bot running and listening for messages

# Start the client
with client:
client.loop.run_until_complete(main())



How to modify event handler getting new messages only handle when get message from specific senders and reply the message received with +

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

Telethon Chat

TL Reference for GetBoostsStatus

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

Telethon Chat

.is_user
.is_group
.is_channel

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

Telethon Chat

/channel/TelethonChat/647372

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

Telethon Chat

The same process applicable

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

Telethon Chat

dont understand why it returns 404 not found error, i did all steps as to send dh params

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

Telethon Chat

How can I use the stripped_thumb and convert it to image to then insert it in website ?

I tried via base64 but the image is broken

UserProfilePhoto(
photo_id=123,
dc_id=5,
has_video=False,
personal=False,
stripped_thumb=b'\x01\x08\x08A\x8f$\xfc\x89\xbb\xd4\x1e3\xf4\xa2\x8a*.]\x8f'
),

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

Telethon Chat

Documentation for qr_login

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

Telethon Chat

Show the error for first, and GetFullUser's .full_user.birthday for the second before and after making the request

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

Telethon Chat

what do I have to pass as year in update birthday to achieve having no year? when I pass nothing I get error and when I don't put the year argument it doesn't update my birthday

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

Telethon Chat

yes but it's not related to telethon

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

Telethon Chat

How to clone session with qr login ?

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

Telethon Chat

Documentation for qr_login

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

Telethon Chat

events.NewMessage.Event object has .reply function

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

Telethon Chat

Documentation for events.NewMessage

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

Telethon Chat

/channel/TelethonSnippets2/16

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