Skip to main content

Swibots

Switch Python Library for bots and apps!

Easy to Use

SwiBots is designed with simplicity in mind. Get your bot up and running on the Switch platform in just a few lines of code.

Powerful Features

From simple message handling to complex bot interactions, SwiBots provides a comprehensive toolkit for the Switch platform.

Extensible

Build custom plugins, extend functionality, and create advanced bots for the Switch platform with ease.

SwiBots in Action

Sending Buttons

from swibots import InlineMarkup, InlineKeyboardButton

await bot.send_message(
message="Hi",
user_id=bot.user.id,
inline_markup=InlineMarkup([[
InlineKeyboardButton("Click Me", url="https://example.com")
]])
)

Sending Media

await bot.send_media(
message="This is a message",
user_id=100,
document="file.pdf",
description="file_name.png",
thumb="file.png"
)

Embedded Messages

from swibots import EmbeddedMedia, EmbedInlineField

await bot.send_message(
message="Embedded message",
user_id=400,
media=EmbeddedMedia(
thumbnail="thumb_path.png",
title="Embedded message.",
header_name="Message from SwiBots!",
header_icon="https://header.png",
footer_title="Hello from the bot.",
footer_icon="https://footer.png",
inline_fields=[
[
EmbedInlineField("https://icon.png", "Nice Meeting You", "Hello 👋")
]
]
)
)

Handling Callbacks

from swibots import CallbackQueryEvent, BotContext
from swibots import regexp, InlineMarkup, InlineKeyboardButton

@bot.on_callback_query(regexp("clb$"))
async def onCallback(ctx: BotContext[CallbackQueryEvent]):
await ctx.event.answer(
"Hello, this is a callback answer",
show_alert=True
)

Ready to dive in?

Explore our comprehensive documentation and start building amazing bots for the Switch platform today!