Skip to content

Commit

Permalink
docs: fix broken link
Browse files Browse the repository at this point in the history
  • Loading branch information
New-dev0 committed Sep 6, 2024
1 parent fb7afc7 commit d587f24
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/docs/examples/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"label": "Example",
"position": 5,
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important SwiBots concepts."
},
"collapsed": true

}
38 changes: 38 additions & 0 deletions docs/docs/examples/echo-bot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Creating Your First Bot: Echo Bot

In this example, we'll create a simple echo bot using SwiBots. This bot will respond to any message it receives by sending the same message back to the user.

## Prerequisites

Before you begin, make sure you have:

1. Installed SwiBots (`pip install swibots`)
2. Obtained a bot token from the Switch platform

## The Code

Here's the complete code for our echo bot:

```python
from swibots import Client, BotContext, MessageEvent

app = Client("YOUR_BOT_TOKEN")

@app.on_message()
async def message_handler(ctx: BotContext[MessageEvent]):
message = ctx.event.message
await message.respond(f"Received: {message.message}")


app.run()
```

## Running the Bot

To run the bot, simply execute the script:

```bash
python echo_bot.py
```

## Testing the Bot
10 changes: 10 additions & 0 deletions docs/docs/fundamentals/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"label": "Fundamentals",
"position": 3,
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important SwiBots concepts."
},
"collapsed": true

}

0 comments on commit d587f24

Please sign in to comment.