Make filter_mention_ids and distribute_buttons public

This commit is contained in:
AlberLC
2022-11-14 04:44:03 +01:00
parent 9b1e9f6f2f
commit 6f09869a92
4 changed files with 8 additions and 8 deletions

View File

@@ -226,7 +226,7 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, WeatherBot, MultiBo
await self.delete_message(message) await self.delete_message(message)
await self.send( await self.send(
f'<b>Roles de {message.author.name}:</b>', f'<b>Roles de {message.author.name}:</b>',
self._distribute_buttons(options, vertically=True), self.distribute_buttons(options, vertically=True),
message, message,
buttons_key=ButtonsGroup.ROLES, buttons_key=ButtonsGroup.ROLES,
contents={'user_id': message.author.id} contents={'user_id': message.author.id}
@@ -248,7 +248,7 @@ class FlanaBot(Connect4Bot, PenaltyBot, PollBot, ScraperBot, WeatherBot, MultiBo
message.buttons_info.presser_user.roles.append(role) message.buttons_info.presser_user.roles.append(role)
user_role_names.append(role.name) user_role_names.append(role.name)
await self.edit(self._distribute_buttons(await self._role_state_options(message, user_role_names), vertically=True), message) await self.edit(self.distribute_buttons(await self._role_state_options(message, user_role_names), vertically=True), message)
message.buttons_info.presser_user.save() message.buttons_info.presser_user.save()

View File

@@ -94,14 +94,14 @@ class PenaltyBot(MultiBot, ABC):
@admin(send_negative=True) @admin(send_negative=True)
async def _on_ban(self, message: Message): async def _on_ban(self, message: Message):
for user in await self._find_users_to_punish(message): for user in await self._find_users_to_punish(message):
await self.ban(user, message, flanautils.words_to_time(await self._filter_mention_ids(message.text, message)), message) await self.ban(user, message, flanautils.words_to_time(await self.filter_mention_ids(message.text, message)), message)
@group @group
@bot_mentioned @bot_mentioned
@admin(send_negative=True) @admin(send_negative=True)
async def _on_mute(self, message: Message): async def _on_mute(self, message: Message):
for user in await self._find_users_to_punish(message): for user in await self._find_users_to_punish(message):
await self.mute(user, message, flanautils.words_to_time(await self._filter_mention_ids(message.text, message)), message) await self.mute(user, message, flanautils.words_to_time(await self.filter_mention_ids(message.text, message)), message)
@ignore_self_message @ignore_self_message
async def _on_new_message_raw(self, message: Message): async def _on_new_message_raw(self, message: Message):
@@ -118,7 +118,7 @@ class PenaltyBot(MultiBot, ABC):
return return
for user in await self._find_users_to_punish(message): for user in await self._find_users_to_punish(message):
await self.punish(user, message, flanautils.words_to_time(await self._filter_mention_ids(message.text, message)), message) await self.punish(user, message, flanautils.words_to_time(await self.filter_mention_ids(message.text, message)), message)
async def _on_ready(self): async def _on_ready(self):
await super()._on_ready() await super()._on_ready()

View File

@@ -95,7 +95,7 @@ class PollBot(MultiBot, ABC):
else: else:
buttons = list(message.contents['poll']['votes'].keys()) buttons = list(message.contents['poll']['votes'].keys())
await self.edit(self._distribute_buttons(buttons, vertically=True), message) await self.edit(self.distribute_buttons(buttons, vertically=True), message)
# ---------------------------------------------- # # ---------------------------------------------- #
# HANDLERS # # HANDLERS #
@@ -173,7 +173,7 @@ class PollBot(MultiBot, ABC):
if final_options := [f'{option[0].upper()}{option[1:]}' for option in self._get_options(message.text, discarded_words)]: if final_options := [f'{option[0].upper()}{option[1:]}' for option in self._get_options(message.text, discarded_words)]:
await self.send( await self.send(
f"Encuesta {'multirespuesta ' if is_multiple_answer else ''}en curso...", f"Encuesta {'multirespuesta ' if is_multiple_answer else ''}en curso...",
self._distribute_buttons(final_options, vertically=True), self.distribute_buttons(final_options, vertically=True),
message, message,
buttons_key=ButtonsGroup.POLL, buttons_key=ButtonsGroup.POLL,
contents={'poll': { contents={'poll': {

View File

@@ -50,7 +50,7 @@ class WeatherBot(MultiBot, ABC):
original_text_words = flanautils.remove_accents(message.text.lower()) original_text_words = flanautils.remove_accents(message.text.lower())
original_text_words = flanautils.remove_symbols(original_text_words, ignore=('-', '.'), replace_with=' ').split() original_text_words = flanautils.remove_symbols(original_text_words, ignore=('-', '.'), replace_with=' ').split()
original_text_words = await self._filter_mention_ids(original_text_words, message, delete_names=True) original_text_words = await self.filter_mention_ids(original_text_words, message, delete_names=True)
# noinspection PyTypeChecker # noinspection PyTypeChecker
place_words = ( place_words = (