Skip to main content

An edited 1.24.0 version of the full-featured Telegram client library for Python 3

Project description

Reactions

client.send_reaction(peer, message, "😢", big=False)

or shorter:

message.react("😁", big=True)

to send a reaction with animation(for pms) use big=True, and, to remove a reaction use remove=True:

message.react(remove=True)

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

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)

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)

spoilers

You can use ||Text|| to create spoilers, or, for HTML <tg-spoiler>Text</tg-spoiler>

to create underline markdown, use –Text–

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

newthon-1.26.9.tar.gz (490.7 kB view details)

Uploaded Source

Built Distribution

newthon-1.26.9-py3-none-any.whl (554.8 kB view details)

Uploaded Python 3

File details

Details for the file newthon-1.26.9.tar.gz.

File metadata

  • Download URL: newthon-1.26.9.tar.gz
  • Upload date:
  • Size: 490.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/21.8.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for newthon-1.26.9.tar.gz
Algorithm Hash digest
SHA256 ba77b0921b82684d2c44ddf5844f6d218cb7df7a1ca9bf56e030f4c351438895
MD5 d20df55a9dff9852783d5215eb6f5fb0
BLAKE2b-256 1e8ddd8e7f330d3755e54ca3232e6f0dae75baa112ad3786bcd5699e17010d8e

See more details on using hashes here.

File details

Details for the file newthon-1.26.9-py3-none-any.whl.

File metadata

  • Download URL: newthon-1.26.9-py3-none-any.whl
  • Upload date:
  • Size: 554.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/21.8.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.4

File hashes

Hashes for newthon-1.26.9-py3-none-any.whl
Algorithm Hash digest
SHA256 22a83faa68d26ba084f1122e60d733c308600423732475a8040e1ca6d6d8d3dd
MD5 4d3f11eb946b447cc8ee197ba2b2a7d0
BLAKE2b-256 0ca646f0530f151a3e8de2495bfe59279283a8f35cca6a436c67012bc557390a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page