Esempio n. 1
0
 def __init__(self, client: commands.Bot):
     self.client = client
     self.divinetravel = funcs.readJson(
         "assets/minecraft/divine_travel.json")
     self.perfecttravel = funcs.readJson(
         "assets/minecraft/perfect_travel.json")
     self.eyedata = funcs.readJson("assets/minecraft/eye_data.json")
     self.loottable = self.piglinLootTable()
Esempio n. 2
0
 def __init__(self, client: commands.Bot):
     self.client = client
     self.activeSpinners = []
     self.phoneWaitingChannels = []
     self.phoneCallChannels = []
     self.personalityTest = funcs.readJson(
         "assets/random_stuff/personality_test.json")
     self.trumpquotes = funcs.readJson(
         "assets/random_stuff/trump_quotes.json")
     self.truths = funcs.readTxtLines("assets/random_stuff/truths.txt")
     self.dares = funcs.readTxtLines("assets/random_stuff/dares.txt")
     self.nhie = funcs.readTxtLines("assets/random_stuff/nhie.txt")
Esempio n. 3
0
 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)
Esempio n. 4
0
 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."))
Esempio n. 5
0
 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."))
Esempio n. 6
0
 async def blacklist(self, ctx):
     data = funcs.readJson("data/blacklist.json")
     serverList = list(data["servers"])
     userList = list(data["users"])
     await ctx.reply(
         "```Servers ({:,}): ".format(len(serverList)) +
         f"{'None' if not serverList else ', '.join(str(server) for server in serverList)}" + \
         "\nUsers ({:,}): ".format(len(userList)) +
         f"{'None' if not userList else ', '.join(str(user) for user in userList)}```"
     )
Esempio n. 7
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."))
Esempio n. 8
0
 def __init__(self, client: commands.Bot):
     self.client = client
     self.art = funcs.readJson("assets/animal_crossing/art.json")
     self.bugs = funcs.readJson("assets/animal_crossing/bugs.json")
     self.fish = funcs.readJson("assets/animal_crossing/fish.json")
     self.fossils = funcs.readJson("assets/animal_crossing/fossils.json")
     self.personalities = funcs.readJson(
         "assets/animal_crossing/personalities.json")
     self.sea = funcs.readJson("assets/animal_crossing/sea_creatures.json")
     self.species = self.openSpeciesTxt()
     self.villagers = funcs.readJson(
         "assets/animal_crossing/villagers.json")
Esempio n. 9
0
 def piglinLootTable():
     lt = funcs.readJson("assets/minecraft/piglin_loot_table.json")
     ltnew = []
     for i in lt:
         if i["id"] < 5:
             item = i["item"]
             for j in range(1, 4):
                 i["item"] = f"{item} {j}"
                 for _ in range(i["weight"]):
                     ltnew.append(i.copy())
                 i["id"] += 1
         else:
             for _ in range(i["weight"] * 3):
                 ltnew.append(i)
     return ltnew
Esempio n. 10
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."))
Esempio n. 11
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."))
Esempio n. 12
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."))
Esempio n. 13
0
 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)
Esempio n. 14
0
 async def botinfo(self, ctx):
     appinfo = await self.client.application_info()
     e = Embed(description=appinfo.description)
     dt = self.client.user.created_at
     e.set_author(name=self.client.user.name, icon_url=self.client.user.avatar_url)
     e.add_field(name="Owner", value=f"`{appinfo.owner}`")
     e.add_field(name="Python", value=f"`{version.split(' ')[0]}`")
     e.add_field(name="Library", value=f"`Pycord {__version__}`")
     e.add_field(name="Creation Date", value=funcs.dateBirthday(dt.day, dt.month, dt.year))
     e.add_field(name="Servers", value="`{:,}`".format(len(self.client.guilds)))
     e.add_field(name="Users (Excluding Bots)", value="`{:,} ({:,})`".format(
         len(self.client.users), len(set([i for i in self.client.users if not i.bot]))
     ))
     e.add_field(name="CPU Usage", value=f"`{funcs.removeDotZero(cpu_percent())}%`")
     e.add_field(name="Memory Usage", value=f"`{funcs.removeDotZero(dict(virtual_memory()._asdict())['percent'])}%`")
     e.add_field(name="Memory Available",
                 value="`{} MB`".format(
                     funcs.removeDotZero(round(float(dict(virtual_memory()._asdict())['available']) / 1024 / 1024, 2))
                 ))
     e.add_field(name="Disk Usage", value=f"`{funcs.removeDotZero(dict(disk_usage('/')._asdict())['percent'])}%`")
     e.add_field(name="Disk Space Available",
                 value="`{} GB`".format(
                     funcs.removeDotZero(round(float(dict(disk_usage('/')._asdict())['free']) / 1024 / 1024 / 1024, 2))
                 ))
     try:
         res = await funcs.getRequest(f"https://api.statcord.com/v3/{self.client.user.id}",
                                      params={"Authorization": config.statcordKey})
         statcord = res.json()
         e.add_field(name="Bandwidth Usage",
                     value="`{} MB`".format(funcs.removeDotZero(round(int(statcord["data"][0]["bandwidth"]) / 1024 / 1024, 2))))
         popular = statcord["popular"][0]
         e.add_field(name="Most Popular Command",
                     value="`{}{} ({:,})`".format(self.client.command_prefix, popular['name'], int(popular['count'])))
     except:
         pass
     e.add_field(name="!findseed Calls", value="`{:,}`".format(funcs.readJson("data/findseed.json")['calls']))
     e.add_field(name="Local Time", value=f"`{str(datetime.fromtimestamp(int(time())))}`")
     e.set_footer(text=f"Bot has been up for {funcs.timeDifferenceStr(time(), self.starttime)}.")
     await ctx.reply(embed=e)
Esempio n. 15
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)
Esempio n. 16
0
 def __init__(self, client: commands.Bot):
     self.client = client
     self.morsecode = funcs.readJson(
         "assets/conversion_tools/morse_code.json")
Esempio n. 17
0
 async def whitelist(self, ctx):
     userList = list(funcs.readJson("data/whitelist.json")["users"])
     await ctx.reply(
         "```Users ({:,}): ".format(len(userList)) +
         f"{'None' if not userList else ', '.join(str(user) for user in userList)}```"
     )
Esempio n. 18
0
 async def unpromptedbots(self, ctx):
     userList = list(funcs.readJson("data/unprompted_bots.json")["ids"])
     await ctx.reply(
         f"```Allowed unprompted bots: {'None' if not userList else ', '.join(str(user) for user in userList)}```"
     )
Esempio n. 19
0
 async def eastereggservers(self, ctx):
     serverList = list(funcs.readJson("data/easter_eggs.json")["servers"])
     await ctx.reply(
         "```Servers ({:,}): ".format(len(serverList)) +
         f"{'None' if not serverList else ', '.join(str(s) for s in serverList)}```"
     )
Esempio n. 20
0
 async def on_message(self, message):
     if (not message.guild or message.guild and message.guild.id in funcs.readJson("data/unprompted_messages.json")["servers"]) \
             and funcs.userNotBlacklisted(self.client, message) \
             and (not message.author.bot or (message.author.id in funcs.readJson("data/unprompted_bots.json")["ids"]
                                             and message.author.id != self.client.user.id)):
         originalmsg = message.content
         lowercase = originalmsg.casefold()
         if message.channel.id not in self.lastthreemsgs:
             self.lastthreemsgs[message.channel.id] = [message]
         else:
             if len(self.lastthreemsgs[message.channel.id]) < 3:
                 self.lastthreemsgs[message.channel.id].append(message)
             if len(self.lastthreemsgs[message.channel.id]) == 3:
                 authors = sorted([self.lastthreemsgs[message.channel.id][0].author.id,
                                   self.lastthreemsgs[message.channel.id][1].author.id,
                                   self.lastthreemsgs[message.channel.id][2].author.id])
                 msgs = [self.lastthreemsgs[message.channel.id][0].content,
                         self.lastthreemsgs[message.channel.id][1].content,
                         self.lastthreemsgs[message.channel.id][2].content]
                 if len(set(authors)) == 3 and len(set(msgs)) == 1:
                     await message.channel.send(originalmsg)
                     del self.lastthreemsgs[message.channel.id]
                     return
                 else:
                     self.lastthreemsgs[message.channel.id].pop(0)
         if self.client.user in message.mentions and not (await self.client.get_context(message)).valid:
             await message.channel.trigger_typing()
             msg = sub("<@!?" + str(self.client.user.id) + ">", "", message.content).strip()
             params = {
                 "botid": "b8d616e35e36e881",
                 "custid": message.author.id,
                 "input": msg or "Hi",
                 "format": "json"
             }
             res = await funcs.getRequest("https://www.pandorabots.com/pandora/talk-xml", params=params)
             data = res.json()
             text = choice(["I do not understand.", "Please say that again.", "What was that?", "Ok."]) \
                 if data["status"] == 4 else data["that"].replace("A.L.I.C.E", self.client.user.name) \
                 .replace("ALICE", self.client.user.name).replace("<br>", "").replace("&quot;", '"') \
                 .replace("&lt;","<").replace("&gt;", ">").replace("&amp;", "&")
             await message.reply(content=text)
         elif not message.author.bot:
             if lowercase.startswith(("im ", "i'm ", "i‘m ", "i’m ", "i am ")):
                 if lowercase.startswith("im "):
                     im = originalmsg[3:]
                 elif lowercase.startswith(("i'm ", "i’m ", "i‘m ")):
                     im = originalmsg[4:]
                 else:
                     im = originalmsg[5:]
                 if im.casefold() == self.client.user.name:
                     await message.channel.send(f"No you're not, you're {message.author.name}.")
                 else:
                     await message.channel.send(f"Hi {im}, I'm {self.client.user.name}!")
             elif "netvigator" in lowercase:
                 await message.channel.send("notvogotor")
             elif lowercase == "h":
                 if not randint(0, 9):
                     await funcs.sendImage(
                         message.channel,
                         "https://cdn.discordapp.com/attachments/665656727332585482/667138135091838977/4a1862c.gif",
                         name="h.gif"
                     )
                 else:
                     await message.channel.send("h")
             elif lowercase == "f":
                 if not randint(0, 9):
                     await funcs.sendImage(
                         message.channel,
                         "https://cdn.discordapp.com/attachments/663264341126152223/842785581602701312/assets_f.jpg"
                     )
                 else:
                     await message.channel.send("f")
             elif "gordon ramsay" in lowercase:
                 await message.channel.send("https://i.imgur.com/XezjUCZ.gifv")
             elif "staying alive" in lowercase:
                 await message.channel.send("https://tenor.com/view/stayin-alive-staying-alive-bee-gees-gif-14315934")
             elif "hkeaa" in lowercase:
                 await funcs.sendImage(
                     message.channel,
                     "https://cdn.discordapp.com/attachments/659771291858894849/663420485438275594/HKEAA_DENIED.png"
                 )
             elif lowercase.startswith("hmmm"):
                 if all(m in "m" for m in lowercase.split("hmm", 1)[1].replace(" ", "")):
                     await funcs.sendImage(
                         message.channel, choice(
                             [
                                 "https://media.giphy.com/media/8lQyyys3SGBoUUxrUp/giphy.gif",
                                 "https://i.redd.it/qz6eknd73qvy.gif",
                                 "https://i.imgur.com/zXAA3CV.gif",
                                 "https://i.imgur.com/ZU014ft.gif",
                                 "https://i.imgur.com/o7EsvoS.gif",
                                 "https://i.imgur.com/8DxmZY6.gif"
                             ]
                         ), name="hmmm.gif"
                     )