fix on_message

This commit is contained in:
Milka64 2019-09-27 23:46:59 +02:00
parent 2f8bf3202b
commit 3c24bf434e

View file

@ -6,12 +6,30 @@ import random
import discord import discord
from discord.ext import commands from discord.ext import commands
def quotes():
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)
return response
def main(): def main():
client = discord.Client() client = discord.Client()
token = "NjI3MTM3NDY1MDA5ODMxOTQ2.XY4Raw.pw8sAen3bNR5aYsoTChQOudM0L8" token = "NjI3MTM3NDY1MDA5ODMxOTQ2.XY4Raw.pw8sAen3bNR5aYsoTChQOudM0L8"
bot = commands.Bot(command_prefix='!') 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') @bot.command(name='test', help='Responds with a random quote')
async def nine_nine(ctx): async def nine_nine(ctx):
quotes = [ quotes = [
@ -27,14 +45,15 @@ def main():
response = random.choice(quotes) response = random.choice(quotes)
await ctx.send(response) await ctx.send(response)
@client.event @bot.event
async def on_ready():
print(f'{client.user.name} has connected to Discord!')
@client.event
async def on_message(message): async def on_message(message):
print(message.content) print(message.content)
if message.author == client.user: if message.author == bot.user:
return return
if message.content == 'pwet':
await message.channel.send('pong')
elif 'ben' in str(message.author):
await message.channel.send(quotes())
bot.run(token) bot.run(token)