An edited 1.24.0 version of the full-featured Telegram client library for Python 3
Project description
Forked Telethon
+-----------------------+
| Telethon 1.24.0 |
+-----------------------+
| layer: 145 |
+-----------------------+
About
A 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):
pip install -U newthon
Email login
Added email_code argument to client.sign_in() to login via code if sent to mail.
Reactions and status
Added client.set_status(document_id, until) for premium accounts’ CustomEmoji in profile. Added add_to_recent argument 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 use message.react(remove=True), and, to add a react to recents too, use add_to_recent as True.
spoilers and custom emoji
Use ||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 events
event.new_invite (only for bot accounts)
@bot.on(events.ChatAction(func=lambda e : e.new_join_request))
async def _(event):
event.approve_user(approved=True or False)
event.new_approve for user accounts
@client.on(events.ChatAction(func=lambda e : e.new_approve))
async def _(event):
event.approve_user(approved=True/False)
using raw api to accept old requests
Getting them
result = client(functions.messages.GetChatInviteImportersRequest(
peer="chat",
offset_date=None,
offset_user=telethon.tl.types.InputUserEmpty(),
limit=1000
))
manual approve
for a in result:
client(functions.messages.HideChatJoinRequestRequest(
peer='chat or username',
user_id='To-approve',
approved=True or False
))
batch approve:
client(functions.messages.HideAllChatJoinRequestsRequest(
peer=entity,
approved=True or False
))
Content privacy
chat.noforwards will return True for chats with forward restriction enabled, same applies to bot messages with message.noforwards You can use the argument noforwards=True in sender methods.
client.send_message(chat, "lonami is god", noforwards=True)
links in get message
you 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 message
iter_participant
aggressive True will sleep by default. its sleep value can be adjusted using the sleep parameter, this will make it sleep for that specified amount before processing next chunk.
client.get_participant(chat, aggressive=True, sleep=2)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file newthon-1.27.9-py3-none-any.whl
.
File metadata
- Download URL: newthon-1.27.9-py3-none-any.whl
- Upload date:
- Size: 2.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3861973009474c4fb259109ea54feca7d996dd80a86cf10d52ddeda851abc2c2 |
|
MD5 | 5719a0836c313c22278b0509efc980b3 |
|
BLAKE2b-256 | ef830c280c7044246e2737a94a056cee48ce14939647453c90b76d69385c9957 |