A discord.py extension that automatically generates interaction help commands based on Dict.
Project description
discord.ext.help
A discord.py extension that automatically generates interaction help commands based on Dict.
Dependency
- Defxult/reactionmenu
- discord.py 2.0 and later
This library is not guaranteed to be compatible with the discord.py fork (Because the reactionmenu used in this library is probably dedicated to discord.py).
Also, for pycord, you can reproduce the behavior of this library by using discord.ext.pages
.
How To Use
Install
pip install discord-ext-help
example
import discord
from discord import app_commands
from discord.ext import commands
from discord_ext_help import helpExtension, command_list, options
from reactionmenu import ViewMenu
command_list.cmdlist = [
{
"name": "/test",
"id": None,
"description": "this is a test command!",
"args": [],
"example": "https://media1.tenor.com/m/m1Tu9iU-zqQAAAAC/wumpus-discord.gif",
},
{
"name": "/say",
"id": None,
"description": "The character entered in the argument is uttered!",
"args": [
{
"name": "text",
"description": None,
"required": True,
}
],
"example": "https://media1.tenor.com/m/m1Tu9iU-zqQAAAAC/wumpus-discord.gif",
},
]
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
@bot.event
async def setup_hook():
# ↓ If you use the bot only within a particular guild ↓
# await bot.tree.sync(guild=discord.Object(000000000000000000))
# options.guild = 961559815191134229 # If you use the bot only within a particular guild
# ↓ For use with a public Bot ↓
await bot.tree.sync()
# ↓ If you use the bot only within a particular guild ↓
# @bot.tree.command(
# name="help", description="show help", guild=discord.Object(serverId)
# )
# ↓ For use with a public Bot ↓
@bot.tree.command(
name="help", description="show help"
)
@app_commands.choices(command=options.cmds)
async def help(interaction: discord.Interaction, command: str = None):
await interaction.response.defer()
res = await helpExtension.response(interaction, command)
menu = res["resp"]
if res["type"] == "menu":
await menu.start()
return
await interaction.followup.send(embed=menu)
helpExtension.setup()
bot.run(token)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
discord_ext_help-0.1.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for discord_ext_help-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57b5418048eae865b2d4bd4913126d67b1cde89513a6af9bcb2ad42f41962d9b |
|
MD5 | 6c5207895e5d5e6e59d0b21753fae63f |
|
BLAKE2b-256 | 828c3f8b40dc697a7c128dcf2d8e402a4f508e232737cecaace4350a32676146 |