Open MCausc78 opened 4 months ago
Hai, what's the progress on getting commands working? I'm hoping to use this package in an up-coming project, so I wanted to see if you need any help getting commands finished!
Hai, what's the progress on getting commands working? I'm hoping to use this package in an up-coming project, so I wanted to see if you need any help getting commands finished!
The main problem is self
binding, which is somehow complex thing to properly implement due to CPython not providing any information (except name, docs and signature) if function is declared in class.
Right now I have very bare commands prototype in my bot but it doesn't parse signature and just gives Context with ctx.args
, ctx.prefix
, and ctx.subcommand
.
Ah alright, good luck with getting it working, keep me posted!
Current bot example:
import pyvolt
from pyvolt.ext import commands
bot = commands.Bot(
'!',
bot=False,
self_bot=True,
token='your token lol',
)
@bot.command()
async def ping(ctx: commands.Context[commands.Bot]):
await ctx.send('pong!')
@bot.command()
@commands.user_command
async def gping(ctx: commands.Context[commands.Bot]):
await ctx.send('pong! [global command]')
bot.run()
The commands.user_command
would bypass self_bot
check (allow everyone to invoke this command, including the logged in user).
Copy it from discord.py and re-add
self_bot
anduser_bot
parameters