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
uploaded = await client.upload_file(first_sticker_path)
# 2. Оборачиваем в InputDocumentUploaded
doc_uploaded = InputDocument(
id = uploaded.id,
access_hash = 1
)
How to identify that dialogs is group, channel or Telegram?
Читать полностью…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
Iter.messages is restricted for bots, which is enable for bots?
Читать полностью…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.
analyzing the id but it will need time and many tests
Читать полностью…The key is not registered in the system (caused by AcceptLoginTokenRequest)
Читать полностью…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())
dont understand why it returns 404 not found error, i did all steps as to send dh params
Читать полностью…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'
),
Show the error for first, and GetFullUser's .full_user.birthday for the second before and after making the request
Читать полностью…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
Читать полностью…events.NewMessage.Event object has .reply function
Читать полностью…