maxibot 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maxibot-1.0.3/PKG-INFO +77 -0
- maxibot-1.0.3/README.md +55 -0
- maxibot-1.0.3/maxibot/__init__.py +644 -0
- maxibot-1.0.3/maxibot/apihelper.py +241 -0
- maxibot-1.0.3/maxibot/core/attachments/photo.py +45 -0
- maxibot-1.0.3/maxibot/core/network/client.py +118 -0
- maxibot-1.0.3/maxibot/core/network/polling.py +75 -0
- maxibot-1.0.3/maxibot/types.py +753 -0
- maxibot-1.0.3/maxibot/util.py +98 -0
- maxibot-1.0.3/maxibot.egg-info/PKG-INFO +77 -0
- maxibot-1.0.3/maxibot.egg-info/SOURCES.txt +14 -0
- maxibot-1.0.3/maxibot.egg-info/dependency_links.txt +1 -0
- maxibot-1.0.3/maxibot.egg-info/requires.txt +1 -0
- maxibot-1.0.3/maxibot.egg-info/top_level.txt +1 -0
- maxibot-1.0.3/pyproject.toml +30 -0
- maxibot-1.0.3/setup.cfg +4 -0
maxibot-1.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maxibot
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Library for build bot in MAX
|
|
5
|
+
Project-URL: Homepage, https://github.com/mrProduktivnyy/maxibot
|
|
6
|
+
Project-URL: Documentation, https://github.com/mrProduktivnyy/maxibot/tree/main/maxibot/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/mrProduktivnyy/maxibot
|
|
8
|
+
Project-URL: Issues, https://github.com/mrProduktivnyy/maxibot/issues
|
|
9
|
+
Keywords: max,bot,api,tools
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Environment :: Console
|
|
18
|
+
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: requests==2.32.5
|
|
22
|
+
|
|
23
|
+
[](https://pypi.python.org/pypi/maxibot)
|
|
24
|
+
[](https://pypi.python.org/pypi/maxibot)
|
|
25
|
+
[](https://github.com/mrProduktivnyy/maxibot/tree/main/maxibot/docs)
|
|
26
|
+
[](https://pypi.org/project/maxibot/)
|
|
27
|
+
[](https://pypi.python.org/pypi/maxibot)
|
|
28
|
+
|
|
29
|
+
## Быстрый старт
|
|
30
|
+
Необходимо установить библиотеку
|
|
31
|
+
```sh
|
|
32
|
+
pip install maxibot
|
|
33
|
+
```
|
|
34
|
+
## Просто эхо-бот
|
|
35
|
+
Необходимо создать файл `echo_bot.py` и добавить в него следующий код.
|
|
36
|
+
Для начала надо проинициализировать бота, делается это следующим образом:
|
|
37
|
+
```python
|
|
38
|
+
from maxibot import MaxiBot
|
|
39
|
+
|
|
40
|
+
bot = maxibot.Maxibot("TOKEN")
|
|
41
|
+
```
|
|
42
|
+
После этой декларации нам нужно зарегистрировать так называемых обработчиков сообщений. Обработчики сообщений определяют фильтры, которые должно проходить сообщение. Если сообщение проходит через фильтр, вызывается декорированная функция и входящее сообщение передается в качестве аргумента.
|
|
43
|
+
|
|
44
|
+
Определите определим обработчик сообщений, который обрабатывает входящие `/start` и `/help` команды.
|
|
45
|
+
```python
|
|
46
|
+
@bot.message_handler(commands=['start', 'help'])
|
|
47
|
+
def send_welcome(message):
|
|
48
|
+
bot.send_message(message, "Привет! Как дела?")
|
|
49
|
+
```
|
|
50
|
+
Добавим ещё один обработчик сообщения, который будет повторять отправленный текст:
|
|
51
|
+
```python
|
|
52
|
+
@bot.message_handler(func=lambda m: True)
|
|
53
|
+
def echo_all(message):
|
|
54
|
+
bot.send_message(message, message.text)
|
|
55
|
+
```
|
|
56
|
+
Для того, чтобы запустить бота, запустим полинг событий следующей командой:
|
|
57
|
+
```python
|
|
58
|
+
bot.polling()
|
|
59
|
+
```
|
|
60
|
+
Для простого эхо-бота это всё. Наш файл теперь выглядит так:
|
|
61
|
+
```python
|
|
62
|
+
from maxibot import MaxiBot
|
|
63
|
+
|
|
64
|
+
bot = maxibot.Maxibot("TOKEN")
|
|
65
|
+
|
|
66
|
+
@bot.message_handler(commands=['start', 'help'])
|
|
67
|
+
def send_welcome(message):
|
|
68
|
+
bot.send_message(message, "Привет! Как дела?")
|
|
69
|
+
|
|
70
|
+
@bot.message_handler(func=lambda m: True)
|
|
71
|
+
def echo_all(message):
|
|
72
|
+
bot.send_message(message, message.text)
|
|
73
|
+
|
|
74
|
+
bot.polling()
|
|
75
|
+
```
|
|
76
|
+
Чтобы запустить бота, просто откройте терминал и введите `python echo_bot.py`, чтобы запустить бота.
|
|
77
|
+
Проверьте его, отправив команды (`/start` и `/help`) и произвольные текстовые сообщения.
|
maxibot-1.0.3/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[](https://pypi.python.org/pypi/maxibot)
|
|
2
|
+
[](https://pypi.python.org/pypi/maxibot)
|
|
3
|
+
[](https://github.com/mrProduktivnyy/maxibot/tree/main/maxibot/docs)
|
|
4
|
+
[](https://pypi.org/project/maxibot/)
|
|
5
|
+
[](https://pypi.python.org/pypi/maxibot)
|
|
6
|
+
|
|
7
|
+
## Быстрый старт
|
|
8
|
+
Необходимо установить библиотеку
|
|
9
|
+
```sh
|
|
10
|
+
pip install maxibot
|
|
11
|
+
```
|
|
12
|
+
## Просто эхо-бот
|
|
13
|
+
Необходимо создать файл `echo_bot.py` и добавить в него следующий код.
|
|
14
|
+
Для начала надо проинициализировать бота, делается это следующим образом:
|
|
15
|
+
```python
|
|
16
|
+
from maxibot import MaxiBot
|
|
17
|
+
|
|
18
|
+
bot = maxibot.Maxibot("TOKEN")
|
|
19
|
+
```
|
|
20
|
+
После этой декларации нам нужно зарегистрировать так называемых обработчиков сообщений. Обработчики сообщений определяют фильтры, которые должно проходить сообщение. Если сообщение проходит через фильтр, вызывается декорированная функция и входящее сообщение передается в качестве аргумента.
|
|
21
|
+
|
|
22
|
+
Определите определим обработчик сообщений, который обрабатывает входящие `/start` и `/help` команды.
|
|
23
|
+
```python
|
|
24
|
+
@bot.message_handler(commands=['start', 'help'])
|
|
25
|
+
def send_welcome(message):
|
|
26
|
+
bot.send_message(message, "Привет! Как дела?")
|
|
27
|
+
```
|
|
28
|
+
Добавим ещё один обработчик сообщения, который будет повторять отправленный текст:
|
|
29
|
+
```python
|
|
30
|
+
@bot.message_handler(func=lambda m: True)
|
|
31
|
+
def echo_all(message):
|
|
32
|
+
bot.send_message(message, message.text)
|
|
33
|
+
```
|
|
34
|
+
Для того, чтобы запустить бота, запустим полинг событий следующей командой:
|
|
35
|
+
```python
|
|
36
|
+
bot.polling()
|
|
37
|
+
```
|
|
38
|
+
Для простого эхо-бота это всё. Наш файл теперь выглядит так:
|
|
39
|
+
```python
|
|
40
|
+
from maxibot import MaxiBot
|
|
41
|
+
|
|
42
|
+
bot = maxibot.Maxibot("TOKEN")
|
|
43
|
+
|
|
44
|
+
@bot.message_handler(commands=['start', 'help'])
|
|
45
|
+
def send_welcome(message):
|
|
46
|
+
bot.send_message(message, "Привет! Как дела?")
|
|
47
|
+
|
|
48
|
+
@bot.message_handler(func=lambda m: True)
|
|
49
|
+
def echo_all(message):
|
|
50
|
+
bot.send_message(message, message.text)
|
|
51
|
+
|
|
52
|
+
bot.polling()
|
|
53
|
+
```
|
|
54
|
+
Чтобы запустить бота, просто откройте терминал и введите `python echo_bot.py`, чтобы запустить бота.
|
|
55
|
+
Проверьте его, отправив команды (`/start` и `/help`) и произвольные текстовые сообщения.
|