pretifiy help and kaamelott command

This commit is contained in:
Milka64 2019-10-01 15:30:32 +02:00
parent a34c50c92f
commit 2c507fd041

View file

@ -13,24 +13,20 @@ class Mybot(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(help='test')
@commands.command()
async def join_channel(self, ctx):
channel = [x for x in self.bot.get_all_channels() if x.name == "Général"][0]
await channel.connect()
@commands.command()
@commands.command(help='check if bot always online')
async def ping(self, message):
await message.channel.send('pong')
@commands.command()
@commands.command(help="optionnal args : [livre] [character]")
async def kaamelott(self, ctx, *args):
response = None
if not args:
url = 'https://kaamelott.chaudie.re/api/random'
elif args[0] in 'help':
response = "!kaamelott [livre] [character]"
await ctx.send(response)
return
else:
args = list(args)
if args[0].isdigit():
@ -51,24 +47,11 @@ class Mybot(commands.Cog):
url = 'https://kaamelott.chaudie.re/api/random/livre/%s' % livre
try:
citation = requests.get(url).json()['citation']
response = "%s : %s" % (citation['infos']['personnage'], citation['citation'])
response = "%s :\n```\n%s\n```" % (citation['infos']['personnage'], citation['citation'])
except:
response = "Unknow error, try: !kaamelott [livre] [character]"
await ctx.send(response)
@commands.command()
async def kadoc(self, ctx):
quotes = [
"Pour savoir sy a du vent, il faut mettre son doigt dans le cul du coq.",
"Y'a des méchants ?",
"À Kabot ! À Kabot !",
"Tatan, elle fait des flans.",
"Les pattes de canaaaaaaaaaaaaaaaaaaaaaaaaaaaaard !",
"Elle est où la poulette ?",
"Mooordu! Mooordu! Mordu mordu mordu mordu la ligne !!!!",
]
response = random.choice(quotes)
await ctx.send(response)
async def on_message(self, message):
print(message.content)