mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Clarify some aspects of the documentation
This commit is contained in:
@@ -4,16 +4,21 @@
|
||||
Projects using Telethon
|
||||
=======================
|
||||
|
||||
This page lists some real world examples showcasing what can be built with
|
||||
the library.
|
||||
This page lists some **interesting and useful** real world
|
||||
examples showcasing what can be built with the library.
|
||||
|
||||
.. note::
|
||||
|
||||
Do you have a project that uses the library or know of any that's not
|
||||
listed here? Feel free to leave a comment at
|
||||
Do you have an interesting project that uses the library or know of any
|
||||
that's not listed here? Feel free to leave a comment at
|
||||
`issue 744 <https://github.com/LonamiWebs/Telethon/issues/744>`_
|
||||
so it can be included in the next revision of the documentation!
|
||||
|
||||
You can also advertise your bot and its features, in the issue, although
|
||||
it should be a big project which can be useful for others before being
|
||||
included here, so please don't feel offended if it can't be here!
|
||||
|
||||
|
||||
.. _projects-telegram-export:
|
||||
|
||||
telethon_examples/
|
||||
@@ -63,31 +68,6 @@ TelegramTUI
|
||||
|
||||
A Telegram client on your terminal.
|
||||
|
||||
spotify_telegram_bio_updater
|
||||
============================
|
||||
|
||||
`spotify_telegram_bio_updater <https://github.com/Poolitzer/spotify_telegram_bio_updater>`_ /
|
||||
`pooltalks' Telegram <https://t.me/pooltalks>`_
|
||||
|
||||
Small project that updates the biography of a telegram user according
|
||||
to their current Spotify playback, or revert it if no playback is active.
|
||||
|
||||
Telegram-UserBot
|
||||
================
|
||||
|
||||
`Telegram-UserBot <https://github.com/raphielgang/telegram-userbot>`_ /
|
||||
`baalajimaestro's site <https://baalajimaestro.ooo>`_
|
||||
|
||||
A modular telegram Python UserBot running on python3 with an sqlalchemy database.
|
||||
|
||||
kantek
|
||||
======
|
||||
|
||||
`kantek <https://github.com/mojurasu/kantek>`_ /
|
||||
`mojurasu's site <https://mojurasu.com>`_
|
||||
|
||||
kantek is a userbot written in Python using Telethon.
|
||||
|
||||
tgcloud
|
||||
=======
|
||||
|
||||
|
@@ -10,34 +10,15 @@ You can access the client that creates this event by doing
|
||||
events to find out what arguments it allows on creation and
|
||||
its **attributes** (the properties will be shown here).
|
||||
|
||||
It is important to remember that **all events subclass**
|
||||
`ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>`!
|
||||
.. important::
|
||||
|
||||
Remember that **all events base** `ChatGetter
|
||||
<telethon.tl.custom.chatgetter.ChatGetter>`! Please see :ref:`faq`
|
||||
if you don't know what this means or the implications of it.
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
ChatGetter
|
||||
==========
|
||||
|
||||
All events subclass `ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>`,
|
||||
which means all events have (and you can access to):
|
||||
|
||||
.. currentmodule:: telethon.tl.custom.chatgetter.ChatGetter
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
chat
|
||||
input_chat
|
||||
chat_id
|
||||
is_private
|
||||
is_group
|
||||
is_channel
|
||||
|
||||
get_chat
|
||||
get_input_chat
|
||||
|
||||
|
||||
CallbackQuery
|
||||
=============
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
.. _faq:
|
||||
|
||||
===
|
||||
FAQ
|
||||
===
|
||||
@@ -177,6 +179,32 @@ won't do unnecessary work unless you need to:
|
||||
sender = await event.get_sender()
|
||||
|
||||
|
||||
What does "bases ChatGetter" mean?
|
||||
==================================
|
||||
|
||||
In Python, classes can base others. This is called `inheritance
|
||||
<https://ddg.gg/python%20inheritance>`_. What it means is that
|
||||
"if a class bases another, you can use the other's methods too".
|
||||
|
||||
For example, `Message <telethon.tl.custom.message.Message>` *bases*
|
||||
`ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>`. In turn,
|
||||
`ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>` defines
|
||||
things like `obj.chat_id <telethon.tl.custom.chatgetter.ChatGetter>`.
|
||||
|
||||
So if you have a message, you can access that too:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# ChatGetter has a chat_id property, and Message bases ChatGetter.
|
||||
# Thus you can use ChatGetter properties and methods from Message
|
||||
print(message.chat_id)
|
||||
|
||||
|
||||
Telegram has a lot to offer, and inheritance helps the library reduce
|
||||
boilerplate, so it's important to know this concept. For newcomers,
|
||||
this may be a problem, so we explain what it means here in the FAQ.
|
||||
|
||||
|
||||
Can I use Flask with the library?
|
||||
=================================
|
||||
|
||||
|
@@ -13,6 +13,48 @@ to find out about the attributes.
|
||||
.. contents::
|
||||
|
||||
|
||||
ChatGetter
|
||||
==========
|
||||
|
||||
All events base `ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>`,
|
||||
and some of the objects below do too, so it's important to know its methods.
|
||||
|
||||
.. currentmodule:: telethon.tl.custom.chatgetter.ChatGetter
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
chat
|
||||
input_chat
|
||||
chat_id
|
||||
is_private
|
||||
is_group
|
||||
is_channel
|
||||
|
||||
get_chat
|
||||
get_input_chat
|
||||
|
||||
|
||||
SenderGetter
|
||||
============
|
||||
|
||||
Similar to `ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>`, a
|
||||
`SenderGetter <telethon.tl.custom.sendergetter.SenderGetter>` is the same,
|
||||
but it works for senders instead.
|
||||
|
||||
.. currentmodule:: telethon.tl.custom.sendergetter.SenderGetter
|
||||
|
||||
.. autosummary::
|
||||
:nosignatures:
|
||||
|
||||
sender
|
||||
input_sender
|
||||
sender_id
|
||||
|
||||
get_sender
|
||||
get_input_sender
|
||||
|
||||
|
||||
Message
|
||||
=======
|
||||
|
||||
@@ -22,6 +64,9 @@ The `Message` type is very important, mostly because we are working
|
||||
with a library for a *messaging* platform, so messages are widely used:
|
||||
in events, when fetching history, replies, etc.
|
||||
|
||||
It bases `ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>` and
|
||||
`SenderGetter <telethon.tl.custom.sendergetter.SenderGetter>`.
|
||||
|
||||
Properties
|
||||
----------
|
||||
|
||||
@@ -115,6 +160,8 @@ is returned by the `client.conversation()
|
||||
<telethon.client.dialogs.DialogMethods.conversation>` method to easily
|
||||
send and receive responses like a normal conversation.
|
||||
|
||||
It bases `ChatGetter <telethon.tl.custom.chatgetter.ChatGetter>`.
|
||||
|
||||
.. currentmodule:: telethon.tl.custom.conversation.Conversation
|
||||
|
||||
.. autosummary::
|
||||
|
Reference in New Issue
Block a user