Exemplo n.º 1
0
 def __init__(
     self,
     source: menus.PageSource,
     cog: Optional[commands.Cog] = None,
     clear_reactions_after: bool = True,
     delete_message_after: bool = True,
     add_reactions: bool = True,
     using_custom_emoji: bool = False,
     using_embeds: bool = False,
     keyword_to_reaction_mapping: Optional[Dict[str, Iterable[str]]] = None,
     timeout: int = 60,
     message: discord.Message = None,
     **kwargs: Any,
 ) -> None:
     self._add_reactions = add_reactions
     self._using_custom_emoji = using_custom_emoji
     super().__init__(
         source,
         clear_reactions_after=clear_reactions_after,
         delete_message_after=delete_message_after,
         check_embeds=using_embeds,
         timeout=timeout,
         message=message,
         **kwargs,
     )
     if (bad_stop := menus._cast_emoji(
             "\N{BLACK SQUARE FOR STOP}\N{VARIATION SELECTOR-16}")
         ) and bad_stop in self._buttons:
         del self._buttons[bad_stop]
Exemplo n.º 2
0
 def _register_keyword(self):
     if isinstance(self.__keyword_to_reaction_mapping, dict):
         for k, v in self.__keyword_to_reaction_mapping.items():
             if k not in self._actions:
                 self._actions[k] = []
             for e in v:
                 emoji = menus._cast_emoji(e)
                 if emoji not in self.buttons:
                     continue
                 self._actions[k].append(emoji)
Exemplo n.º 3
0
 def _get_emoji(self, button: InteractionButton):
     emoji_string = button.custom_id[len(self.custom_id) + 1:]
     return menus._cast_emoji(emoji_string)