From d913af437810541d4ff329f2c10f5eb4d36848bf Mon Sep 17 00:00:00 2001 From: Milka64 Date: Fri, 29 Dec 2023 11:54:19 +0100 Subject: [PATCH] WIP #32 --- .gitlab-ci.yml | 2 +- kabot/kabot/utils/texte.py | 18 ++++++++++++++++++ kabot/setup.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39806f5..100f19f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ stages: variables: GL_TOKEN: $GL_TOKEN - VERSION: '0.2.6' + VERSION: '0.2.7' deploy: stage: deploy diff --git a/kabot/kabot/utils/texte.py b/kabot/kabot/utils/texte.py index 303a31d..716c184 100644 --- a/kabot/kabot/utils/texte.py +++ b/kabot/kabot/utils/texte.py @@ -53,11 +53,29 @@ class Texte(commands.Cog): @commands.Cog.listener() async def on_ready(self): + for channel in bot.get_all_channels(): + if channel.name == text_channel: + current_chan = channel + if nickname: + await bot.user.edit(nick=nickname) + await current_chan.send('Le troll est dans la place !') + self.kron.start() @commands.Cog.listener() async def on_message(self, message): if message.author == self.bot.user or message.content.startswith('!'): + if message.content.startswith('!'): + for channel in self.bot.get_all_channels(): + if channel.name == self.text_chan: + current_chan = channel + async for msg in current_chan.history(limit=1): + last_message = msg + ctx = await self.bot.get_context(last_message) + ctx.message.content = "" + cmd_name = message.content.split()[0].replace('!','') + cmd = self.bot.get_command(cmd_name) + await cmd.invoke(ctx) return else: if self.bot.user in message.mentions \ diff --git a/kabot/setup.py b/kabot/setup.py index f868440..d4447e1 100644 --- a/kabot/setup.py +++ b/kabot/setup.py @@ -61,6 +61,6 @@ setup( test_suite='tests', tests_require=test_requirements, url='https://github.com/None/kabot', - version='0.2.6', + version='0.2.7', zip_safe=False, )