Skip to main content

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.

Premium

  • You can send files larger that 2GiB through Telegram

  • Premium users will have .premium in their user object

  • Premium stickers will also have .premium that might need dealing if you don’t have subscription.

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
))

WebView Button

You 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 button

from telethon import Button
client.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 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)

Extra

Added client.get_gallery(message), which fetches all the grouped messages belonging to it.

client.get_participant(chat, aggressive=True, sleep=2)

Release files for newthon 1.28.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for newthon 1.28.5
File Interpreter ABI Platform
newthon-1.28.5-py3-none-any.whl Python 3 none any Details

Release files / newthon-1.28.5-py3-none-any.whl

Download URL newthon-1.28.5-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e6df4b3e63bc5bf95162471074dddc01184d8d9c8f5caf35c2cf42f4889d00f5
BLAKE2b-256 checksum
How to use checksums
df3f31e4d47db018a9b72cc8397388cbfeefaf4a79003dc94281d890635ca8fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release history Release notifications | RSS feed

This release

1.28.5 This release

1 release file

1.28.1

1 release file

1.28.0

1 release file

1.27.9

1 release file

1.27.6

1 release file

1.27.5

1 release file

1.27.4

1 release file

1.27.3

1 release file

1.27.2

1 release file

1.27.1

1 release file

1.27.0

1 release file

1.26.10

1 release file

1.26.9

2 release files

1.26.4

1 release file

1.26.3

1 release file

1.26.2

1 release file

1.26.0

1 release file

1.25.7

2 release files

1.25.6

2 release files

1.25.5

2 release files

1.25.0

2 release files

1.2.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page