Your favourite, and only, python wrapper for the "very popular" sblp.
- Simple setup
- Fast and low-power HTTP server, that won't slow your bot down
- Easy to use
requestfunctions, making starting SBLP requests easier - Automatic handling of inputted data
- probably more
This module doesn't need the bot to be ready when you initilise it.
fromdiscord.extimportcommandsfromsblpyimportrevisedasyncdefhandler(bumpBody):
# For simplicity, we'll define the bump function here. DONT DO THIS!asyncdefbump(ctx=None, **kwargs):
ctx=ctxorkwargs.get("body")
... # do bumping stuffreturnlen(bumped_to) # can return anythingreturnawaitbump(body=bumpBody)
bot=commands.Bot(...) # can be AutoShardedbot.sblp=revised.Client(
bot, handler, # Note that this function doesn't get a context object.bump_cooldown=3600# how many seconds between each bump
)Carrying on from the last example,
bot.sblp.init_server() # you can change the open port via port=1234bot.sblp.start_server() # close the serverbot.sblp.stop_server()since SBLPy also uses commands.Bot's dispatch system, you don't technically need to provide a function when creating Client().
In client:
body=MappedBumpRequest(body, self.bot)
self.bot.dispatch("sblp_request_start", body)elsewhere:
@commands.Cog.listener()asyncdefon_sblp_request_start(body):
...0.9.3:
- In-built cooldown handling
- Fixed some invalid return codes
- Fixed authentication not auto-loading
made the module complaincancel all the running tasks if you destroy the instance- bugfixes
- future-proofing for intents
- Added
validproperty toMappedBumpRequestso you can verify if a request is valid or not
0.9.2:
- Changelog started
- Added basic authentication support
- bugfixes