For building serverless discord bots
Project description
Discord SLS
A set of tools for building a discord bot with a serverless architecture in mind. If you are looking for a more complete discord sdk, check out discord.py.
Usage
Example Usage
import json
import logging
from discord_sls import Interaction, bot_handler
@bot_handler
def discord_bot(command_body, send_command_to_queue):
command_name = command_body.get("data", {}).get("name")
if command_name == "hello":
return {"content": "Hello Moto"}
elif command_name == "helloasync":
send_command_to_queue(command_body)
return {"content": "Hello..."}
else:
logging.warn(f"unhandled command: {command_name}")
return {"content": "Unknown Command"}
def long_response_handler(event, context):
for record in event["Records"]:
body = json.loads(record["body"])
interaction = Interaction(body)
interaction.edit_interaction({"content": "Hello...async"})
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for discord_sls-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18886d62d0d047db38fe60941e7ccfa9f4597ee4061294ff934cddfa1804abb9 |
|
MD5 | be628da8593e3bd6a08c6ed6a5dc84ae |
|
BLAKE2b-256 | e1bf863d3776995403defa2b3d620adbb066be842d97dfda76b86c0ab5c4d0a2 |