Skip to content

New-dev0/Switch-Bots-Python-Library

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

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.

  1. Install swibots library
pip install swibots
  1. 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()
  1. Save your file and run it
python echobot.py
  1. Open your switch app and send a message to the bot Hello world!

  2. You will receive a reply from your bot saying Thank you! I received your message: Hello world!

About

We made a Wrapper You cant refuse

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.7%
  • Other 0.3%