Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Latest commit

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

SBLPy

Your favourite, and only, python wrapper for the "very popular" sblp.

Features:

  • Simple setup
  • Fast and low-power HTTP server, that won't slow your bot down
  • Easy to use request functions, making starting SBLP requests easier
  • Automatic handling of inputted data
  • probably more

Setup

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
)

Starting and Stopping the server

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()

Functionless Clients

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):
...

request.mp4


Changelog

0.9.3:

  • In-built cooldown handling
  • Fixed some invalid return codes
  • Fixed authentication not auto-loading
  • made the module complain cancel all the running tasks if you destroy the instance
  • bugfixes
  • future-proofing for intents
  • Added valid property to MappedBumpRequest so you can verify if a request is valid or not

0.9.2:

  • Changelog started
  • Added basic authentication support
  • bugfixes

About

SBLP's HTTP protocol, in python.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages