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)