{"id":26166547,"url":"https://github.com/beverts312/discord-sls","last_synced_at":"2026-04-30T12:33:59.349Z","repository":{"id":64924719,"uuid":"579578057","full_name":"beverts312/discord-sls","owner":"beverts312","description":"Serverless Discord Bot Tooling","archived":false,"fork":false,"pushed_at":"2023-12-15T02:40:00.000Z","size":28,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-30T17:17:31.345Z","etag":null,"topics":["aws","discord","serverless"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beverts312.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-18T06:34:48.000Z","updated_at":"2022-12-18T07:36:47.000Z","dependencies_parsed_at":"2023-12-15T03:37:38.037Z","dependency_job_id":"745c2d90-b8b2-4df4-a16b-3779249188d3","html_url":"https://github.com/beverts312/discord-sls","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.375,"last_synced_commit":"3111a8ca90efa234173b5079eb9406499a82d663"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/beverts312/discord-sls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverts312%2Fdiscord-sls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverts312%2Fdiscord-sls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverts312%2Fdiscord-sls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverts312%2Fdiscord-sls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beverts312","download_url":"https://codeload.github.com/beverts312/discord-sls/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beverts312%2Fdiscord-sls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32465009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","discord","serverless"],"created_at":"2025-03-11T16:57:51.652Z","updated_at":"2026-04-30T12:33:59.327Z","avatar_url":"https://github.com/beverts312.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord SLS\n\nA 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](https://github.com/Rapptz/discord.py).\n\n![PyPI](https://img.shields.io/pypi/v/discord_sls)\n\nInstall with pip: `pip install discord_sls`\n\n[Example/Template Repo](https://github.com/beverts312/discord-bot-template)\n\n## Usage\n\nThe library provides a decorator `@bot_handler` which can be used to decorate a lambda handler to respond to discord api requests.\nIt will handle the ping-pong handshake, and will parse the request body into a python object for you to use. The decorator expects you to return [Ineraction Callback Data](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure).\n\nDiscord expects a quick response to the initial request, if your bot needs longer to handle an interaction you can use the `send_command_to_queue` function to send the command to a queue for processing in another lambda decorated with `@deferred_response_handler`. The queue is determined by the `LONG_RESPONSE_QUEUE` environment variable.\n\n```py\nimport json\nimport logging\nfrom discord_sls import Interaction, bot_handler, deferred_response_handler\n\n@bot_handler\ndef discord_bot(command_body, send_command_to_queue):\n    command_name = command_body.get(\"data\", {}).get(\"name\")\n    if command_name == \"hello\":\n        return {\"content\": \"Hello Moto\"}\n    elif command_name == \"helloasync\":\n        send_command_to_queue(command_body)\n        return {\"content\": \"Hello...\"}\n    else:\n        logging.warn(f\"unhandled command: {command_name}\")\n        return {\"content\": \"Unknown Command\"}\n\n\n@deferred_response_handler\ndef long_response_handler(interaction: Interaction):\n  interaction.follow_up({\"content\": \"Hello...async\"})\n```\n\n### Keeping the bot warm\n\nWith most serverless architectures you will need to keep your lambdas warm to avoid cold start times. A popular mechanism for doing that is using cloudwatch event rules, the `@bot_handler` decorator will automatically handle these requests for you.T his is what a SAM template could look like for the rule:\n\n```yml\nBotKeepWarm:\n  Type: AWS::Events::Rule\n  Properties:\n    Description: Keeps the bot lambda warm\n    Name: !Sub 'keep-warm-${Stage}'\n    ScheduleExpression: rate(5 minutes)\n    Targets:\n      - Id: KeepWarmDiscordBot\n        Arn: !GetAtt DiscordBotFunction.Arn\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeverts312%2Fdiscord-sls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeverts312%2Fdiscord-sls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeverts312%2Fdiscord-sls/lists"}