From 5eed8bab0625cda2ea12232eac56d59735beab3e Mon Sep 17 00:00:00 2001 From: BFlow Date: Sat, 16 Nov 2019 18:37:10 +0100 Subject: [PATCH] ajout de la commande lines --- kabot/kabot/kabot.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kabot/kabot/kabot.py b/kabot/kabot/kabot.py index fb44f8c..6b985e3 100644 --- a/kabot/kabot/kabot.py +++ b/kabot/kabot/kabot.py @@ -75,6 +75,14 @@ class Mybot(commands.Cog): async def ping(self, message): await message.channel.send('pong') + @commands.command(help='count lines numbers in quote file') + async def lines(self, message): + path = '/home/mika/.kabot/%s.log' % message.channel + with open(path, 'r') as f: + lines = f.read().splitlines() + nb_lines = len(lines) + await message.channel.send("j'ai %s lignes dans mon stock" % nb_lines) + @commands.command(help="optionnal args : [livre] [character]") async def kaamelott(self, ctx, *args): response = None