mirror of
https://github.com/RafaelSolVargas/Vulkan.git
synced 2025-10-29 16:57:23 +00:00
Updating help command in Vulkan
This commit is contained in:
parent
ea5245cf95
commit
5b4c5b49f1
@ -3,6 +3,7 @@ from discord import Client
|
|||||||
from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument
|
from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from config import config
|
from config import config
|
||||||
|
from config import help
|
||||||
|
|
||||||
|
|
||||||
class Control(commands.Cog):
|
class Control(commands.Cog):
|
||||||
@ -11,11 +12,12 @@ class Control(commands.Cog):
|
|||||||
def __init__(self, bot: Client):
|
def __init__(self, bot: Client):
|
||||||
self.__bot = bot
|
self.__bot = bot
|
||||||
self.__comandos = {
|
self.__comandos = {
|
||||||
'MUSIC': ['resume', 'pause', 'loop', 'stop', 'skip', 'play', 'queue', 'clear', 'np', 'shuffle', 'move', 'remove', 'reset'],
|
'MUSIC': ['resume', 'pause', 'loop', 'stop',
|
||||||
'WARFRAME': ['warframe'],
|
'skip', 'play', 'queue', 'clear',
|
||||||
'RANDOM': ['escolha', 'cara', 'random'],
|
'np', 'shuffle', 'move', 'remove',
|
||||||
'HELP': ['help'],
|
'reset', 'prev', 'history'],
|
||||||
'OTHERS': ['frase']
|
'RANDOM': ['choose', 'cara', 'random']
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
@ -42,6 +44,7 @@ class Control(commands.Cog):
|
|||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
else:
|
else:
|
||||||
|
print(error)
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=config.ERROR_TITLE,
|
title=config.ERROR_TITLE,
|
||||||
description=config.UNKNOWN_ERROR,
|
description=config.UNKNOWN_ERROR,
|
||||||
@ -49,37 +52,70 @@ class Control(commands.Cog):
|
|||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name="help", help=config.HELP_HELP, aliases=['h', 'ajuda'])
|
@commands.command(name="help", help=help.HELP_HELP, description=help.HELP_HELP_LONG, aliases=['h', 'ajuda'])
|
||||||
async def help_msg(self, ctx):
|
async def help_msg(self, ctx, command_help=''):
|
||||||
helptxt = ''
|
if command_help != '':
|
||||||
help_music = '🎧 `MUSIC`\n'
|
for command in self.__bot.commands:
|
||||||
help_random = '🎲 `RANDOM`\n'
|
if command.name == command_help:
|
||||||
help_warframe = '🎮 `WARFRAME`\n'
|
txt = command.description if command.description else command.help
|
||||||
help_help = '👾 `HELP`\n'
|
|
||||||
help_others = '🕹️ `OTHERS`\n'
|
|
||||||
|
|
||||||
for command in self.__bot.commands:
|
embedhelp = discord.Embed(
|
||||||
if command.name in self.__comandos['MUSIC']:
|
title=f'**Description of {command_help}** command',
|
||||||
help_music += f'**{command}** - {command.help}\n'
|
description=txt,
|
||||||
elif command.name in self.__comandos['HELP']:
|
colour=config.COLOURS['blue']
|
||||||
help_help += f'**{command}** - {command.help}\n'
|
)
|
||||||
elif command.name in self.__comandos['OTHERS']:
|
|
||||||
help_others += f'**{command}** - {command.help}\n'
|
|
||||||
elif command.name in self.__comandos['WARFRAME']:
|
|
||||||
help_warframe += f'**{command}** - {command.help}\n'
|
|
||||||
else:
|
|
||||||
help_random += f'**{command}** - {command.help}\n'
|
|
||||||
|
|
||||||
helptxt = f'{help_music}\n{help_warframe}\n{help_random}\n{help_others}\n{help_help}'
|
await ctx.send(embed=embedhelp)
|
||||||
|
return
|
||||||
|
|
||||||
embedhelp = discord.Embed(
|
embedhelp = discord.Embed(
|
||||||
title=f'**Available Commands of {self.__bot.user.name}**',
|
title='Command Help',
|
||||||
description=helptxt,
|
description=f'Command {command_help} Not Found',
|
||||||
|
colour=config.COLOURS['red']
|
||||||
|
)
|
||||||
|
|
||||||
|
await ctx.send(embed=embedhelp)
|
||||||
|
else:
|
||||||
|
|
||||||
|
helptxt = ''
|
||||||
|
help_music = '🎧 `MUSIC`\n'
|
||||||
|
help_random = '🎲 `RANDOM`\n'
|
||||||
|
help_help = '👾 `HELP`\n'
|
||||||
|
|
||||||
|
for command in self.__bot.commands:
|
||||||
|
if command.name in self.__comandos['MUSIC']:
|
||||||
|
help_music += f'**{command}** - {command.help}\n'
|
||||||
|
|
||||||
|
elif command.name in self.__comandos['RANDOM']:
|
||||||
|
help_random += f'**{command}** - {command.help}\n'
|
||||||
|
|
||||||
|
else:
|
||||||
|
help_help += f'**{command}** - {command.help}\n'
|
||||||
|
|
||||||
|
helptxt = f'\n{help_music}\n{help_help}\n{help_random}'
|
||||||
|
|
||||||
|
embedhelp = discord.Embed(
|
||||||
|
title=f'**Available Commands of {self.__bot.user.name}**',
|
||||||
|
description=helptxt,
|
||||||
|
colour=config.COLOURS['blue']
|
||||||
|
)
|
||||||
|
|
||||||
|
embedhelp.set_thumbnail(url=self.__bot.user.avatar_url)
|
||||||
|
await ctx.send(embed=embedhelp)
|
||||||
|
|
||||||
|
@commands.command(name='invite', help=help.HELP_INVITE, description=help.HELP_INVITE_LONG)
|
||||||
|
async def invite_bot(self, ctx):
|
||||||
|
invite_url = 'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot>)'.format(
|
||||||
|
self.__bot.user.id)
|
||||||
|
txt = config.INVITE_MESSAGE.format(invite_url)
|
||||||
|
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Invite Vulkan",
|
||||||
|
description=txt,
|
||||||
colour=config.COLOURS['blue']
|
colour=config.COLOURS['blue']
|
||||||
)
|
)
|
||||||
|
|
||||||
embedhelp.set_thumbnail(url=self.__bot.user.avatar_url)
|
await ctx.send(embed=embed)
|
||||||
await ctx.send(embed=embedhelp)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import discord
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from config import config
|
from config import config
|
||||||
|
from config import help
|
||||||
from vulkan.music.Player import Player
|
from vulkan.music.Player import Player
|
||||||
from vulkan.music.utils import *
|
from vulkan.music.utils import *
|
||||||
|
|
||||||
@ -13,10 +14,25 @@ class Music(commands.Cog):
|
|||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_ready(self) -> None:
|
async def on_ready(self) -> None:
|
||||||
|
"""Load a player for each guild that the Bot are"""
|
||||||
for guild in self.__bot.guilds:
|
for guild in self.__bot.guilds:
|
||||||
self.__guilds[guild] = Player(self.__bot, guild)
|
self.__guilds[guild] = Player(self.__bot, guild)
|
||||||
|
print(f'Player for guild {guild.name} created')
|
||||||
|
|
||||||
@commands.command(name="play", help=config.HELP_PLAY, aliases=['p', 'tocar'])
|
@commands.Cog.listener()
|
||||||
|
async def on_guild_join(self, guild) -> None:
|
||||||
|
"""Load a player when joining a guild"""
|
||||||
|
self.__guilds[guild] = Player(self.__bot, guild)
|
||||||
|
print(f'Player for guild {guild.name} created')
|
||||||
|
|
||||||
|
@commands.Cog.listener()
|
||||||
|
async def on_guild_remove(self, guild) -> None:
|
||||||
|
"""Removes the player of the guild if banned"""
|
||||||
|
if guild in self.__guilds.keys():
|
||||||
|
self.__guilds.pop(guild, None)
|
||||||
|
print(f'Player for guild {guild.name} destroyed')
|
||||||
|
|
||||||
|
@commands.command(name="play", help=help.HELP_PLAY, description=help.HELP_PLAY_LONG, aliases=['p', 'tocar'])
|
||||||
async def play(self, ctx, *args) -> None:
|
async def play(self, ctx, *args) -> None:
|
||||||
track = " ".join(args)
|
track = " ".join(args)
|
||||||
requester = ctx.author.name
|
requester = ctx.author.name
|
||||||
@ -29,12 +45,12 @@ class Music(commands.Cog):
|
|||||||
if is_connected(ctx) == None:
|
if is_connected(ctx) == None:
|
||||||
success = await player.connect(ctx)
|
success = await player.connect(ctx)
|
||||||
if success == False:
|
if success == False:
|
||||||
await self.__send_embed(ctx, config.ERROR_TITLE, config.NO_CHANNEL, 'red')
|
await self.__send_embed(ctx, config.IMPOSSIBLE_MOVE, config.NO_CHANNEL, 'red')
|
||||||
return
|
return
|
||||||
|
|
||||||
await player.play(ctx, track, requester)
|
await player.play(ctx, track, requester)
|
||||||
|
|
||||||
@commands.command(name="queue", help=config.HELP_QUEUE, aliases=['q', 'fila'])
|
@commands.command(name="queue", help=help.HELP_QUEUE, description=help.HELP_QUEUE_LONG, aliases=['q', 'fila'])
|
||||||
async def queue(self, ctx) -> None:
|
async def queue(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -43,7 +59,7 @@ class Music(commands.Cog):
|
|||||||
embed = await player.queue()
|
embed = await player.queue()
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name="skip", help=config.HELP_SKIP, aliases=['s', 'pular'])
|
@commands.command(name="skip", help=help.HELP_SKIP, description=help.HELP_SKIP_LONG, aliases=['s', 'pular'])
|
||||||
async def skip(self, ctx) -> None:
|
async def skip(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -51,7 +67,7 @@ class Music(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await player.skip(ctx)
|
await player.skip(ctx)
|
||||||
|
|
||||||
@commands.command(name='stop', help=config.HELP_STOP, aliases=['parar'])
|
@commands.command(name='stop', help=help.HELP_STOP, description=help.HELP_STOP_LONG, aliases=['parar'])
|
||||||
async def stop(self, ctx) -> None:
|
async def stop(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -59,7 +75,7 @@ class Music(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await player.stop()
|
await player.stop()
|
||||||
|
|
||||||
@commands.command(name='pause', help=config.HELP_PAUSE, aliases=['pausar'])
|
@commands.command(name='pause', help=help.HELP_PAUSE, description=help.HELP_PAUSE_LONG, aliases=['pausar'])
|
||||||
async def pause(self, ctx) -> None:
|
async def pause(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -69,7 +85,7 @@ class Music(commands.Cog):
|
|||||||
if success:
|
if success:
|
||||||
await self.__send_embed(ctx, config.SONG_PLAYER, config.SONG_PAUSED, 'blue')
|
await self.__send_embed(ctx, config.SONG_PLAYER, config.SONG_PAUSED, 'blue')
|
||||||
|
|
||||||
@commands.command(name='resume', help=config.HELP_RESUME, aliases=['soltar'])
|
@commands.command(name='resume', help=help.HELP_RESUME, description=help.HELP_RESUME_LONG, aliases=['soltar'])
|
||||||
async def resume(self, ctx) -> None:
|
async def resume(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -79,7 +95,7 @@ class Music(commands.Cog):
|
|||||||
if success:
|
if success:
|
||||||
await self.__send_embed(ctx, config.SONG_PLAYER, config.SONG_RESUMED, 'blue')
|
await self.__send_embed(ctx, config.SONG_PLAYER, config.SONG_RESUMED, 'blue')
|
||||||
|
|
||||||
@commands.command(name='prev', help=config.HELP_PREV, aliases=['anterior'])
|
@commands.command(name='prev', help=help.HELP_PREV, description=help.HELP_PREV_LONG, aliases=['anterior'])
|
||||||
async def prev(self, ctx) -> None:
|
async def prev(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -88,12 +104,12 @@ class Music(commands.Cog):
|
|||||||
if is_connected(ctx) == None:
|
if is_connected(ctx) == None:
|
||||||
success = await player.connect(ctx)
|
success = await player.connect(ctx)
|
||||||
if success == False:
|
if success == False:
|
||||||
await self.__send_embed(ctx, config.ERROR_TITLE, config.NO_CHANNEL, 'red')
|
await self.__send_embed(ctx, config.IMPOSSIBLE_MOVE, config.NO_CHANNEL, 'red')
|
||||||
return
|
return
|
||||||
|
|
||||||
await player.play_prev(ctx)
|
await player.play_prev(ctx)
|
||||||
|
|
||||||
@commands.command(name='history', help=config.HELP_HISTORY, aliases=['historico'])
|
@commands.command(name='history', help=help.HELP_HISTORY, description=help.HELP_HISTORY_LONG, aliases=['historico'])
|
||||||
async def history(self, ctx) -> None:
|
async def history(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -102,7 +118,7 @@ class Music(commands.Cog):
|
|||||||
embed = player.history()
|
embed = player.history()
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name='loop', help=config.HELP_LOOP, aliases=['l', 'repeat'])
|
@commands.command(name='loop', help=help.HELP_LOOP, description=help.HELP_LOOP_LONG, aliases=['l', 'repeat'])
|
||||||
async def loop(self, ctx, args: str) -> None:
|
async def loop(self, ctx, args: str) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -111,7 +127,7 @@ class Music(commands.Cog):
|
|||||||
description = await player.loop(args)
|
description = await player.loop(args)
|
||||||
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
||||||
|
|
||||||
@commands.command(name='clear', help=config.HELP_CLEAR, aliases=['c', 'limpar'])
|
@commands.command(name='clear', help=help.HELP_CLEAR, description=help.HELP_CLEAR_LONG, aliases=['c', 'limpar'])
|
||||||
async def clear(self, ctx) -> None:
|
async def clear(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -119,7 +135,7 @@ class Music(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
await player.clear()
|
await player.clear()
|
||||||
|
|
||||||
@commands.command(name='np', help=config.HELP_NP, aliases=['playing', 'now'])
|
@commands.command(name='np', help=help.HELP_NP, description=help.HELP_NP_LONG, aliases=['playing', 'now'])
|
||||||
async def now_playing(self, ctx) -> None:
|
async def now_playing(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -129,7 +145,7 @@ class Music(commands.Cog):
|
|||||||
await self.__clean_messages(ctx)
|
await self.__clean_messages(ctx)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name='shuffle', help=config.HELP_SHUFFLE, aliases=['aleatorio'])
|
@commands.command(name='shuffle', help=help.HELP_SHUFFLE, description=help.HELP_SHUFFLE_LONG, aliases=['aleatorio'])
|
||||||
async def shuffle(self, ctx) -> None:
|
async def shuffle(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -138,7 +154,7 @@ class Music(commands.Cog):
|
|||||||
description = await player.shuffle()
|
description = await player.shuffle()
|
||||||
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
||||||
|
|
||||||
@commands.command(name='move', help=config.HELP_MOVE, aliases=['m', 'mover'])
|
@commands.command(name='move', help=help.HELP_MOVE, description=help.HELP_MOVE_LONG, aliases=['m', 'mover'])
|
||||||
async def move(self, ctx, pos1, pos2='1') -> None:
|
async def move(self, ctx, pos1, pos2='1') -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -147,7 +163,7 @@ class Music(commands.Cog):
|
|||||||
description = await player.move(pos1, pos2)
|
description = await player.move(pos1, pos2)
|
||||||
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
||||||
|
|
||||||
@commands.command(name='remove', help=config.HELP_REMOVE, aliases=['remover'])
|
@commands.command(name='remove', help=help.HELP_REMOVE, description=help.HELP_REMOVE_LONG, aliases=['remover'])
|
||||||
async def remove(self, ctx, position) -> None:
|
async def remove(self, ctx, position) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player == None:
|
if player == None:
|
||||||
@ -156,7 +172,7 @@ class Music(commands.Cog):
|
|||||||
description = await player.remove(position)
|
description = await player.remove(position)
|
||||||
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
await self.__send_embed(ctx, config.SONG_PLAYER, description, 'blue')
|
||||||
|
|
||||||
@commands.command(name='reset', help=config.HELP_RESET, aliases=['resetar'])
|
@commands.command(name='reset', help=help.HELP_RESET, description=help.HELP_RESET_LONG, aliases=['resetar'])
|
||||||
async def reset(self, ctx) -> None:
|
async def reset(self, ctx) -> None:
|
||||||
player = self.__get_player(ctx)
|
player = self.__get_player(ctx)
|
||||||
if player != None:
|
if player != None:
|
||||||
@ -185,7 +201,9 @@ class Music(commands.Cog):
|
|||||||
if message.author == self.__bot.user:
|
if message.author == self.__bot.user:
|
||||||
if len(message.embeds) > 0:
|
if len(message.embeds) > 0:
|
||||||
embed = message.embeds[0]
|
embed = message.embeds[0]
|
||||||
if embed.title in config.SONGS_PLAYING_TITLES:
|
fields = embed.fields
|
||||||
|
|
||||||
|
if fields != discord.Embed.EmptyEmbed:
|
||||||
await message.delete()
|
await message.delete()
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -2,6 +2,7 @@ from random import randint, random
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from config import config
|
from config import config
|
||||||
|
from config import help
|
||||||
|
|
||||||
|
|
||||||
class Random(commands.Cog):
|
class Random(commands.Cog):
|
||||||
@ -10,14 +11,14 @@ class Random(commands.Cog):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.__bot = bot
|
self.__bot = bot
|
||||||
|
|
||||||
@commands.command(name='random', help=config.HELP_RANDOM)
|
@commands.command(name='random', help=help.HELP_RANDOM, description=help.HELP_RANDOM_LONG)
|
||||||
async def random(self, ctx, arg: str):
|
async def random(self, ctx, arg: str) -> None:
|
||||||
try:
|
try:
|
||||||
arg = int(arg)
|
arg = int(arg)
|
||||||
|
|
||||||
except Exception as e:
|
except:
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
description='Manda um número aí ow animal',
|
description=config.ERROR_NUMBER,
|
||||||
colour=config.COLOURS['red']
|
colour=config.COLOURS['red']
|
||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
@ -32,14 +33,14 @@ class Random(commands.Cog):
|
|||||||
|
|
||||||
x = randint(a, b)
|
x = randint(a, b)
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title=f'Número Aleatório entre {a, b}',
|
title=f'Random number between [{a, b}]',
|
||||||
description=x,
|
description=x,
|
||||||
colour=config.COLOURS['green']
|
colour=config.COLOURS['green']
|
||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name='cara', help=config.HELP_CARA)
|
@commands.command(name='cara', help=help.HELP_CARA, description=help.HELP_CARA_LONG)
|
||||||
async def cara(self, ctx):
|
async def cara(self, ctx) -> None:
|
||||||
x = random()
|
x = random()
|
||||||
if x < 0.5:
|
if x < 0.5:
|
||||||
result = 'cara'
|
result = 'cara'
|
||||||
@ -48,13 +49,13 @@ class Random(commands.Cog):
|
|||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title='Cara Cora',
|
title='Cara Cora',
|
||||||
description=f'Resultado: {result}',
|
description=f'Result: {result}',
|
||||||
colour=config.COLOURS['green']
|
colour=config.COLOURS['green']
|
||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name='escolha', help=config.HELP_ESCOLHA)
|
@commands.command(name='choose', help=help.HELP_CHOOSE, description=help.HELP_CHOOSE_LONG)
|
||||||
async def escolher(self, ctx, *args: str):
|
async def choose(self, ctx, *args: str) -> None:
|
||||||
try:
|
try:
|
||||||
user_input = " ".join(args)
|
user_input = " ".join(args)
|
||||||
itens = user_input.split(sep=',')
|
itens = user_input.split(sep=',')
|
||||||
@ -62,16 +63,16 @@ class Random(commands.Cog):
|
|||||||
index = randint(0, len(itens)-1)
|
index = randint(0, len(itens)-1)
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title='Escolha de algo',
|
title='Choose something',
|
||||||
description=itens[index],
|
description=itens[index],
|
||||||
colour=config.COLOURS['green']
|
colour=config.COLOURS['green']
|
||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
except Exception as e:
|
except:
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title='Escolha de algo',
|
title='Choose something.',
|
||||||
description='Erro: Envie várias coisas separadas por vírgula',
|
description=f'Error: Use {config.BOT_PREFIX}help choose to understand this command.',
|
||||||
colour=config.COLOURS['green']
|
colour=config.COLOURS['red']
|
||||||
)
|
)
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user