From b8483b4d547c30d78c3367b0fd240ebae8e90844 Mon Sep 17 00:00:00 2001 From: AlberLC Date: Sat, 3 Dec 2022 06:23:29 +0100 Subject: [PATCH] Update PollBot._get_options --- flanabot/bots/poll_bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flanabot/bots/poll_bot.py b/flanabot/bots/poll_bot.py index 856b7fa..7226676 100644 --- a/flanabot/bots/poll_bot.py +++ b/flanabot/bots/poll_bot.py @@ -7,7 +7,7 @@ from abc import ABC from typing import Iterable import flanautils -import pymongo +from flanautils import OrderedSet from multibot import MultiBot, admin, constants as multibot_constants from flanabot import constants @@ -60,9 +60,9 @@ class PollBot(MultiBot, ABC): if any(char in text for char in (',', ';', *conjunctions)): conjunction_parts = [f'(?:[,;]*{conjunction}[,;]*)+' for conjunction in conjunctions] options = re.split(f"{'|'.join(conjunction_parts)}|[,;]+", text) - return [option.strip() for option in options if option] + return list(OrderedSet(stripped_option for option in options if (stripped_option := option.strip()))) else: - return text.split() + return list(OrderedSet(text.split())) @staticmethod def _get_poll_message(message: Message) -> Message | None: