Skip to main content

library for interacting with discord slash commands via an independently hosted server. Powered by FastAPI

Project description

dispike


codecov Test Dispike PyPi Link PyPiVersion Docs


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

  • Read documentation here
  • See an example bot here

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

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 PyPi
  • Handling 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).

Test Dispike

Special Thanks

Project details


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)

Uploaded Source

Built Distribution

dispike-0.9.0a0-py3-none-any.whl (28.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page