From 19bf288e3ad65514bc77f6438b6f982ec4d9ee86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A2=E9=81=8A=E8=80=85?= <71359260+Lunatik-cyber@users.noreply.github.com> Date: Fri, 16 Sep 2022 19:16:37 +0500 Subject: [PATCH 01/10] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D0=BF=D1=86=D0=B8=D1=8F=20file=5Fna?= =?UTF-8?q?me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot/bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bot/bot.py b/bot/bot.py index f76610e..21f3d73 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -295,7 +295,7 @@ def send_text(self, chat_id: str, text: str, reply_msg_id=None, forward_chat_id= timeout=self.timeout_s ) - def send_file(self, chat_id, file_id=None, file=None, caption=None, reply_msg_id=None, forward_chat_id=None, + def send_file(self, chat_id, file_id=None, file=None, file_name, caption=None, reply_msg_id=None, forward_chat_id=None, forward_msg_id=None, inline_keyboard_markup=None, parse_mode=None, format_=None): if parse_mode and format_: raise Exception("Cannot use format and parseMode fields at one time") @@ -319,7 +319,13 @@ def send_file(self, chat_id, file_id=None, file=None, caption=None, reply_msg_id ) if file: request.method = "POST" - request.files = {"file": file} + data = None + if file_name: + data = FormData() + data.add_field('file', file, filename=file_name) + request.files = data + else: + request.files = {'file', file} return self.http_session.send(request.prepare(), timeout=self.timeout_s) From 4be7de7457457a3f7768835e2f71997dc676903a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A2=E9=81=8A=E8=80=85?= <71359260+Lunatik-cyber@users.noreply.github.com> Date: Wed, 28 Sep 2022 23:20:31 +0500 Subject: [PATCH 02/10] Update bot.py --- bot/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/bot.py b/bot/bot.py index 21f3d73..09612a2 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -295,7 +295,7 @@ def send_text(self, chat_id: str, text: str, reply_msg_id=None, forward_chat_id= timeout=self.timeout_s ) - def send_file(self, chat_id, file_id=None, file=None, file_name, caption=None, reply_msg_id=None, forward_chat_id=None, + def send_file(self, chat_id, file_id=None, file=None, file_name=None, caption=None, reply_msg_id=None, forward_chat_id=None, forward_msg_id=None, inline_keyboard_markup=None, parse_mode=None, format_=None): if parse_mode and format_: raise Exception("Cannot use format and parseMode fields at one time") From 854e686ae362b245383092f011abc6696a4823ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A2=E9=81=8A=E8=80=85?= <71359260+Lunatik-cyber@users.noreply.github.com> Date: Wed, 28 Sep 2022 23:22:12 +0500 Subject: [PATCH 03/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c6ff30e..dfaeb4c 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ pip install --upgrade mailru-im-bot Install from sources: ```bash -git clone https://github.com/mail-ru-im/bot-python.git +git clone https://github.com/Lunatik-cyber/bot-python.git cd bot-python python setup.py install ``` From da460968aeaabf7c28ebb88407b23ec9b23797ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A2=E9=81=8A=E8=80=85?= <71359260+Lunatik-cyber@users.noreply.github.com> Date: Wed, 28 Sep 2022 23:22:41 +0500 Subject: [PATCH 04/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfaeb4c..71e9263 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ pip install --upgrade mailru-im-bot Install from sources: ```bash -git clone https://github.com/Lunatik-cyber/bot-python.git +git clone https://github.com/Lunatik-cyber/bot-python-icq.git cd bot-python python setup.py install ``` From 12139587059aa5fcf15f7df296ab41a49269bc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A2=E9=81=8A=E8=80=85?= <71359260+Lunatik-cyber@users.noreply.github.com> Date: Thu, 29 Sep 2022 00:54:43 +0500 Subject: [PATCH 05/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71e9263..2b540e5 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ pip install --upgrade mailru-im-bot Install from sources: ```bash git clone https://github.com/Lunatik-cyber/bot-python-icq.git -cd bot-python +cd bot-python-icq python setup.py install ``` From 3a49805561fb857aee17920c52f668ebe791ddad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A2=E9=81=8A=E8=80=85?= <71359260+Lunatik-cyber@users.noreply.github.com> Date: Thu, 29 Sep 2022 00:55:40 +0500 Subject: [PATCH 06/10] Update bot.py --- bot/bot.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bot/bot.py b/bot/bot.py index 09612a2..603322c 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -319,10 +319,9 @@ def send_file(self, chat_id, file_id=None, file=None, file_name=None, caption=No ) if file: request.method = "POST" - data = None + data = dict() if file_name: - data = FormData() - data.add_field('file', file, filename=file_name) + data["file"] = (file_name, file) request.files = data else: request.files = {'file', file} From 5f556f7027852f64d6fa4c6d1ab4c423a37a735e Mon Sep 17 00:00:00 2001 From: astrofic Date: Thu, 15 Dec 2022 04:25:52 +0500 Subject: [PATCH 07/10] add to pypi: https://pypi.org/project/mailru-im-bot-updated/0.0.21/ --- README.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2b540e5..0775474 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ This library provides complete Bot API 1.0 interface and compatible with Python # Installing Install using pip: ```bash -pip install --upgrade mailru-im-bot +pip install --upgrade mailru-im-bot-updated ``` Install from sources: diff --git a/setup.py b/setup.py index c78590d..b81cb6c 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ def requirements(): setup( - name="mailru-im-bot", + name="mailru-im-bot-updated", version=bot.__version__, description="Pure Python interface for Bot API. Bot cookbook for Humans.", long_description=long_description(), From e9d256b33e6c5433bf601b09ee274c9be5c97509 Mon Sep 17 00:00:00 2001 From: astrofic Date: Tue, 21 Mar 2023 17:02:06 +0500 Subject: [PATCH 08/10] add to pypi: https://pypi.org/project/mailru-im-bot-updated/0.0.21/ --- README.md | 19 ++++++++++++++++++- example/decorators_bot.py | 2 +- example/echo_bot.py | 4 ++-- example/format_bot.py | 8 ++++---- example/myteam_bot.py | 4 ++-- example/scheduled_bot.py | 2 +- example/test_bot.py | 20 ++++++++++---------- {bot => icq_bot}/__init__.py | 2 +- {bot => icq_bot}/bot.py | 21 +++++++++++---------- {bot => icq_bot}/constant.py | 0 {bot => icq_bot}/dispatcher.py | 0 {bot => icq_bot}/event.py | 0 {bot => icq_bot}/filter.py | 0 {bot => icq_bot}/handler.py | 0 {bot => icq_bot}/myteam.py | 0 {bot => icq_bot}/types.py | 0 {bot => icq_bot}/util.py | 0 setup.py | 8 ++++---- 18 files changed, 54 insertions(+), 36 deletions(-) rename {bot => icq_bot}/__init__.py (86%) rename {bot => icq_bot}/bot.py (98%) rename {bot => icq_bot}/constant.py (100%) rename {bot => icq_bot}/dispatcher.py (100%) rename {bot => icq_bot}/event.py (100%) rename {bot => icq_bot}/filter.py (100%) rename {bot => icq_bot}/handler.py (100%) rename {bot => icq_bot}/myteam.py (100%) rename {bot => icq_bot}/types.py (100%) rename {bot => icq_bot}/util.py (100%) diff --git a/README.md b/README.md index 0775474..66b0cea 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,27 @@ pip install --upgrade mailru-im-bot-updated Install from sources: ```bash git clone https://github.com/Lunatik-cyber/bot-python-icq.git -cd bot-python-icq +cd icq_bot-python-icq python setup.py install ``` +# New features +* Added ***file_name*** argument to **send_file** function. Now you can send files with custom names. +* Now you can receive sent data in ***send_text, send_file, send_voice, edit_text functions, +answer_callback_query***. + +### Example file_name argument +```python +bot.send_file(chat_id=chat_id, file_name="test.txt", file=open("test.txt", "rb")) +``` + +### Example sent data +```python +msg = bot.send_text(chat_id=chat_id, text="test") +bot.edit_text(chat_id=chat_id, message_id=msg["msgId"], text="test2") +``` + + # API description