Skip to main content

A debugging and testing cog for discord.py rewrite

Project description

jishaku is a debugging and experimenting cog for Discord bots using discord.py@rewrite.

It is locked to Python 3.6 and requirements will shift as new discord.py and Python versions release. This repo primarily exists for the purpose of example and usage in other bot projects.

Installing

This cog does not work without discord.py@rewrite

Not having it installed properly will make the cog fail to install

Use the following to install discord.py@rewrite on the latest version:

python3 -m pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]

This cog can be installed through the following command:

python3 -m pip install -U git+https://github.com/Gorialis/jishaku@master#egg=jishaku

It can be used in bots directly using

bot.load_extension("jishaku")

Functionality

Extension loading/unloading

Jishaku contains 3 commands for loading and unloading extensions:

  • [jishaku|jsk] load [exts...]

  • [jishaku|jsk] unload [exts...]

  • [jishaku|jsk] reload [exts...]

These commands do as described, with reload unloading and loading cogs again for quick reloads. [exts...] are a set of extension names separated by spaces, such as cogs.one cogs.two cogs.three.

Python REPL

Jishaku can evaluate Python code with [jishaku|jsk] [python|py] <codeline|codeblock>.

By default eval-mode is used, allowing you to type statements like 3+4 or _ctx.author.name to return their result. Eval-mode supports async syntax, so you can do evaluations like await coro() or [m async for m in _ctx.history()].

Exec-mode will be used whenever eval-mode fails. In this mode, you can use control flow and return manually.

Variables available in both eval and exec modes are:

  • _bot: Represents the current commands.Bot instance.

  • _ctx: Represents the current commands.Context.

  • _message: Shorthand for _ctx.message

  • _msg: Shorthand for _ctx.message

  • _guild: Shorthand for _ctx.guild

  • _channel: Shorthand for _ctx.channel

  • _author: Shorthand for _ctx.message.author

_bot is globally available, but all other REPL variables are local (that is, editing or overwriting them won’t affect other current repl sessions)

Shell Interaction

Jishaku can interact with CLI programs with [jishaku|jsk] sh <codeline|codeblock>.

This opens a subprocess, meaning you can run standard shell commands like git pull or such, but cannot use specific shell syntax like piping or envvars.

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

jishaku-0.0.4.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file jishaku-0.0.4.tar.gz.

File metadata

  • Download URL: jishaku-0.0.4.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for jishaku-0.0.4.tar.gz
Algorithm Hash digest
SHA256 76ac82ea0963bd9f4144c3d67e5f23b5c40f716160cdf548b4143b05e549d481
MD5 8988a02b4f28a078ec7c4055e7488e8d
BLAKE2b-256 7c0635367625dc8e45bbae46ad4b5c7c66a65f8e1bf68b1e70db4785e51083ea

See more details on using hashes here.

Supported by

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