Ejemplo n.º 1
0
 def bot_maps(self, ctx: CommandContext, data: str) -> str:
     log.info("%s - searching for %s\n", ctx.channel, data)
     lang = self.db.get_lang(ctx.channel)
     try:
         maps = EFT.check_maps(lang, data)
         return localized_string(
             lang,
             "twitch_maps",
             maps.name,
             maps.duration,
             maps.players,
             maps.enemies,
         )
     except:
         return localized_string(
             lang,
             "searchFailed",
         )
Ejemplo n.º 2
0
 def bot_maps(self, ctx: CommandContext,
              data: str) -> Union[str, discord.Embed]:
     log.info("%s - searching for %s (new)\n", ctx.channel, data)
     lang = self.db.get_lang(ctx.channel)
     try:
         maps = EFT.check_maps(lang, data)
         embed = discord.Embed(
             title=maps.name,
             url=maps.wikiLink,
             description=maps.features,
             color=0x780A81,
         )
         embed.set_thumbnail(url="https://eft.bot/images/wiki/{0}.png".
                             format(maps.shortName))
         embed.add_field(
             name=localized_string(lang, "mapPlayers"),
             value=maps.players,
             inline=True,
         )
         embed.add_field(
             name=localized_string(lang, "mapDuration"),
             value=maps.duration,
             inline=True,
         )
         embed.add_field(
             name=localized_string(lang, "mapEnemies"),
             value=maps.enemies,
             inline=True,
         )
         return embed
     except:
         embed = discord.Embed(
             title="LogicEFTBot - Error",
             color=0x780A81,
         )
         embed.set_thumbnail(url="https://illogical.network/api/error.png")
         embed.add_field(
             name="Invalid Item Search",
             value=
             "You've entered in an invalid map name ; please try again.",
             inline=True,
         )
         return embed