Exemplo n.º 1
0
 async def Update(self, ctx):
     info = fileIO("config/config.json", "load")
     info["member_count"] = 0
     for guild in self.bot.guilds:
         info["member_count"] = info["member_count"] + guild.member_count
         fileIO("config/config.json", "save", info)
     info2 = fileIO("config/config.json", "load")
     count = info2["member_count"]
     await ctx.send(f"I have **{count} Members** Now!")
Exemplo n.º 2
0
 async def Fix(self, ctx):
     filenames_of_all_users = glob.glob("players/*/*.json")
     for filename in filenames_of_all_users:
         players = fileIO(filename, "load")
         players["selected_enemy"] = "None"
         players["in_fight"] = 0
         players["health"] = 100
         fileIO(filename, "save", players)
         print(filename)
     print("Done")
Exemplo n.º 3
0
 async def Global(self, ctx):
     info = fileIO("config/config.json", "load")
     if info["Global"] == "Disabled":
         info["Global"] = "Enabled"
         await ctx.send("Global Bot Up")
         fileIO("config/config.json", "save", info)
         return
     if info["Global"] == "Enabled":
         info["Global"] = "Disabled"
         await ctx.send("Global Bot Down")
         fileIO("config/config.json", "save", info)
         return
Exemplo n.º 4
0
 async def private(self, ctx):
     with open('servers.txt', 'w') as file:
         info = fileIO("config/config.json", "load")
         info["member_count"] = 0
         for guild in self.bot.guilds:
             file.write(
                 f"---------------\nGuild Name: {guild.name}\n\nGuild Member Count: {guild.member_count}\n\nGuild ID: {guild.id}\n\n--------------"
             )
         for guild in self.bot.guilds:
             info[
                 "member_count"] = info["member_count"] + guild.member_count
             print(
                 f"---------------\nGuild Name: {guild.name}\n\nGuild Member Count: {guild.member_count}\n\nGuild ID: {guild.id}\n\n--------------"
             )
             fileIO("config/config.json", "save", info)
Exemplo n.º 5
0
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")
        voter2 = data
        unq = random.randint(0, 9999999999)
        fileIO(f"vote{unq}.json", "save", voter2)
        info = fileIO(f"vote{unq}.json", "load")
        voter = await self.bot.fetch_user(info['user'])

        if not os.path.exists("players/{}".format(voter.id)):
            os.makedirs("players/{}".format(voter.id))
            new_account = {
                "name": voter.name,
                "race": "None",
                "class": "None",
                "health": 100,
                "damage": 0,
                "max_health": 100,
                "enemyhp": 50,
                "bosshp": 50,
                "in_fight": 0,
                "lvl": 1,
                "resets": 0,
                "enemieskilled": 0,
                "bosskilled": 0,
                "deaths": 0,
                "selected_enemy": "None",
                "selected_boss": "None",
                "exp": 0,
                "gold": 200,
                "lootbag": 0,
                "wearing": "Bandage",
                "defence": 0,
                "skills_learned": [],
                "inventory": [],
                "inv_armor": [],
                "equip": "None",
                "location": "Ruins",
                "roaming": "False",
                "pet": "None",
                "daily_block": 0,
                "rest_block": 0,
                "hp_potions": 4,
                "max_pot": 12,
            }
            fileIO("players/{}/info.json".format(voter.id), "save",
                   new_account)
        voinfo = fileIO("players/{}/info.json".format(voter.id), "load")

        message = f"Thanks **{voter.mention}** for voting!, you Received your reward!!"
        channel = self.bot.get_channel(802219611340668968)
        await channel.send(message)

        voinfo["gold"] = voinfo["gold"] + 500
        fileIO("players/{}/info.json".format(voter.id), "save", voinfo)
        await voter.send("You got your reward! **+500G**")
        os.remove(f"vote{unq}.json")
Exemplo n.º 6
0
 async def stats(self, ctx):
     author = ctx.author
     await main._create_user(author)
     info = fileIO("players/{}/info.json".format(author.id), "load")
     if info["race"] and info["class"] == "None":
         await ctx.send("Please start your character using `u?start`")
         return
     maxexp = 100 * info["lvl"]
     #image creation
     ID = random.randint(0, 9999)
     bg = Image.open('stat.png')
     font = ImageFont.truetype(f"Font.ttf", 70)
     draw = ImageDraw.Draw(bg)
     name = f"“{author.name}”"
     level = info["lvl"]
     health = info["health"]
     max_health = info["max_health"]
     attack = info["damage"]
     defence = info["defence"]
     exper = info["exp"]
     armor = info["wearing"]
     weapon = info["equip"]
     gold = info["gold"]
     lv = f"{level}"
     hp = f"{health}/{max_health}"
     mxp = f"{maxexp}"
     at = f"{attack}"
     df = f"{defence}"
     exp = f"{exper}"
     w = f"{armor}"
     e = f"{weapon}"
     g = f"{gold}"
     #name
     draw.text((67, 87), name, font=font)
     #level
     draw.text((145, 200), lv, font=font)
     #attack
     draw.text((145, 410), at, font=font)
     #defence
     draw.text((145, 480), df, font=font)
     #max exp
     draw.text((560, 480), mxp, font=font)
     #exp
     draw.text((530, 410), exp, font=font)
     #health
     draw.text((150, 260), hp, font=font)
     #weapon
     draw.text((270, 610), e, font=font)
     #gold
     draw.text((210, 765), g, font=font)
     #armor
     draw.text((240, 675), w, font=font)
     bg.save(f"{ID}.png")
     file = discord.File(f"{ID}.png")
     await ctx.send(file=file)
     os.remove(f"{ID}.png")
Exemplo n.º 7
0
 async def info(self, ctx):
     delta_uptime = datetime.utcnow() - self.bot.launch_time
     hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
     minutes, seconds = divmod(remainder, 60)
     days, hours = divmod(hours, 24)
     info = fileIO("config/config.json", "load")
     em = discord.Embed(
         title="My info:",
         type="rich",
         description=
         f"**An Advanced UNDERTALE RPG game\n\nGuilds Count:{len(self.bot.guilds)}\n\nbot Latency: {round(self.bot.latency * 1000)}ms\n\nBot Uptime:**\n`{days}d, {hours}h, {minutes}m, {seconds}s`",
         color=0x979c9f)
     em.set_thumbnail(url=self.bot.user.avatar_url)
     await ctx.reply(embed=em)
Exemplo n.º 8
0
    async def inv(self, ctx):
        author = ctx.author
        await main._create_user(author)
        message = ctx.message
        info = fileIO("players/{}/info.json".format(author.id), "load")
        if info["race"] and info["class"] == "None":
            await ctx.send(
                "Please start your character using `{}start`".format(Prefix))
            return
        em = discord.Embed(
            description=
            "**Your Inventory:\n\n\nGold: {}\nLootbags: {}\nHP Potions: {}\n\nItems\n+{}**"
            .format(info["gold"], info["lootbag"], info["hp_potions"],
                    "\n+ ".join(info["inventory"])))

        await ctx.send(embed=em)
Exemplo n.º 9
0
 async def gold(self, ctx):
     author = ctx.author
     info = fileIO("players/{}/info.json".format(author.id), "load")
     bal = info["gold"]
     await ctx.send(f"Your gold balance is \n\n**{bal}G**")