From 3c24bf434e72ffbad5cc729da003ac81402fe2c0 Mon Sep 17 00:00:00 2001 From: Milka64 Date: Fri, 27 Sep 2019 23:46:59 +0200 Subject: [PATCH] fix on_message --- kabot/kabot/kabot.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index 27a0446..7965c9d 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -6,12 +6,30 @@ import random import discord from discord.ext import commands +def quotes(): + quotes = [ + "Pour savoir s’y 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) + return response + def main(): client = discord.Client() token = "NjI3MTM3NDY1MDA5ODMxOTQ2.XY4Raw.pw8sAen3bNR5aYsoTChQOudM0L8" bot = commands.Bot(command_prefix='!') + @bot.command(name='ping', help='Responds with a random quote') + async def ping(ctx): + await ctx.send('pong') + @bot.command(name='test', help='Responds with a random quote') async def nine_nine(ctx): quotes = [ @@ -27,14 +45,15 @@ def main(): response = random.choice(quotes) await ctx.send(response) - @client.event - async def on_ready(): - print(f'{client.user.name} has connected to Discord!') - - @client.event + @bot.event async def on_message(message): print(message.content) - if message.author == client.user: + if message.author == bot.user: return + if message.content == 'pwet': + await message.channel.send('pong') + elif 'ben' in str(message.author): + await message.channel.send(quotes()) + bot.run(token)