fixing errors in slash commands

This commit is contained in:
Mylloon 2021-05-28 23:44:52 +02:00
parent 5ce54afa6e
commit 4b25f756f7
2 changed files with 18 additions and 13 deletions

View file

@ -116,14 +116,11 @@ class Fun(commands.Cog):
async def _love_error(self, ctx, error):
await ctx.send(str(error).replace('Member "', "Le membre **").replace('" not found', "** n'as pas été trouvé."))
@cog_ext.cog_slash(name="love", description = "Découvre la probabilité que ces deux personnes se mettent en couple.")
async def __love(self, ctx, user1 = None, user2 = None):
if user1 != None:
if user2 != None:
return await self._love(ctx, user1, user2, True)
else:
return await self._love(ctx, user1, True)
async def __love(self, ctx, user1: discord.Member, user2: discord.Member = None):
if user2 != None:
return await self._love(ctx, user1, user2, True)
else:
return await self._love(ctx, True)
return await self._love(ctx, user1, True)
@commands.command(name='8ball', aliases=['8b', '8balls'])
async def _8ball(self, ctx, fromSlash = False):
@ -140,7 +137,7 @@ class Fun(commands.Cog):
if str(error) == "question is a required argument that is missing.":
await ctx.send(f"Mauvaise syntaxe : `{ctx.prefix}8ball/8b/8balls <question>`.")
@cog_ext.cog_slash(name="8ball", description = "Répond à ta question 🔮.")
async def __8ball(self, ctx):
async def __8ball(self, ctx, question):
await self._8ball(ctx, True)
@commands.command(name='mock')

View file

@ -15,8 +15,14 @@ class Games(commands.Cog):
self.guessing_game = {}
@commands.command(name='chifumi', aliases = ["shifumi", "ppc"])
async def _chifumi(self, ctx, *, choix):
async def _chifumi(self, ctx, *choix):
"""Un simple Chifumi contre le bot.\n ➡ Syntaxe: {PREFIX}chifumi/shifumi/ppc <pierre/papier/ciseaux>"""
fromSlash = False
if len(choix) < 1:
raise ModuleNotFoundError
if choix[-1] == True:
fromSlash = choix[-1]
choix = choix[0]
choix_jeu = ["Pierre ✊", "Papier 🧻", "Ciseaux ✂"]
orditxt = choice(choix_jeu)
@ -39,12 +45,15 @@ class Games(commands.Cog):
embed = discord.Embed(title = f"{choix_jeu[choix][-1:]}VS {choix_jeu[ordi][-1:]}", description = description)
embed.set_author(name = ctx.author.name, icon_url = ctx.author.avatar_url)
await ctx.send(embed = embed)
await ctx.message.add_reaction(emoji = '')
if fromSlash != True:
await ctx.message.add_reaction(emoji = '')
return await ctx.send(embed = embed)
@_chifumi.error
async def _chifumi_error(self, ctx, error):
await ctx.send(f"Mauvaise syntaxe : `{ctx.prefix}chifumi/shifumi/ppc <pierre/papier/ciseaux>`.")
@cog_ext.cog_slash(name="chifumi", description = "Un simple Chifumi contre le bot.")
async def __chifumi(self, ctx, choix):
return await self._chifumi(ctx, choix, True)
@commands.command(name='plusoumoins', aliases = ['+ou-', '+-'])
async def _plusoumoins(self, ctx):
@ -93,7 +102,6 @@ class Games(commands.Cog):
del self.guessing_game[str(ctx.author.id)]
await ctx.send(f"T'as pas trouvé {ctx.author.mention}... dommage, c'était {number}.")
@commands.command(name='pileouface', aliases=['pf'])
async def _pileouface(self, ctx, fromSlash = False):
"""Pile ou face.\n ➡ Syntaxe: {PREFIX}pileouface/pf"""