adding all school commands to slash
This commit is contained in:
parent
ca12edc1e2
commit
673377404e
1 changed files with 29 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from discord_slash import cog_ext
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(School(client))
|
||||
|
@ -12,13 +13,26 @@ class School(commands.Cog):
|
|||
|
||||
@commands.command(name='appel')
|
||||
# @commands.has_any_role("Professeur", "professeur", "Prof", "prof")
|
||||
async def _appel(self, ctx, *, voice_channel: int = None):
|
||||
async def _appel(self, ctx, *voice_channel: int):
|
||||
"""Fais l'appel.\n ➡ Syntaxe: {PREFIX}appel [ID salon vocal]"""
|
||||
fromSlash = False
|
||||
if len(voice_channel) > 0:
|
||||
if voice_channel[-1] == True:
|
||||
fromSlash = voice_channel[-1]
|
||||
voice_channel = voice_channel[:-1]
|
||||
if len(voice_channel) > 0:
|
||||
voice_channel = voice_channel[0]
|
||||
else:
|
||||
voice_channel = None
|
||||
|
||||
voice_channels = []
|
||||
voice_channels.extend(ctx.guild.voice_channels)
|
||||
await ctx.message.add_reaction(emoji = "✅")
|
||||
if fromSlash != True:
|
||||
await ctx.message.add_reaction(emoji = "✅")
|
||||
limite_voice_channels = 7
|
||||
if len(voice_channels) > limite_voice_channels and not voice_channel:
|
||||
if fromSlash == True:
|
||||
ctx.prefix = "/"
|
||||
return await ctx.send(f"""Désolé mais il y a plus de {limite_voice_channels} salons vocaux sur ce serveur, utilisez plutôt `{ctx.prefix}appel {{ID salon vocal}}`.
|
||||
\nPour savoir comment récuperer l'id d'un salon vous pouvez faire `{ctx.prefix}getid`.""")
|
||||
if voice_channel:
|
||||
|
@ -52,8 +66,19 @@ class School(commands.Cog):
|
|||
# await ctx.send("Tu n'as pas la permission de faire cette commande, demande à un professeur.")
|
||||
# else:
|
||||
await ctx.send(f"Une erreur est survenue, syntaxe: `{ctx.prefix}appel [ID salon vocal]`.")
|
||||
@cog_ext.cog_slash(name="appel", description = "Fais l'appel.")
|
||||
async def __appel(self, ctx, voice_channel: int = None):
|
||||
if voice_channel == None:
|
||||
return await self._appel(ctx, True)
|
||||
else:
|
||||
return await self._appel(ctx, voice_channel, True)
|
||||
|
||||
@commands.command(name='getid', hidden = True)
|
||||
async def _getid(self, ctx):
|
||||
await ctx.message.add_reaction(emoji = '✅')
|
||||
async def _getid(self, ctx, fromSlash):
|
||||
"""Tuto vidéo sur comment récupérer l'ID d'un utilisateur/salon"""
|
||||
if fromSlash != True:
|
||||
await ctx.message.add_reaction(emoji = '✅')
|
||||
return await ctx.send("Explication sur comment récuperer l'ID d'un utilisateur/salon : https://cdn.discordapp.com/attachments/640312926892195842/780802253258358834/GetID.mp4")
|
||||
@cog_ext.cog_slash(name="getid", description = "Tuto vidéo sur comment récupérer l'ID d'un utilisateur/salon")
|
||||
async def __getid(self, ctx):
|
||||
return await self._getid(ctx, True)
|
||||
|
|
Reference in a new issue