library for interacting with discord slash commands via an independently hosted server. Powered by FastAPI
Project description
dispike
an extremely early WIP library for easily creating REST-based webhook bots for discord using the new Slash Commands feature.
Powered by FastAPI.
Install
pip install dispike
Learn more
Example Code
from dispike import Dispike
bot = Dispike(..)
@bot.interaction.on("stock"):
async def handle_stock_request(stockticker: str, ctx: IncomingDiscordInteraction) -> DiscordResponse:
get_price = function(stockticker...)
embed=discord.Embed()
embed.add_field(name="Stock Price for {stockticker}.", value="Current price is {get_price}", inline=True)
embed.set_footer(text="Request received by {ctx.member.user.username}")
return DiscordResponse(embed=embed)
if __name__ == "__main__":
bot.run()
Caveats
- Python 3.6+
- Does not speak over the discord gateway. discord-py-slash-command is what you are looking for.
Resolved Caveats
Does not handle registring new commands.Does not handle anything other then string responses. (However you are free to return any valid dict in your handler.)Not on PyPiHandling followup messages.
Development
Help is wanted in mantaining this library. Please try to direct PRs to the dev
branch, and use black formatting (if possible).
Special Thanks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dispike-0.9.0a0.tar.gz
(21.7 kB
view hashes)
Built Distribution
dispike-0.9.0a0-py3-none-any.whl
(28.1 kB
view hashes)
Close
Hashes for dispike-0.9.0a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b0f085824515be5e7d45f7b8ce976d14f1f88829583710823045cdb8baa63e9 |
|
MD5 | 33b3f6944deb0f3a5ba0cd2026f53208 |
|
BLAKE2b-256 | 9ff18801ab15e52857b3f60261b533b2dbbe4923d57de473fb1f35adf97c83bd |