From dc4e5e4912de84d23b9ea6821a86b4d7e8217422 Mon Sep 17 00:00:00 2001 From: Milka64 Date: Mon, 30 Sep 2019 11:21:01 +0200 Subject: [PATCH] fix repete jakot --- kabot/kabot/kabot.py | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index aa2e710..60c1d7e 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -8,27 +8,12 @@ from discord.ext import commands import os -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 - class Mybot(discord.Client): bot = commands.Bot(command_prefix='!') - async def join(ctx): - author = message.author - channel = author.voice_channel - await self.join_voice_channel(channel) + async def join_channel(self, message): + channel = [x for x in self.get_all_channels() if x.name == "Général"][0] + await self.join(channel) async def ping(self, message): await message.channel.send('pong') @@ -63,10 +48,10 @@ class Mybot(discord.Client): else: if self.user in message.mentions and len(message.mentions) < 3: path = '/tmp/%s.log' % message.channel - with open(path, 'a') as f : - f.write(message.content + '\n') with open(path, 'r') as f : 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)) await message.channel.send(response)