Package: newthon
Forked Telethon↗️ Updated tl.telethon.dev+-----------------------+|Telethon1.24.0|+-----------------------+|layer:148|+-----------------------+AboutA simple clone of the awesome Telegram MTproto client version 1.24.0 but with up to date components,
You do not have to change previous code with telethon, as there are no breaking changes.install: (if any issues, try uninstalling telethon first):pipinstall-UnewthonEmail loginAddedemail_codeargument toclient.sign_in()to login via code if sent to mail.Reactions and statusAddedclient.set_status(document_id, until)for premium accounts’CustomEmojiin profile.
Addedadd_to_recentargument for reactions.About reactions:client.send_reaction(chat,message,"😢")or shorter:message.react("😁",big=True)Reactions with large animation (for pms)big=True.
To remove a reaction usemessage.react(remove=True), and, to add a react to recents too, useadd_to_recentas True.PremiumYou can send files larger that 2GiB through TelegramPremium users will have .premium in their user objectPremium stickers will also have .premium that might need dealing if you don’t have subscription.spoilers and custom emojiUse||Text||to create spoilers, for HTML use<tg-spoiler>Text</tg-spoiler>to create a customEmoji markdown use<emoji id=”5373101475679443553”>😉</emoji>.
the id being the document id of any CustomEmoji Document.id in its pack.Requests of join and events for ChatAction eventsevent.new_invite (only for bot accounts)@bot.on(events.ChatAction(func=lambdae:e.new_join_request))asyncdef_(event):event.approve_user(approved=TrueorFalse)event.new_approve for user accounts@client.on(events.ChatAction(func=lambdae:e.new_approve))asyncdef_(event):event.approve_user(approved=True/False)using raw api to accept old requestsGetting themresult=client(functions.messages.GetChatInviteImportersRequest(peer="chat",offset_date=None,offset_user=telethon.tl.types.InputUserEmpty(),limit=1000))manual approveforainresult:client(functions.messages.HideChatJoinRequestRequest(peer='chat or username',user_id='To-approve',approved=TrueorFalse))batch approve:client(functions.messages.HideAllChatJoinRequestsRequest(peer=entity,approved=TrueorFalse))WebView ButtonYou can input a web bot button as an inline button or a keyboard button, sine it can be both.
the default is inline button, you can use the inline=False to use it in a keyboard buttonfromtelethonimportButtonclient.send_message(chat,"Open Google",buttons=Button.web("google","https://google.com")note that webapp keyboard can be only a single button, it won’t allow others with it.client.send_message(chat,"YouTube",buttons=Button.web("google","https://YouTube.com",inline=False)Content privacychat.noforwardswill return True for chats with forward restriction enabled, same applies to bot messages withmessage.noforwardsYou can use the argumentnoforwards=Truein sender methods.client.send_message(chat,"lonami is god",noforwards=True)links in get messageYou can now get a single message using the link in get/iter_messages.client.get_messages("https://t.me/username/1")The message object will also have .link attribute, which will return link of the messageExtraAdded client.get_gallery(message), which fetches all the grouped messages belonging to it.client.get_participant(chat,aggressive=True,sleep=2)