Example #1
0
 async def create(self, ctx: commands.Context):
     """Creates a World account."""
     if not Wealth.collection.find_one({"_id": ctx.author.id}):
         return await ctx.send(embed=Embed(
             title="Uh oh!",
             color=self.color,
             description=
             f"Hey {ctx.author.mention} You already have a World account."))
     Wealth._create_account(ctx.author.id)
     return await ctx.send(embed=Embed(
         title="Welcome!",
         color=self.color,
         description=
         f"Hey {ctx.author.mention} I have successfully made your World account."
     ))
Example #2
0
    async def deposit(self, ctx, amount: int):
        if amount < 0:
            return await ctx.send(
                f"Sorry {ctx.author.mention} No signed integers or 0!")

        if Wealth.collection.find_one({"_id": ctx.author.id
                                       })["coins"] < amount:
            return await ctx.send(embed=Embed(
                title="Error!",
                description=
                f"Sorry {ctx.author.mention} You can't deposit because you don't have that much money."
            ))

        Wealth._deposit_coins(ctx.author.id, amount)
        return await ctx.send(embed=Embed(
            title="Deposit",
            description=
            f"{ctx.author.mention} You have deposited `{amount}` coin(s)",
            color=self.bot.color))
Example #3
0
    async def shootout(self, ctx):
        random = Wealth.shootout_ran()
        message = await ctx.send(
            embed=Embed(title="Shootout",
                        description="Is World a shooter?",
                        color=self.bot.color).set_image(url=random).set_footer(
                            text="|✅ - shooter|❎ - innocent|🚫 - nothing"))

        for _emoji in self.shoot_ctx:
            await message.add_reaction(_emoji[0])

        emoji = ''

        while True:  # sodaasdsaijdaubsjsdad
            for _emoji, _image_url, _amount, _message in self.shoot_ctx:
                if emoji == _emoji:
                    await message.delete()
                    if (random == _image_url):
                        if _amount:
                            Wealth.collection.update_one(
                                {"_id": ctx.author.id},
                                {"$inc": {
                                    "coins": _amount
                                }})
                        return await ctx.send(
                            f"Hey {ctx.author.mention} {_message}")
                    return await ctx.send(
                        f"Sorry {ctx.author.mention} you chose the wrong one! try again next time."
                    )

            try:
                res = await self.bot.wait_for(
                    'reaction_add',
                    check=lambda r, u: u.id == ctx.author.id and r.message.id
                    == message.id,
                    timeout=4)

                if not res:
                    break

                if res[1].id != 700292147311542282:  # use ID instead of user name
                    emoji = str(res[0].emoji)

            except:
                await message.delete()
                return await ctx.send(
                    f"Sorry {ctx.author.mention} you werent fast enough and World got away..."
                )

        await message.clear_reactions()
Example #4
0
    async def guesstheflag(self, ctx):
    	FlagChosen = choice(self.Country)

    	req = await self.session.get(f"https://www.countryflags.io/{FlagChosen['code'].lower()}/flat/64.png")
    	if req.status != 200:
    		return await ctx.send(f"Sorry {ctx.author.mention} The api is down.")
    	req.close()

    	FirstMessage = await ctx.send(embed=Embed(title="Guess the flag!", color=self.bot.color).set_image(url=f"https://www.countryflags.io/{FlagChosen['code'].lower()}/flat/64.png"))

    	while True:
    		try:
    			start = round(time() * 100)
    			resp = await self.bot.wait_for("message", check=lambda message: message.channel == ctx.channel and message.guild == ctx.guild and message.content == FlagChosen['name'], timeout=18)
    			elapse = round(time() * 100) - start
    			if resp.content.lower() == FlagChosen['name'].lower():
    				if not Wealth._has_account(resp.author.id):
    					Wealth._create_account(resp.author.id)
    				RandomCoins = randint(15, 60)
    				Wealth.collection.update_one({"_id": resp.author.id}, {"$inc": {"coins": RandomCoins}})
    				return await ctx.send(embed=Embed(title="Guess the flag", description=f"{resp.author.mention} guessed the country right!\nThe country was `{FlagChosen['name']}`\nTime took: `{elapse/1000}s`\nCoins earned: `{RandomCoins}`", color=self.bot.color))
    		except:
    			await FirstMessage.delete()
    			return await ctx.send(f"Sorry {ctx.author.mention} nobody guessed the flag! It was: `{FlagChosen['name']}`")
Example #5
0
    async def trash(self, ctx):
        random = Wealth.trash_ran()
        doc = Wealth.collection.find_one({'_id': ctx.author.id})
        random_coins = randint(1, 18)
        random_cookies = randint(1, 21)
        trash_ctx = {
            "https://im-a-dev.xyz/i8HiGmwU.png":
            None,  # key_name, amount_added_to_db, message
            "https://im-a-dev.xyz/ogWxLI7K.png":
            ("Reputation", 1,
             f"Wow, You found some Reputation in the trash! Good job, You now have a total of `{(doc['Reputation'] + 1)}` Rep points!"
             ),
            "https://im-a-dev.xyz/zqyCJ9sH.png":
            ("cookie", random_cookies,
             f"Amazing, You found `{random_cookies}` cookies in the trash bin, You now have `{(doc['cookie'] + random_cookies):,}` Cookies!"
             ),
            "https://im-a-dev.xyz/om3vsD0s.png":
            ("coins", random_coins,
             f"Nice you found a bag of coins in the trash bin!\nCoins in the bag: `{random_coins}`\nyou now have a total of `{(doc['coins'] + random_coins):,}` Coins!"
             )
        }

        if not trash_ctx[random]:  # they didn't caught anything
            return await ctx.send(embed=Embed(
                title="Trash Search",
                description="Nothing found in this bin, Try again soon!",
                color=self.bot.color).set_image(
                    url="https://im-a-dev.xyz/i8HiGmwU.png"))
        # otherwise, they caught something
        key_name, amount_added_to_db, message = trash_ctx[random]
        Wealth.collection.update_one({"_id": ctx.author.id},
                                     {"$inc": {
                                         key_name: amount_added_to_db
                                     }})
        return await ctx.send(embed=Embed(
            title="Trash Search", description=message,
            color=self.bot.color).set_image(url=random))
Example #6
0
    async def fishing(self, ctx):
        random = Wealth.fishing_ran()
        doc = Wealth.collection.find_one({'_id': ctx.author.id})
        random_coins = randint(1, 50)
        fishing_ctx = {  # using it here because it has randint() in it
            "https://im-a-dev.xyz/1kKJXQSr.png":
            None,  # key_name, amount_added_to_db, message
            "https://im-a-dev.xyz/ImWqkaSy.png":
            ("Fish", 1,
             f"Great, looks like you have caught a fish! you now have a total of `{(doc['Fish'] + 1):,}` Fish!"
             ),
            "https://im-a-dev.xyz/sqPSfhJJ.png":
            ("cookie", 5,
             f"Wow, you caught a box of cookies while fishing?! you now have a total of `{(doc['cookie'] + 5):,}` Cookies!"
             ),
            "https://im-a-dev.xyz/syTQUdrV.png":
            ("coins", random_coins,
             f"Wow, you caught a bag of coins while fishing?!\nCoins in the bag: `{random_coins}`\nyou now have a total of `{(doc['coins'] + random_coins):,}` Coins!"
             )
        }

        if not fishing_ctx[random]:  # they didn't caught anything
            return await ctx.send(embed=Embed(
                title="Fishing",
                description=
                "There are no fish in the lake right now, come again soon!",
                color=self.bot.color).set_image(
                    url="https://im-a-dev.xyz/1kKJXQSr.png"))
        # otherwise, they caught something
        key_name, amount_added_to_db, message = fishing_ctx[random]
        Wealth.collection.update_one({"_id": ctx.author.id},
                                     {"$inc": {
                                         key_name: amount_added_to_db
                                     }})
        return await ctx.send(embed=Embed(
            title="Fishing", description=message,
            color=self.bot.color).set_image(url=random))