fix: striping all received messages

This commit is contained in:
Mindiell 2024-10-12 11:23:47 +02:00
parent 5c3080e289
commit 9d6612a9d7
2 changed files with 9 additions and 1 deletions

View File

@ -65,7 +65,7 @@ class HebdoBot(IrcBot):
""" """
channel = event.target channel = event.target
sender = event.source.nick sender = event.source.nick
message = event.arguments[0] message = event.arguments[0].strip()
if self.review.is_started: if self.review.is_started:
self.review.add_message(sender, message) self.review.add_message(sender, message)

View File

@ -10,3 +10,11 @@ def test_private_command(bot):
bot.test_private_message(bot.channel, SENDER, "!hello") bot.test_private_message(bot.channel, SENDER, "!hello")
assert len(bot.answers) == 1 assert len(bot.answers) == 1
assert bot.answers[0].message == "Vos commandes dans le salon public" assert bot.answers[0].message == "Vos commandes dans le salon public"
def test_public_message(bot):
# Cheating here to save message sent
bot.review.started = True
bot.test_public_message(bot.channel, SENDER, " hello ")
assert len(bot.answers) == 0
assert bot.review.messages[0].text == "hello"