Telegram notification tool
Project description
tnt-python
tnt - Telegram notification tool
Features
- Sending text messages to chat
- Sending text documents to chat
Installation
poetry add tnt-python
or
pip install tnt-python
Example
This code sends a message on your behalf to the chat
import os
from tnt_python.data import MessageData
from tnt_python.services import NotifyerService
# Your API Token
token = os.getenv("TG_TOKEN")
data = MessageData(
chat_id=os.getenv("CHAT_ID"),
text="Hello world"
)
NotifyerService().send_message(data, token)
Debug
Methods send_message
, send_coument
returns ResponseType
type dataclass.
You can output status_code
or the entire response via result
import os
from tnt_python.data import MessageData
from tnt_python.services import NotifyerService
from tnt_python.types import ResponseType
token = os.getenv("TG_TOKEN")
data = MessageData(
chat_id=os.getenv("CHAT_ID"),
text="Hello world"
)
response: ResponseType = NotifyerService().send_message(data, token)
# So you can display the entire response and the response code
print(response.status_code, response.result)
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
tnt-python-0.2.0.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for tnt_python-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cd973a01c05c3364bd04073b9d82ed09740d4e84452995af6c707b42383d7b8 |
|
MD5 | c3b8ca395eca1090bdaa896cad34406b |
|
BLAKE2b-256 | f2b3ce86a3703fd4e179c0cf52a2525c52bc5928781e8d9844fd07d8d49ce161 |