fix repete jakot

This commit is contained in:
Milka64 2019-09-30 11:21:01 +02:00
parent c62385f79b
commit dc4e5e4912

View file

@ -8,27 +8,12 @@ from discord.ext import commands
import os import os
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
class Mybot(discord.Client): class Mybot(discord.Client):
bot = commands.Bot(command_prefix='!') bot = commands.Bot(command_prefix='!')
async def join(ctx): async def join_channel(self, message):
author = message.author channel = [x for x in self.get_all_channels() if x.name == "Général"][0]
channel = author.voice_channel await self.join(channel)
await self.join_voice_channel(channel)
async def ping(self, message): async def ping(self, message):
await message.channel.send('pong') await message.channel.send('pong')
@ -63,10 +48,10 @@ class Mybot(discord.Client):
else: else:
if self.user in message.mentions and len(message.mentions) < 3: if self.user in message.mentions and len(message.mentions) < 3:
path = '/tmp/%s.log' % message.channel path = '/tmp/%s.log' % message.channel
with open(path, 'a') as f :
f.write(message.content + '\n')
with open(path, 'r') as f : with open(path, 'r') as f :
lines = f.read().splitlines() lines = f.read().splitlines()
with open(path, 'a') as f :
f.write(message.content + '\n')
response = random.choice(lines).replace(str(self.user.id), str(message.author.id)) response = random.choice(lines).replace(str(self.user.id), str(message.author.id))
await message.channel.send(response) await message.channel.send(response)