Skip to main content

Python versions License Status Issues Commit activity


Kasushi

Building blocks and utility extensions for discord.py bots


Kasushi is an extension of the discord.py library. It provides a number of useful features for bots, such as cache, IPC, tortoise models and more.

It is really easy to use, and requires a minimum amount of configuration.

  1. Download kasushi on the command line using pip:
pip install -U kasushi
  1. Configure the extensions:
import kasushi
# See below for settings you can pass to configure.
await kasushi.configure(bot, {}) 
  1. Load the extensions in your bot code before it runs:
await bot.load_extension('kasushi.cache')

You're done!

Modules and settings

Many modules are available in kasushi. You should load them in your bot, and pass settings to configure.

Depending on the module(s) you want to use, you can pass different settings to configure.

Cache

The cache module allows for connecting to a memcached server. It can be used to store cached data between reboots of the bot, like cooldowns and user data.

Usage

Once installed and loaded, the cache class is made available in bot.cache.

await bot.cache.set("coins", 0)
await bot.cache.set("coins", 10)
await bot.cache.get("coins")  # 10
await bot.cache.delete("coins")
await bot.cache.get("coins", default=5)  # 5

Configuration example

You can pass the following dictionary to configure:

{
    "cache": {
        "server_ip": "127.0.0.1",
        "server_port": 11211,
    }
}

IPC

IPC stands for Inter-Process Communication. It allows for sending messages between processes, or, in our case, different processes for the same bot.

The process hosting the first shard (shard 0) will be the "master process". It'll host the webserver allowing other processes to connect to it.

It'll also pass messages to the other bots if needed.

Usage

Once installed and loaded, the IPC class is made available in bot.ipc. All bots need to be able to access the first shard's IPC server.

Configuration example

{
    "ipc": {
        "shared_secret": "secret",  # This is used to authenticate with the IPC server.
        "server": {
            "host": "0.0.0.0",
            "port": 12321,
        },
        "client": {
            "server_url": "http://127.0.0.1:12321",
        },
        "handlers": [GuildInfoHandler]  # See above for handlers.
    },
}

Release files for kasushi 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kasushi 0.1.2
File Size Uploaded
kasushi-0.1.2.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kasushi 0.1.2
File Interpreter ABI Platform
kasushi-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / kasushi-0.1.2.tar.gz

Download URL kasushi-0.1.2.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3f90fca5e3a8cef058846a1d3d86ac9c779d5ddff99c9ccfe4d3531ab8eca00f
BLAKE2b-256 checksum
How to use checksums
629de842befbb06d11dbec41dfc75463073361c6801cd4e4e3707a5f76d03581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.63.0 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / kasushi-0.1.2-py3-none-any.whl

Download URL kasushi-0.1.2-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
084fab8b6009f88091a8717e2bc498538c17c8d5177b205c27675a248d5cabc6
BLAKE2b-256 checksum
How to use checksums
4ca93a089db6813a44deabe465018c2e7cd2fb5c71b07e5df8858a822f42bf6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.63.0 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page