Beispiel #1
0
 async def monster_command(self, ctx, *request):
     """Give information on a monster by name."""
     request = ' '.join(request)
     log.debug(f'monster command called with request: {request}')
     if len(request) <= 2:
         return await ctx.send('Request too short.')
     matches = srd.search_monster(request)
     if len(matches) == 0:
         return await ctx.send(
             f'Couldn\'t find any monsters that match \'{request}\'.')
     monster_names = [match.name for match in matches]
     monster_names_lower = [match.name.lower() for match in matches]
     if len(matches) > 1 and request.lower() not in monster_names_lower:
         return await ctx.send(f'Could be: **{" - ".join(monster_names)}**.'
                               )
     if request.lower() not in monster_names_lower:
         monster = matches[0]
     else:
         monster = matches[monster_names_lower.index(request.lower())]
     embed = Embed(colour=PHB_COLOUR)
     embed.add_field(name=monster.name, value=monster.subhead, inline=False)
     embed.add_field(name='Attributes',
                     value=monster.attributes,
                     inline=False)
     embed.add_field(name='Ability Scores',
                     value=monster.abilityscores,
                     inline=False)
     embed.add_field(name='Features', value=monster.features, inline=False)
     embed.add_field(name='Actions', value=monster.actions, inline=False)
     embed.set_footer(
         text='Use ;monster {type} to look up any of the monsters.')
     return await ctx.send(embed=embed)
Beispiel #2
0
 async def monster_command(self, ctx, *request):
     """Give information on a monster by name."""
     request = ' '.join(request)
     log.debug(f'monster command called with request: {request}')
     if len(request) <= 2:
         return await ctx.send('Request too short.')
     matches = srd.search_monster(request)
     if len(matches) == 0:
         return await ctx.send(
             f'Couldn\'t find any monsters that match \'{request}\'.')
     monster_names = [match.name for match in matches]
     monster_names_lower = [match.name.lower() for match in matches]
     if len(matches) > 1 and request.lower() not in monster_names_lower:
         return await ctx.send(f'Could be: **{" - ".join(monster_names)}**.'
                               )
     if request.lower() not in monster_names_lower:
         monster = matches[0]
     else:
         monster = matches[monster_names_lower.index(request.lower())]
     length = len(monster.actions)
     stats = Embed(title=monster.name,
                   value=monster.subhead,
                   colour=PHB_COLOUR)
     stats.add_field(name='Attributes',
                     value=monster.attributes,
                     inline=False)
     stats.add_field(name='Ability Scores',
                     value=monster.abilityscores,
                     inline=False)
     stats.add_field(name='Features', value=monster.features, inline=False)
     stats.set_author(name=f'{ctx.author}', icon_url=ctx.author.avatar_url)
     if length < 2048:
         action = Embed(title='Actions',
                        colour=PHB_COLOUR,
                        description=monster.actions)
         action.set_author(name=f'{ctx.author}',
                           icon_url=ctx.author.avatar_url)
         embed = Paginator(embed=False,
                           timeout=90,
                           use_defaults=True,
                           extra_pages=[stats, action],
                           length=1)
         await embed.start(ctx)
     else:
         action = Embed(title='Actions',
                        colour=PHB_COLOUR,
                        description=monster.actions[:2048])
         action.set_author(name=f'{ctx.author}',
                           icon_url=ctx.author.avatar_url)
         actiontwo = Embed(title=F"Actions *continued*",
                           colour=PHB_COLOUR,
                           description=monster.actions[2048:])
         actiontwo.set_author(name=f'{ctx.author}',
                              icon_url=ctx.author.avatar_url)
         embed = Paginator(embed=False,
                           timeout=90,
                           use_defaults=True,
                           extra_pages=[stats, action, actiontwo],
                           length=1)
         await embed.start(ctx)
Beispiel #3
0
 async def monster_command(self, ctx, *request):
     """Give information on a monster by name."""
     request = ' '.join(request)
     log.debug(f'monster command called with request: {request}')
     if len(request) <= 2:
         return await ctx.send('Request too short.')
     matches = srd.search_monster(request)
     if len(matches) == 0:
         return await ctx.send(
             f'Couldn\'t find any monsters that match \'{request}\'.')
     monster_names = [match.name for match in matches]
     monster_names_lower = [match.name.lower() for match in matches]
     if len(matches) > 1 and request.lower() not in monster_names_lower:
         return await ctx.send(f'Could be: **{" - ".join(monster_names)}**.'
                               )
     if request.lower() not in monster_names_lower:
         monster = matches[0]
     else:
         monster = matches[monster_names_lower.index(request.lower())]
     embed = Embed(colour=PHB_COLOUR)
     embed.add_field(name=monster.name, value=monster.subhead, inline=False)
     embed.add_field(name='Attributes',
                     value=monster.attributes,
                     inline=False)
     embed.add_field(name='Ability Scores',
                     value=monster.abilityscores,
                     inline=False)
     embed.add_field(name='Features', value=monster.features, inline=False)
     await ctx.send(embed=embed)
     length = len(monster.actions)
     if length < 2048:
         action = Embed(title='Actions',
                        colour=PHB_COLOUR,
                        description=monster.actions)
         return await ctx.send(embed=action)
     else:
         action = Embed(title='Actions',
                        colour=PHB_COLOUR,
                        description=monster.actions[:2048])
         actiontwo = Embed(title=F"Actions *continued*",
                           colour=PHB_COLOUR,
                           description=monster.actions[2048:])
         await ctx.send(embed=action)
         return await ctx.send(embed=actiontwo)