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
When creating a supegroup is it possible to add an admin or client.edit_admin()
is only way ?
You can retrieve registration_month, phone_country, photo_change_date, and name_change_date using the Telethon Raw method, but only for users who have sent you a message first.
from telethon.tl.functions.messages import GetPeerSettingsRequestЧитать полностью…
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
peer = await client.get_entity("ankify")
settings = await client(GetPeerSettingsRequest(peer))
print(settings)
^exec async
from telethon.tl.functions.messages import GetPeerSettingsRequest
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
peer = await client.get_entity("ankify")
settings = await client(GetPeerSettingsRequest(peer))
print(settings)
Update:
At the end, it just worked. There was an exagerated delay in bigger groups, but finally it worked.
Now, a new problem is that it appears to be a "limit" in 10.000 usernames. I think that it may be something related to the cappacity of a JSON, but I think there are still a lot bytes to fill the document in the creation.
I will try to debug it manually and keep the update.
is there a method for sending the random greet sticker telegram suggests upon messaging in an empty private chat?
Читать полностью…If telegram bans an account
Can a release be requested
Sorry my other account got reported (i was afk and idk really how (shitty tg))
https://pastebin.mozilla.org/VSs9w4ZH
hi, why telegram kicked telethon sessions? ( after <1 minute )
Читать полностью…a bot will never get album events from other bots, youve already been told this
Читать полностью…Why account gets UserDeactivatedBanError when trying to add an admin via client.edit_admin() method ? Are there any ways to avoid this ? I am not spamming any way, I am just trying to add one admin to a group.
Error usually says caused by ResolveUsernameRequest
since second exception is triggering, connection failed or something Exception can't handle, start by not printing errors and use traceback.print_exc() module, or at least the type(error_)
Читать полностью…so is there any limitation of users? Because it's only happening for groups of more than 6000 users or something like that.
Читать полностью…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.
Executed Code 👑
from telethon.tl.functions.messages import GetPeerSettingsRequest
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
peer = await client.get_entity("ankify")
settings = await client(GetPeerSettingsRequest(peer))
print(settings)
PeerSettings(settings=PeerSettings(report_spam=True, add_contact=True, block_contact=True, share_contact=False, need_contacts_exception=True, report_geo=False, autoarchived=True, invite_members=False, request_chat_broadcast=False, business_bot_paused=False, business_bot_can_reply=False, geo_distance=None, request_chat_title=None, request_chat_date=None, business_bot_id=None, business_bot_manage_url=None, charge_paid_message_stars=None, registration_month='05.2015', phone_country='IN', name_change_date=None, photo_change_date=None), chats=[], users=[])Читать полностью…
it's something like that
just consider any error as suffering from success and move on
it may or may not, depends on what you did with the accounts
session revoking or ban aren't related to library more than it's related to you
But it is sometimes, and now I discover even more wired thing, if the Album sent to the group by the owners it's recognizing but if by manger it's not!!
Читать полностью…I update to 1.39 and it's partly solve it but still albums that can from other bot(not user bot) not recognized
Here's the code :
client = TelegramClient(session='forwarder.session', api_hash=api_hash, api_id=api_id, proxy=(python_socks.ProxyType.HTTP, config.proxy_ip, config.proxy_port))Читать полностью…
@client.on(events.Album(chats=ids1.SRC_CHANNELS))
async def albums_handler(event: events.Album.Event):
dest_channels = False
if event.grouped_id:
try:
messages = getattr(event, 'messages', None)
if not messages and event.grouped_id:
return
caption = None
print("Album found")
count = 0
message_count = len(messages)
for i in range(message_count):
print(count, message_count)
caption = messages[count].raw_text
if not caption:
count += 1
else:
break
if not caption:
return
for enti in ids1.DEST_CHANNELS:
try:
await client.send_file(entity=enti, file=messages, caption=caption)
await asyncio.sleep(5)
except Exception as e:
print(f"Faild to send to {enti}: {e}")
continue
dest_channels = chat_id_filter(caption)
if dest_channels is not False:
for chan in dest_channels:
try:
enti = await client.get_entity(chan)
await client.send_file(entity=enti, file=messages, caption=caption)
await asyncio.sleep(10)
except Exception as e:
print(f"Faild to send to {chan}: {e}")
continue
except Exception as e:
print(f"Error in forwarding album: {e}")
else:
return
@client.on(events.NewMessage(chats=ids1.SRC_CHANNELS))
async def messages_handler(event: events.NewMessage.Event):
if event.grouped_id:
return
print("image message found")
try:
text = event.raw_text
if not text:
return
for enti in ids1.DEST_CHANNELS:
try:
await client.send_file(entity=enti, caption=text, file=event.message)
await asyncio.sleep(1.5)
except Exception as e:
print(f"Faild to send to {enti}: {e}")
continue
dest_channels = chat_id_filter(text)
if dest_channels is not False:
for chan_id in dest_channels:
try:
await client.send_file(entity=chan_id, file=event.message, caption=text)
await asyncio.sleep(1.5)
except Exception as e:
print(f"Faild to send to {chan_id}: {e}")
continue
else:
return
except Exception as e:
print(f"Error in forwarding message: {e}")
Show your code, NewMessage mustn't affect Album handler
or increase the gathering duration /channel/TelethonChat/646813 if it's works out
you'll have to debug where the problem is, it's unrelated to the piece of code you show if it's not erroring
Читать полностью…