Skip to content

Commit 1af74b0

Browse files
committed
lets try
1 parent 3b3cfaf commit 1af74b0

File tree

4 files changed

+111
-3
lines changed

4 files changed

+111
-3
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.10.x'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: immmdreza
39+
password: ${{ secrets.PYPI_API_TOKEN }}

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
telegrambots
1+
telegrambots==0.0.5rc0

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ author_email = [email protected]
66
description = A custom extension packages for telegrambots.
77
long_description = file: README.md
88
long_description_content_type = text/markdown
9-
url = https://github.com/telegrambots/custom-telegrambots
9+
url = https://github.com/python-telegrambots/custom-telegrambots
1010
project_urls =
11-
Bug Tracker = https://github.com/telegrambots/custom-telegrambots/issues
11+
Bug Tracker = https://github.com/python-telegrambots/custom-telegrambots/issues
1212
classifiers =
1313
Programming Language :: Python :: 3
1414
License :: OSI Approved :: MIT License

src/telegrambots/custom/client.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
from typing import Optional
2+
from telegrambots.wrapper.client import TelegramBotsClient
3+
from telegrambots.wrapper.types.methods import SendMessage
4+
from telegrambots.wrapper.types.objects import (
5+
MessageEntity,
6+
InlineKeyboardMarkup,
7+
ReplyKeyboardMarkup,
8+
ReplyKeyboardRemove,
9+
ForceReply,
10+
)
11+
12+
13+
class CustomTelegramBotsClient(TelegramBotsClient):
14+
def __init__(self, token: str):
15+
super().__init__(token)
16+
17+
async def send_message(
18+
self,
19+
chat_id: int,
20+
text: str,
21+
parse_mode: Optional[str] = None,
22+
entities: Optional[list[MessageEntity]] = None,
23+
disable_web_page_preview: Optional[bool] = None,
24+
disable_notification: Optional[bool] = None,
25+
protect_content: Optional[bool] = None,
26+
reply_to_message_id: Optional[int] = None,
27+
allow_sending_without_reply: Optional[bool] = None,
28+
reply_markup: Optional[
29+
InlineKeyboardMarkup
30+
| ReplyKeyboardMarkup
31+
| ReplyKeyboardRemove
32+
| ForceReply
33+
] = None,
34+
):
35+
"""Send text message to chat.
36+
37+
Args:
38+
chat_id (`int`): Unique identifier for the target chat or username of the target channel
39+
text (`str`): Text of the message to be sent
40+
parse_mode (`Optional[str]`, optional): Send Markdown or HTML, if you want Telegram apps to show bold,
41+
italic, fixed-width text or inline URLs in your bot's message.
42+
entities (`Optional[list[MessageEntity]`], optional): List of special entities that appear in message text,
43+
which can be specified instead of parse_mode.
44+
disable_web_page_preview (`Optional[bool]`, optional): Disables link previews for links in this message.
45+
disable_notification (`Optional[bool]`, optional): Sends the message silently.
46+
protect_content (`Optional[bool]`, optional): If True, the message content will be protected.
47+
reply_to_message_id (`Optional[int]`, optional): reply to message id.
48+
allow_sending_without_reply (`Optional[bool]`, optional): If True, the message will be sent anyway.
49+
reply_markup (`Optional[ InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply ]`, optional):
50+
Additional interface options. An object for an inline keyboard, custom reply keyboard, ...
51+
52+
Returns:
53+
`Message`: On success, the sent message is returned.
54+
"""
55+
56+
return await self(
57+
SendMessage(
58+
chat_id=chat_id,
59+
text=text,
60+
parse_mode=parse_mode,
61+
entities=entities,
62+
disable_web_page_preview=disable_web_page_preview,
63+
disable_notification=disable_notification,
64+
protect_content=protect_content,
65+
reply_to_message_id=reply_to_message_id,
66+
allow_sending_without_reply=allow_sending_without_reply,
67+
reply_markup=reply_markup,
68+
)
69+
)

0 commit comments

Comments
 (0)