Example #1
0
 def guess(self, value: str):
     value = replaceCharacters(value, [" ", ",", "-"]).casefold()
     if value == "quit" or value == "exit" or value == "stop":
         self.__gameEnd = True
         return 0, 0
     if value == "help" or value == "time":
         return 0, 0
     try:
         _ = int(value)
     except ValueError:
         raise Exception("Invalid characters found.")
     if len(value) != 4:
         raise Exception("Number must contain exactly four digits.")
     if len(set(value)) != 4:
         raise Exception("Duplicate characters found.")
     bulls, cows = 0, 0
     for i in value:
         for j in self.__number:
             if i == j:
                 if value.index(i) == self.__number.index(j):
                     bulls += 1
                 else:
                     cows += 1
     self.__attempts += 1
     if bulls == 4:
         self.__gameEnd = True
     return bulls, cows
Example #2
0
 async def acpersonality(self, ctx, *, personality: str = ""):
     personality = funcs.replaceCharacters(personality.casefold(), [" ", "-", "_"]).replace("uchi", "sisterly") \
                   .replace("bigsister", "sisterly").replace("snobby", "snooty").replace("grumpy", "cranky")
     if not personality:
         e = Embed(
             title="Animal Crossing Personality Types",
             description=
             "`Cranky`, `Jock`, `Lazy`, `Normal`, `Peppy`, `Sisterly`, `Smug`, `Snooty`"
         )
         e.set_footer(
             text=
             f"Use {self.client.command_prefix}acpersonality <personality type> for more information."
         )
         e.set_thumbnail(url=AC_LOGO)
     else:
         try:
             personalitydata = self.findData(self.personalities,
                                             personality)
             e = Embed(title=personalitydata["name"],
                       description=personalitydata["desc"])
             e.add_field(name="Gender",
                         value=f"`{personalitydata['gender']}`")
             e.add_field(name="Sleep Time",
                         value=f"`{personalitydata['sleep-time']}`")
             i = 0
             for villagerID in list(self.villagers):
                 villagerdata = self.villagers[villagerID]
                 if villagerdata["personality"].replace(
                         "Uchi", "Sisterly") == personalitydata["name"]:
                     i += 1
             e.add_field(name="Total Villagers", value=f"`{i}`")
             e.add_field(name="Get Along With",
                         value=", ".join(
                             f"`{i}`"
                             for i in personalitydata["get-along-with"]))
             if personalitydata["fight-with"]:
                 e.add_field(name="Fight With",
                             value=", ".join(
                                 f"`{i}`"
                                 for i in personalitydata["fight-with"]))
             e.set_thumbnail(url=AC_LOGO)
         except Exception as ex:
             e = funcs.errorEmbed(None, str(ex))
     await ctx.reply(embed=e)
Example #3
0
 async def coords(self, ctx, *, inp: str):
     inp = funcs.replaceCharacters(inp, [",", "(", ")", ";"])
     args = inp.split(" ")
     try:
         try:
             x1, z1, _ = self.f3cProcessing(inp)
         except:
             x1, z1 = float(args[0]), float(args[1])
         x2, z2 = float(args[-2]), float(args[-1])
     except ValueError:
         return await ctx.reply(
             embed=funcs.errorEmbed(None, "Invalid arguments."))
     await ctx.reply(
         "The distance between (**{}**; **{}**) and (**{}**; **{}**) is: ".
         format(funcs.removeDotZero(round(x1, 5)),
                funcs.removeDotZero(round(z1, 5)),
                funcs.removeDotZero(round(x2, 5)),
                funcs.removeDotZero(round(z2, 5))) +
         f"**{funcs.removeDotZero(round(self.coordsDifference((x1, z1), (x2, z2)), 5))}**"
     )
Example #4
0
 async def acart(self, ctx, *, art: str = ""):
     if not art:
         e = Embed(title="Animal Crossing Artwork")
         e.set_thumbnail(url=AC_LOGO)
         paintings = [
             self.art[i]['name']['name-USen'] for i in list(self.art.keys())
             if not self.art[i]['name']['name-USen'].endswith(" statue")
         ]
         statues = [
             self.art[i]['name']['name-USen'] for i in list(self.art.keys())
             if self.art[i]['name']['name-USen'].endswith(" statue")
         ]
         e.add_field(name="Paintings ({:,})".format(len(paintings)),
                     value=", ".join(f"`{i.title()}`" for i in paintings))
         e.add_field(name="Statues ({:,})".format(len(statues)),
                     value=", ".join(f"`{i.title()}`" for i in statues))
         e.set_footer(
             text=
             f"Use {self.client.command_prefix}acart <artwork name> for more information."
         )
     else:
         try:
             artdata = self.findData(
                 self.art, funcs.replaceCharacters(art, ["(", ")"]))
             e = Embed(title=artdata["name"]["name-USen"].title(),
                       description=artdata["museum-desc"])
             e.add_field(name="Has Fake",
                         value=f"`{str(artdata['hasFake'])}`")
             e.add_field(name="Buy Price",
                         value="`{:,}`".format(artdata['buy-price']))
             e.add_field(name="Sell Price",
                         value="`{:,}`".format(artdata['sell-price']))
             e.set_image(url=artdata["image_uri"].replace("https", "http"))
             e.set_thumbnail(url=AC_LOGO)
         except Exception as ex:
             e = funcs.errorEmbed(None, str(ex))
     await ctx.reply(embed=e)
Example #5
0
 async def furnitureEmbed(self, ctx, ftype: str, name: str):
     name = funcs.replaceCharacters(name.replace(" ", "_"), ["‘", "’"], "'")
     try:
         res = await funcs.getRequest(
             f"https://acnhapi.com/v1/{ftype}/{name}")
         data = res.json()
         if len(data) > 1:
             await ctx.reply("`Please select a number: {}`".format(
                 ", ".join(f"{str(var)} ({data[var]['variant']})"
                           for var in range(len(data)))))
             try:
                 pchoice = await self.client.wait_for(
                     "message",
                     check=lambda m: m.author == ctx.author and m.channel ==
                     ctx.channel,
                     timeout=20)
                 variant = int(pchoice.content) if -1 < int(
                     pchoice.content) < len(data) else 0
             except (TimeoutError, ValueError):
                 variant = 0
         else:
             variant = 0
         tags = [
             i for i in [
                 "DIY" if data[variant]["isDIY"] else 0,
                 "Catalogue" if data[variant]["isCatalog"] else 0,
                 "Customisable Body" if data[variant]["canCustomizeBody"]
                 else 0, "Customisable Pattern"
                 if data[variant]["canCustomizePattern"] else 0,
                 "Interactive" if data[variant]["isInteractive"] else 0,
                 "Outdoor" if data[variant]["isOutdoor"] else 0
             ] if i
         ]
         try:
             if data[variant]["isDoorDeco"]:
                 tags.append("Door Decoration")
         except:
             pass
         e = Embed(title=data[variant]["name"]["name-USen"])
         e.set_image(
             url=data[variant]["image_uri"].replace("https", "http"))
         e.set_thumbnail(url=AC_LOGO)
         e.set_footer(
             text="Note: Version 2.0 furniture items may not be available.")
         e.add_field(name="Type",
                     value="`{}`".format(
                         data[variant]['tag'].title().replace("'S", "'s")))
         e.add_field(name="Source", value=f"`{data[variant]['source']}`")
         e.add_field(name="Size", value=f"`{data[variant]['size']}`")
         e.add_field(name="Version Added",
                     value=f"`{data[variant]['version']}`")
         if tags:
             e.add_field(name="Tags",
                         value=", ".join(f"`{i}`" for i in tags))
         if data[variant]["variant"]:
             e.add_field(name="Variant",
                         value=f"`{data[variant]['variant']}`")
         if data[variant]["body-title"]:
             e.add_field(name="Body Title",
                         value=f"`{data[variant]['body-title']}`")
         if data[variant]["pattern"]:
             e.add_field(name="Pattern",
                         value=f"`{data[variant]['pattern']}`")
         if data[variant]["pattern-title"]:
             e.add_field(name="Pattern-Title",
                         value=f"`{data[variant]['pattern-title']}`")
         if data[variant]["kit-cost"]:
             e.add_field(name="Kit Cost",
                         value=f"`{data[variant]['kit-cost']}`")
         if data[variant]["color-1"]:
             e.add_field(name="Colour",
                         value=f"`{data[variant]['color-1']}`")
         if data[variant]["color-2"]:
             e.add_field(name="Secondary Colour",
                         value=f"`{data[variant]['color-2']}`")
         if data[variant]["hha-concept-1"]:
             e.add_field(name="HHA Concept",
                         value="`{}`".format(
                             data[variant]['hha-concept-1'].title().replace(
                                 "'S", "'s")))
         if data[variant]["hha-concept-2"]:
             e.add_field(name="Secondary HHA Concept",
                         value="`{}`".format(
                             data[variant]['hha-concept-2'].title().replace(
                                 "'S", "'s")))
         if data[variant]["hha-series"]:
             e.add_field(name="HHA Series",
                         value="`{}`".format(
                             data[variant]['hha-series'].title().replace(
                                 "'S", "'s")))
         if data[variant]["hha-set"]:
             e.add_field(name="HHA Set",
                         value="`{}`".format(
                             data[variant]['hha-set'].title().replace(
                                 "'S", "'s")))
         try:
             if data[variant]["speaker-type"]:
                 e.add_field(name="Speaker Type",
                             value=f"`{data[variant]['speaker-type']}`")
         except:
             pass
         if data[variant]["lighting-type"]:
             e.add_field(name="Lighting Type",
                         value=f"`{data[variant]['lighting-type']}`")
         if data[variant]["buy-price"]:
             e.add_field(name="Buy Price",
                         value="`{:,}`".format(data[variant]["buy-price"]))
         e.add_field(name="Sell Price",
                     value="`{:,}`".format(data[variant]["sell-price"]))
     except Exception:
         pref = self.client.command_prefix
         e = funcs.errorEmbed(
             None, "Not found, please check your spelling. Furniture names are case sensitive." + \
                   " (e.g. `acoustic guitar` or `Bunny Day arch`)\n\nOr is this even the right category? " + \
                   f"(`{pref}achouseware`/`{pref}acmisc`/`{pref}acwallmounted`)"
         )
     return e