예제 #1
0
 async def convert(self, ctx, argument):
     result = None
     if argument.isdigit():
         if int(argument) > 118 or int(argument) < 1:
             raise BadArgument("`{}` is not a valid element!".format(argument))
         result = ELEMENTS(int(argument))
     else:
         try:
             result = ELEMENTS(argument.title())
         except Exception:
             raise BadArgument("`{}` is not a valid element!".format(argument))
     if not result:
         raise BadArgument("`{}` is not a valid element!".format(argument))
     return result
예제 #2
0
    async def elements(self, ctx, *elements: ElementConverter):
        """
            Display information about multiple elements

            `elements` can be the name, symbol or atomic number of the element
            separated by spaces
        """
        if not elements:
            elements = [ELEMENTS(e) for e in range(1, 119)]
        await menu(ctx, [await self.element_embed(e) for e in elements], DEFAULT_CONTROLS)
예제 #3
0
 async def ptable(self, ctx: commands.Context) -> None:
     """Display a menu of all elements"""
     embeds = [await self.element_embed(ELEMENTS(e)) for e in range(1, 119)]
     await menu(ctx, embeds, DEFAULT_CONTROLS)