forked from prostomarkeloff/vkwave
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Easy bots | ||
|
||
Wrapper over vkwave.bots for faster bot creating. | ||
|
||
|
||
```python | ||
from vkwave.bots.easy.easy_bot import SimpleLongPollBot | ||
|
||
bot = SimpleLongPollBot(tokens="MyToken", group_id=123456789) | ||
|
||
@bot.message_handler() | ||
def handle(_) -> str: | ||
return "Hello world!" | ||
|
||
bot.run_forever() | ||
``` | ||
|
||
**vkwave.bots.easy** supports: | ||
- Tokens pool | ||
|
||
```python | ||
from vkwave.bots.easy.easy_bot import SimpleLongPollBot | ||
|
||
bot = SimpleLongPollBot(tokens=["MyToken1","MyToken2","MyToken3"], group_id=123456789) | ||
|
||
@bot.message_handler() | ||
def handle(_) -> str: | ||
return "Hello world!" | ||
|
||
bot.run_forever() | ||
``` | ||
|
||
- ClonesBot (a lot of bots with same router) | ||
|
||
```python | ||
from vkwave.bots.easy import SimpleLongPollBot, ClonesBot | ||
|
||
|
||
bot = SimpleLongPollBot(tokens=["MyToken1","MyToken2","MyToken3"], group_id=123456789) | ||
|
||
@bot.message_handler(bot.text_filter("hello")) | ||
def handle(_) -> str: | ||
return "Hello world!" | ||
|
||
|
||
clones = ClonesBot( | ||
bot, | ||
SimpleLongPollBot("Token1",11111111), | ||
SimpleLongPollBot("Token2",22222222), | ||
) | ||
|
||
clones.run_all_bots() | ||
|
||
``` | ||
|
||
All clones will answer "Hello world!" on "hello". |