Skip to content

Commit

Permalink
easy bot docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kesha1225 committed Apr 10, 2020
1 parent f3400eb commit 302110e
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions docs/bots/easy.md
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".

0 comments on commit 302110e

Please sign in to comment.