コード例 #1
0
ファイル: minecraft.py プロジェクト: ryancflam/findseed
 async def finddream(self, ctx):
     pearls, rods = 0, 0
     dpearls, drods = 262, 305
     data = funcs.readJson("data/finddream.json")
     mostPearls = data["mostPearls"]
     mostRods = data["mostRods"]
     for _ in range(dpearls):
         pearls += 1 if randint(0, 422) < 20 else 0
     for _ in range(drods):
         rods += 1 if randint(0, 1) else 0
     data["mostPearls"] = pearls if pearls >= mostPearls else mostPearls
     data["mostRods"] = rods if rods >= mostRods else mostRods
     data["iteration"] += 1
     iters = data['iteration']
     funcs.dumpJson("data/finddream.json", data)
     e = Embed(
         title=f"{self.client.command_prefix}finddream",
         description=f"Dream got 42 ender pearl trades in {dpearls} plus 211 blaze rod drops in {drods}. " + \
                     f"Can you achieve his 'luck'?\n\nRequested by: {ctx.author.mention}"
     )
     e.add_field(name="Your Pearl Trades",
                 value=f"`{pearls} ({round(pearls / dpearls * 100, 3)}%)`")
     e.add_field(name="Your Rod Drops",
                 value=f"`{rods} ({round(rods / drods * 100, 3)}%)`")
     e.set_footer(
         text=f"The command has been called {'{:,}'.format(iters)} time{'' if iters == 1 else 's'}. " + \
              f"| Most pearl trades: {data['mostPearls']}; most rod drops: {data['mostRods']}"
     )
     e.set_thumbnail(
         url=
         "https://static.wikia.nocookie.net/dream_team/images/7/7b/Dream.jpeg"
     )
     await ctx.reply(embed=e)
コード例 #2
0
ファイル: general.py プロジェクト: ryancflam/findseed
 async def umdisable(self, ctx):
     data = funcs.readJson("data/unprompted_messages.json")
     serverList = list(data["servers"])
     if ctx.guild.id in serverList:
         serverList.remove(ctx.guild.id)
         data["servers"] = serverList
         funcs.dumpJson("data/unprompted_messages.json", data)
         return await ctx.reply("`Disabled unprompted messages for this server.`")
     await ctx.reply(embed=funcs.errorEmbed(None, "Unprompted messages are not enabled."))
コード例 #3
0
ファイル: general.py プロジェクト: ryancflam/findseed
 async def eedisable(self, ctx):
     data = funcs.readJson("data/easter_eggs.json")
     serverList = list(data["servers"])
     if ctx.guild.id in serverList:
         serverList.remove(ctx.guild.id)
         data["servers"] = serverList
         funcs.dumpJson("data/easter_eggs.json", data)
         return await ctx.reply("`Disabled e̴̝͆ͅà̶̙̫s̵̥̈͠͠t̵̟̓̔ȩ̴͎̅̚͠ṛ̴̖̻̕ ̶̯̰͇͂̈́̐͝e̴̹̰̦͑͝ġ̶͖͖̘̏̌g̴̱̬̈͒̃s̴͉̣̙̻̆̇͠ for this server.`")
     await ctx.reply(embed=funcs.errorEmbed(None, "E̴̝͆ͅà̶̙̫s̵̥̈͠͠t̵̟̓̔ȩ̴͎̅̚͠ṛ̴̖̻̕ ̶̯̰͇͂̈́̐͝e̴̹̰̦͑͝ġ̶͖͖̘̏̌g̴̱̬̈͒̃s̴͉̣̙̻̆̇͠ are not enabled."))
コード例 #4
0
 async def unblacklistuser(self, ctx, *, userID=None):
     if not userID:
         return await ctx.reply(
             embed=funcs.errorEmbed(None, "Empty input."))
     try:
         userID = int(userID)
         data = funcs.readJson("data/blacklist.json")
         userList = list(data["users"])
         if userID in userList:
             userList.remove(userID)
             data["users"] = userList
             funcs.dumpJson("data/blacklist.json", data)
             return await ctx.reply("Removed.")
         await ctx.reply(embed=funcs.errorEmbed(None, "Not in blacklist."))
     except ValueError:
         await ctx.reply(embed=funcs.errorEmbed(None, "Invalid input."))
コード例 #5
0
 async def addunpromptedbot(self, ctx, *, userID=None):
     if not userID:
         return await ctx.reply(
             embed=funcs.errorEmbed(None, "Empty input."))
     try:
         userID = int(userID)
         data = funcs.readJson("data/unprompted_bots.json")
         userList = list(data["ids"])
         if userID not in userList:
             userList.append(userID)
             data["ids"] = userList
             funcs.dumpJson("data/unprompted_bots.json", data)
             return await ctx.reply("Added.")
         await ctx.reply(embed=funcs.errorEmbed(
             None, "Already in unprompted bots list."))
     except ValueError:
         await ctx.reply(embed=funcs.errorEmbed(None, "Invalid input."))
コード例 #6
0
 async def blacklistserver(self, ctx, *, serverID=None):
     if not serverID:
         return await ctx.reply(
             embed=funcs.errorEmbed(None, "Empty input."))
     try:
         serverID = int(serverID)
         data = funcs.readJson("data/blacklist.json")
         serverList = list(data["servers"])
         if serverID not in serverList:
             serverList.append(serverID)
             data["servers"] = serverList
             funcs.dumpJson("data/blacklist.json", data)
             return await ctx.reply("Added.")
         await ctx.reply(
             embed=funcs.errorEmbed(None, "Already in blacklist."))
     except ValueError:
         await ctx.reply(embed=funcs.errorEmbed(None, "Invalid input."))
コード例 #7
0
ファイル: minecraft.py プロジェクト: ryancflam/findseed
 async def findseed(self, ctx):
     eyes = self.randomEyes()
     data = funcs.readJson("data/findseed.json")
     odds = self.eyedata[str(eyes)]["percent"]
     onein = self.eyedata[str(eyes)]["onein"]
     update = False
     if eyes >= data["highest"]["number"]:
         data["highest"]["found"] -= data["highest"][
             "found"] - 1 if eyes > data["highest"]["number"] else -1
         data["highest"]["number"] = eyes
         data["highest"]["time"] = int(time())
         update = True
     highest = data["highest"]["number"]
     highestTime = data["highest"]["time"]
     highestTotal = data["highest"]["found"]
     data["calls"] += 1
     calls = data["calls"]
     funcs.dumpJson("data/findseed.json", data)
     file = File(
         f"{funcs.getPath()}/assets/minecraft/portal_frame_images/{eyes}eye.png",
         filename="portal.png")
     foundTime = "just now"
     if not update:
         timestr = funcs.timeDifferenceStr(time(), highestTime)
         timestr_0 = int(timestr.split(" ")[0])
         if timestr_0 > 2:
             foundTime = f"{timestr_0} days"
         else:
             foundTime = timestr
     e = Embed(title=f"{self.client.command_prefix}findseed",
               description=f"Requested by: {ctx.message.author.mention}")
     e.add_field(name="Your Eyes", value=f"`{eyes}`")
     e.add_field(name="Probability", value=f"`{odds}% (1 in {onein})`")
     e.add_field(name="Most Eyes Found", inline=False,
                 value=f"`{highest} (last found {foundTime}{' ago' if not update else ''}" + \
                       f", found {'{:,}'.format(highestTotal)} time{'' if highestTotal == 1 else 's'})`")
     e.set_footer(
         text=
         f"The command has been called {'{:,}'.format(calls)} time{'' if calls == 1 else 's'}. !eyeodds"
     )
     e.set_image(url="attachment://portal.png")
     await ctx.reply(embed=e, file=file)
コード例 #8
0
 async def whitelistuser(self, ctx, *, userID=None):
     if not userID:
         return await ctx.reply(
             embed=funcs.errorEmbed(None, "Empty input."))
     try:
         userID = int(userID)
         if userID in funcs.readJson("data/blacklist.json")["users"]:
             return await ctx.reply(
                 embed=funcs.errorEmbed(None, "This user is blacklisted."))
         data = funcs.readJson("data/whitelist.json")
         userList = list(data["users"])
         if userID not in userList:
             userList.append(userID)
             data["users"] = userList
             funcs.dumpJson("data/whitelist.json", data)
             return await ctx.reply("Added.")
         await ctx.reply(
             embed=funcs.errorEmbed(None, "Already in whitelist."))
     except ValueError:
         await ctx.reply(embed=funcs.errorEmbed(None, "Invalid input."))
コード例 #9
0
 async def on_ready(self):
     if config.githubWebhooks:
         try:
             funcs.reloadCog(self, "github_webhooks")
         except:
             pass
     try:
         funcs.testKaleido()
     except Exception as ex:
         print(f"Warning - {ex}")
     owner = (await self.application_info()).owner
     data = funcs.readJson("data/whitelist.json")
     wl = list(data["users"])
     if owner.id not in wl:
         wl.append(owner.id)
         data["users"] = wl
         funcs.dumpJson("data/whitelist.json", data)
     print(f"Logged in as Discord user: {self.user}")
     await owner.send("Bot is online.")
     if self.__activityName.casefold() == "bitcoin":
         await self.loop.create_task(self.bitcoin())
     else:
         await self.presence(self.__activityName)