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
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.
Читать полностью…as in the logs show, it's only disconnectingCannot get difference since the account is not logged in: UserDeactivatedError
Disconnecting
it's a bit annoying thing in telethon and can sometimes interfere with usual response returning or error propagation, but it shouldn't matter much as long as it's not getting stuck, show the exception and output you're getting if it's not working
It should be working then, because I can copy "link's message" in the groups that are giving me errors.
Читать полностью…As I am obvserving, there is no problem when the group is smaller than a certain ammount of users. But I have not discovered where is the "limit" or why it happens.
Читать полностью…depends on its type, PeerChannel won't be working with small groups, it's for supergroups
Читать полностью…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
Читать полностью…"small group" is a chat type, if you don't see copy link option on a message etc
you mustn't use PeerChannel for those, they are -id instead of -100id
My code works fine, but if I manage 200 or 300 accounts and want to participate in a giveaway, that code takes 8-10 seconds for each account. Halfway through the process, around the 150th account, I get this warning...
Читать полностью…ignoring things doesn't do any good, fix your code that causes it.
you can search about logging module and how or how to ignore certain keywords by a filter, the logger is in "telethon.network.mtprotostate", or disable the security feature at your own will /channel/TelethonChat/601714
how to ignore all telethon warnings
example: server send very old/new messages and more...
i used
import warnings
warnings.filterwarnings("ignore", category=Warning)