Bots Library for Switch
Project description
SwiBots
Python library for switch app
Please check the documentation for more information.
Quick start
Let's discover SwiBots in less than 5 minutes.
Getting Started
You can start building your first app with SwiBots in less than 5 minutes.
- Install swibots library
pip install swibots
OR build from source
pip install git+https://github.com/switchcollab/Switch-Bots-Python-Library.git
- Open the editor of your choice and create a python file echobot.py (or whatever name you want!), and paste the following code:
from swibots import (
BotApp,
BotContext,
MessageEvent
)
TOKEN = "MY SUPER SECRET TOKEN"
# initialize the app and register commands
app = BotApp(
TOKEN, "A cool bot with annotations and everything you could possibly want :)"
)
@app.on_message()
async def message_handler(ctx: BotContext[MessageEvent]):
# easy way to prepare a mesage that is a response of an incomming message
m = await ctx.prepare_response_message(ctx.event.message)
m.message = f"Thank you! I received your message: {ctx.event.message.message}"
# send the message back to the user
await ctx.send_message(m)
app.run()
- Save your file and run it
python echobot.py
-
Open your switch app and send a message to the bot
Hello world!
-
You will receive a reply from your bot saying
Thank you! I received your message: Hello world!
Checkout Bot samples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
swibots-1.3.16b0.tar.gz
(62.0 kB
view hashes)
Built Distribution
swibots-1.3.16b0-py3-none-any.whl
(138.0 kB
view hashes)
Close
Hashes for swibots-1.3.16b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e333ab946161c8fabde733326d81be286fcf055892db58766ea18db8f8e01e5c |
|
MD5 | efadd25d68105130b697a332a148b00b |
|
BLAKE2b-256 | 489e3d36a5b13b5c296642da7f1dfe5ed0aa8d68f98a0c1866396e5f846a4bfd |