A disnake extension including useful tools for bot development and debugging.
Project description
disnake-jishaku
a debugging and utility extension for disnake bots
disnake-jishaku is an extension for bot developers that enables rapid prototyping, experimentation, and debugging of features for bots.
One of jishaku's core philosophies is to be dynamic and easy-to-use. Here's the two step install:
- Download disnake-jishaku on the command line using pip:
pip install -U disnake-jishaku
- Load the extension in your bot code before it runs:
bot.load_extension('jishaku')That's it!
You can also import the module to use the command development utilities.
Index
- Index
- Command reference
- Installing development versions
- Embedded JSK
- Disabling the automatic result handle from "jsk py"
- Acknowledgements
Command reference
>
|
_ctx |
The Context that invoked the command. |
_bot |
The running Bot instance. |
_author _channel _guild _message _msg |
Shortcuts for attributes on _ctx .
|
_find _get |
Shortcuts for disnake.utils functions.
|
The underscore prefix on the provided variables is intended to help prevent shadowing when writing large blocks of code within the command.
If you decide that you don't want the prefix, you can disable it by setting the
JISHAKU_NO_UNDERSCORE
environment variable to true
.
Each Python command is individually scoped. That means variables you create won't be retained in later invocations.
You can use
jishaku retain on
to change this behavior and retain variables, and jishaku retain off
if you change your mind later.
> jishaku [dis|disassemble] <argument>
This command compiles Python code in an asynchronous context, and then disassembles the resulting function into Python bytecode in the style of dis.dis
.
This allows you to quickly and easily determine the bytecode that results from a given expression or piece of code. The code itself is not actually executed.
>
The shell command executes commands within your system shell.
|
>
|
>
This command reads a file from your file system, automatically detecting encoding and (if applicable) highlighting.
|
>
|
Installing development versions
If you'd like to test the latest versions of disnake-jishaku, you can do so by downloading from the git hosts instead of from PyPI.
From GitHub:
pip install -U "jishaku @ git+https://github.com/Kraots/jishaku@master"
Please note that the new 2020 dependency resolver now no longer discounts git package sources from reinstall prevention, which means that if you are installing the jishaku development version multiple times within the same version target you may run into pip just discarding the update.
If you run into such a problem, you can force jishaku to be reinstalled like this:
From GitHub:
pip install -U --force-reinstall "jishaku @ git+https://github.com/Kraots/jishaku@master"
You must have installed jishaku with one of the commands above before doing this else you will probably end up with a broken installation.
Embedded JSK
import os
# Setting the jsk command to return an embed
os.environ['JISHAKU_EMBEDDED_JSK'] = 'true'
# Setting the embed's colour
# Acceptable formats:
# 0x<hex>
# #<hex>
# 0x#<hex>
# rgb(<number>, <number>, <number>)
# Any of the classmethod in disnake.Colour
os.environ['JISHAKU_EMBEDDED_JSK_COLOUR'] = 0x2F3136
Disabling the automatic result handle from "jsk py"
Aditionally, you can also remove the result handle from the jsk py
, what that means is that it will only send the message of your result if you are returning something, it will not send embeds, files, or anything else automatically like it did before. This option is enabled by default, you can enable it by adding os.environ['JISHAKU_PY_RES'] = 'false'
in your code.
Acknowledgements
The documentation and this README uses icons from the Material Design Icon library, which is licensed under the Apache License Version 2.0.
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
File details
Details for the file disnake-jishaku-2.6.5.tar.gz
.
File metadata
- Download URL: disnake-jishaku-2.6.5.tar.gz
- Upload date:
- Size: 46.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8845d5be9a4c918b457bec11c5aa45627d21bd7d6c5e03ea48e0106774715ae6 |
|
MD5 | d70b3db0067b527c460159770609686b |
|
BLAKE2b-256 | 6a1e44d9685500d6c5e231bc543d30203400fcba78563372bad6caa53889d568 |