adding first true command who support the slash

This commit is contained in:
Mylloon 2021-05-28 19:59:31 +02:00
parent 414c4352f1
commit ed2d7b9a2e
3 changed files with 9 additions and 21 deletions

View file

@ -2,6 +2,7 @@ import discord, re
from discord.ext import commands
from random import randint, choice
from datetime import timedelta
from discord_slash import cog_ext, SlashContext
def setup(client):
client.add_cog(Fun(client))
@ -92,8 +93,8 @@ class Fun(commands.Cog):
await ctx.send(str(error).replace('Member "', "Le membre **").replace('" not found', "** n'as pas été trouvé."))
@commands.command(name='8ball', aliases=['8b', '8balls'])
async def _8ball(self, ctx, *, question):
"""Répond à ta question 🔮.\n ➡ Syntaxe: {PREFIX}8ball/8b <question>"""
async def _8ball(self, ctx):
"""Répond à ta question 🔮.\n ➡ Syntaxe: {PREFIX}8ball/8b"""
reponses=["c'est sûr.","il en est décidément ainsi.","incontestablement.","oui sans aucun doute.","tu peux t'y fier.","tel que je le vois, oui.","c'est le plus probable.",
"cela montre de bonnes perspectives.","certes.","les signes indiquent que oui.","ma réponse est oui.","ta question est trop floue, réessaie.","redemandes plus tard stp.",
"je ferais mieux de pas te le dire maintenant...","je ne peux pas le prédire actuellement :/","concentre-toi et redemande.","n'y comptes pas trop.","ma réponse est non.",
@ -105,10 +106,14 @@ class Fun(commands.Cog):
await ctx.send(f"Mauvaise syntaxe : `{ctx.prefix}8ball/8b/8balls <question>`.")
@commands.command(name='pileouface', aliases=['pf'])
async def _pileouface(self, ctx):
async def _pileouface(self, ctx, fromSlash = False):
"""Pile ou face.\n ➡ Syntaxe: {PREFIX}pileouface/pf"""
await ctx.message.add_reaction(emoji = '')
if fromSlash != True:
await ctx.message.add_reaction(emoji = '')
return await ctx.send(f"{'Pile' if randint(0,1) == 1 else 'Face'} !")
@cog_ext.cog_slash(name="pileouface", description = "Pile ou face.")
async def __pileouface(self, ctx: SlashContext):
await self._pileouface(ctx, True)
@commands.command(name='mock')
async def _mock(self, ctx):

View file

@ -1,16 +0,0 @@
from discord.ext import commands
from discord_slash import cog_ext, SlashContext
def setup(client):
client.add_cog(Slash(client))
class Slash(commands.Cog):
"""Slash commands test."""
def __init__(self, client):
self.client = client
@cog_ext.cog_slash(name="pingg")
async def pingg(self, ctx: SlashContext):
await ctx.send(content="Pong!")

View file

@ -20,7 +20,6 @@ client.load_extension("cogs.games")
client.load_extension("cogs.fun")
client.load_extension("cogs.autopublish")
client.load_extension("cogs.school")
client.load_extension("cogs.slash")
print("Terminé !")
@client.event