summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-telegrambotapiwrapper.spec267
-rw-r--r--sources1
3 files changed, 269 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..c7ac045 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/telegrambotapiwrapper-0.5.0.tar.gz
diff --git a/python-telegrambotapiwrapper.spec b/python-telegrambotapiwrapper.spec
new file mode 100644
index 0000000..16bf496
--- /dev/null
+++ b/python-telegrambotapiwrapper.spec
@@ -0,0 +1,267 @@
+%global _empty_manifest_terminate_build 0
+Name: python-telegrambotapiwrapper
+Version: 0.5.0
+Release: 1
+Summary: Python Telegram Bot Api Wrapper.
+License: MIT License
+URL: https://github.com/pynista/telegrambotapiwrapper
+Source0: https://mirrors.aliyun.com/pypi/web/packages/e3/5c/e08b757eea136e2aa90cd9e8c0abe3ce9bd5066f6147b88619682529de1c/telegrambotapiwrapper-0.5.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-prettyprinter
+Requires: python3-jsonpickle
+Requires: python3-requests
+
+%description
+# What is telegrambotapiwrapper?
+
+`telegrambotapiwrapper` is Telegram Bot Api implementation for Python
+# Requirements
+cpython: 3.7, 3.8, 3.9
+# Installation
+```
+pip install telegrambotapiwrapper
+```
+
+# Getting started.
+### Creating a bot
+
+You must [create a bot and get a token](https://core.telegram.org/bots#6-botfather)
+
+### Testing your bot's auth token
+We use the method [getMe](https://core.telegram.org/bots/api#getme):
+```python
+>>> from telegrambotapiwrapper import Api
+>>> first_bot_api = Api(token="<paste your token here>")
+>>> me = first_bot_api.get_me()
+>>> me
+User(id=123456679, is_bot=True, first_name='botbotbot', last_name=None, username='myrudatingposterbot', language_code=None)
+```
+Check result type:
+```python
+>>> from telegrambotapiwrapper.typelib import User
+>>> isinstance(me, User)
+True
+```
+### Sending a text message to channel
+#### Preconditions
+Before sending a text message to a channel, you must:
+1. [create channel](https://www.wikihow.com/Create-a-Telegram-Channel-on-Android)
+1. [add bot to channel as administrator](https://stackoverflow.com/questions/33126743/how-do-i-add-my-bot-to-a-channel)
+1. [get channel id](https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id)
+#### Sending to the channel
+```python
+>>> first_bot_api.send_message(chat_id=-12345678912345, text="sdjfhjsdfbjdbvhj")
+Message(message_id=299, date=1558966491, chat=Chat(id=--12345678912345, type='channel', title='FooFoo', username='lalalalalalala', first_name=None, last_name=None, all_members_are_administrators=None, photo=None, description=None, invite_link=None, pinned_message=None, sticker_set_name=None, can_set_sticker_set=None), from_user=None, forward_from=None, forward_from_chat=None, forward_from_message_id=None, forward_signature=None, forward_sender_name=None, forward_date=None, reply_to_message=None, edit_date=None, media_group_id=None, author_signature=None, text='sdjfhjsdfbjdbvhj', entities=None, caption_entities=None, audio=None, document=None, animation=None, game=None, photo=None, sticker=None, video=None, voice=None, video_note=None, caption=None, contact=None, location=None, venue=None, poll=None, new_chat_members=None, left_chat_member=None, new_chat_title=None, new_chat_photo=None, delete_chat_photo=None, group_chat_created=None, supergroup_chat_created=None, channel_chat_created=None, migrate_to_chat_id=None, migrate_from_chat_id=None, pinned_message=None, invoice=None, successful_payment=None, connected_website=None, passport_data=None)
+```
+> Note that chat_id is negative.
+### Sending a photo to channel
+```python
+>>> with open('/home/dzmitry/Pictures/500800998.jpg', 'rb') as image:
+... first_bot_api.send_photo(chat_id=-12345678912345, photo=image,
+... caption="hello world")
+
+>>>
+
+```
+> Note the open file mode.
+## Method and types
+* Implemented all methods Telegram Bot Api
+* Implemented all types Telegram Bot Api
+* All types of Telegram Bot Api are imported from the `typelib` module.
+## License
+MIT License
+Copyright (c) 2020 Dzmitry Maliuzhenets
+
+See LICENSE for details.
+
+
+
+
+
+%package -n python3-telegrambotapiwrapper
+Summary: Python Telegram Bot Api Wrapper.
+Provides: python-telegrambotapiwrapper
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-telegrambotapiwrapper
+# What is telegrambotapiwrapper?
+
+`telegrambotapiwrapper` is Telegram Bot Api implementation for Python
+# Requirements
+cpython: 3.7, 3.8, 3.9
+# Installation
+```
+pip install telegrambotapiwrapper
+```
+
+# Getting started.
+### Creating a bot
+
+You must [create a bot and get a token](https://core.telegram.org/bots#6-botfather)
+
+### Testing your bot's auth token
+We use the method [getMe](https://core.telegram.org/bots/api#getme):
+```python
+>>> from telegrambotapiwrapper import Api
+>>> first_bot_api = Api(token="<paste your token here>")
+>>> me = first_bot_api.get_me()
+>>> me
+User(id=123456679, is_bot=True, first_name='botbotbot', last_name=None, username='myrudatingposterbot', language_code=None)
+```
+Check result type:
+```python
+>>> from telegrambotapiwrapper.typelib import User
+>>> isinstance(me, User)
+True
+```
+### Sending a text message to channel
+#### Preconditions
+Before sending a text message to a channel, you must:
+1. [create channel](https://www.wikihow.com/Create-a-Telegram-Channel-on-Android)
+1. [add bot to channel as administrator](https://stackoverflow.com/questions/33126743/how-do-i-add-my-bot-to-a-channel)
+1. [get channel id](https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id)
+#### Sending to the channel
+```python
+>>> first_bot_api.send_message(chat_id=-12345678912345, text="sdjfhjsdfbjdbvhj")
+Message(message_id=299, date=1558966491, chat=Chat(id=--12345678912345, type='channel', title='FooFoo', username='lalalalalalala', first_name=None, last_name=None, all_members_are_administrators=None, photo=None, description=None, invite_link=None, pinned_message=None, sticker_set_name=None, can_set_sticker_set=None), from_user=None, forward_from=None, forward_from_chat=None, forward_from_message_id=None, forward_signature=None, forward_sender_name=None, forward_date=None, reply_to_message=None, edit_date=None, media_group_id=None, author_signature=None, text='sdjfhjsdfbjdbvhj', entities=None, caption_entities=None, audio=None, document=None, animation=None, game=None, photo=None, sticker=None, video=None, voice=None, video_note=None, caption=None, contact=None, location=None, venue=None, poll=None, new_chat_members=None, left_chat_member=None, new_chat_title=None, new_chat_photo=None, delete_chat_photo=None, group_chat_created=None, supergroup_chat_created=None, channel_chat_created=None, migrate_to_chat_id=None, migrate_from_chat_id=None, pinned_message=None, invoice=None, successful_payment=None, connected_website=None, passport_data=None)
+```
+> Note that chat_id is negative.
+### Sending a photo to channel
+```python
+>>> with open('/home/dzmitry/Pictures/500800998.jpg', 'rb') as image:
+... first_bot_api.send_photo(chat_id=-12345678912345, photo=image,
+... caption="hello world")
+
+>>>
+
+```
+> Note the open file mode.
+## Method and types
+* Implemented all methods Telegram Bot Api
+* Implemented all types Telegram Bot Api
+* All types of Telegram Bot Api are imported from the `typelib` module.
+## License
+MIT License
+Copyright (c) 2020 Dzmitry Maliuzhenets
+
+See LICENSE for details.
+
+
+
+
+
+%package help
+Summary: Development documents and examples for telegrambotapiwrapper
+Provides: python3-telegrambotapiwrapper-doc
+%description help
+# What is telegrambotapiwrapper?
+
+`telegrambotapiwrapper` is Telegram Bot Api implementation for Python
+# Requirements
+cpython: 3.7, 3.8, 3.9
+# Installation
+```
+pip install telegrambotapiwrapper
+```
+
+# Getting started.
+### Creating a bot
+
+You must [create a bot and get a token](https://core.telegram.org/bots#6-botfather)
+
+### Testing your bot's auth token
+We use the method [getMe](https://core.telegram.org/bots/api#getme):
+```python
+>>> from telegrambotapiwrapper import Api
+>>> first_bot_api = Api(token="<paste your token here>")
+>>> me = first_bot_api.get_me()
+>>> me
+User(id=123456679, is_bot=True, first_name='botbotbot', last_name=None, username='myrudatingposterbot', language_code=None)
+```
+Check result type:
+```python
+>>> from telegrambotapiwrapper.typelib import User
+>>> isinstance(me, User)
+True
+```
+### Sending a text message to channel
+#### Preconditions
+Before sending a text message to a channel, you must:
+1. [create channel](https://www.wikihow.com/Create-a-Telegram-Channel-on-Android)
+1. [add bot to channel as administrator](https://stackoverflow.com/questions/33126743/how-do-i-add-my-bot-to-a-channel)
+1. [get channel id](https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id)
+#### Sending to the channel
+```python
+>>> first_bot_api.send_message(chat_id=-12345678912345, text="sdjfhjsdfbjdbvhj")
+Message(message_id=299, date=1558966491, chat=Chat(id=--12345678912345, type='channel', title='FooFoo', username='lalalalalalala', first_name=None, last_name=None, all_members_are_administrators=None, photo=None, description=None, invite_link=None, pinned_message=None, sticker_set_name=None, can_set_sticker_set=None), from_user=None, forward_from=None, forward_from_chat=None, forward_from_message_id=None, forward_signature=None, forward_sender_name=None, forward_date=None, reply_to_message=None, edit_date=None, media_group_id=None, author_signature=None, text='sdjfhjsdfbjdbvhj', entities=None, caption_entities=None, audio=None, document=None, animation=None, game=None, photo=None, sticker=None, video=None, voice=None, video_note=None, caption=None, contact=None, location=None, venue=None, poll=None, new_chat_members=None, left_chat_member=None, new_chat_title=None, new_chat_photo=None, delete_chat_photo=None, group_chat_created=None, supergroup_chat_created=None, channel_chat_created=None, migrate_to_chat_id=None, migrate_from_chat_id=None, pinned_message=None, invoice=None, successful_payment=None, connected_website=None, passport_data=None)
+```
+> Note that chat_id is negative.
+### Sending a photo to channel
+```python
+>>> with open('/home/dzmitry/Pictures/500800998.jpg', 'rb') as image:
+... first_bot_api.send_photo(chat_id=-12345678912345, photo=image,
+... caption="hello world")
+
+>>>
+
+```
+> Note the open file mode.
+## Method and types
+* Implemented all methods Telegram Bot Api
+* Implemented all types Telegram Bot Api
+* All types of Telegram Bot Api are imported from the `typelib` module.
+## License
+MIT License
+Copyright (c) 2020 Dzmitry Maliuzhenets
+
+See LICENSE for details.
+
+
+
+
+
+%prep
+%autosetup -n telegrambotapiwrapper-0.5.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-telegrambotapiwrapper -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..1ecc974
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+f62b10b68a4186628c4bc7cc62662c39 telegrambotapiwrapper-0.5.0.tar.gz