correction cmd say

This commit is contained in:
BFlow 2020-09-04 22:31:36 +02:00
parent 9fd12991b6
commit 6b3e0a0b4f

View file

@ -359,9 +359,11 @@ class Mybot(commands.Cog):
@commands.command(help="Faire dire des choses au bot") @commands.command(help="Faire dire des choses au bot")
async def say(self, ctx, *message): async def say(self, ctx, *message):
sentence = ' '.join(message) sentence = ' '.join(message)
channel = [x for x in self.bot.get_all_channels() if x.name == "général"][0]
if sentence.startswith('!'): if sentence.startswith('!'):
command_name = sentence.split()[0].replace('!', '') command_name = sentence.split()[0].replace('!', '')
cmd = self.bot.get_command(command_name) cmd = self.bot.get_command(command_name)
ctx.channel = channel
await cmd.invoke(ctx) await cmd.invoke(ctx)
else: else:
for word in sentence.split(): for word in sentence.split():
@ -371,7 +373,6 @@ class Mybot(commands.Cog):
for member in members: for member in members:
if member.name == word[1:]: if member.name == word[1:]:
sentence = sentence.replace(word, member.mention) sentence = sentence.replace(word, member.mention)
channel = [x for x in self.bot.get_all_channels() if x.name == "général"][0]
await channel.send(sentence) await channel.send(sentence)
@commands.command(help='slap this ass') @commands.command(help='slap this ass')