Example #1
0
    async def unload(self, ctx, *, cog: str):
        """Command which Unloads a Module.
        Remember to use dot path. e.g: cogs.owner"""

        try:
            self.bot.unload_extension(cog)
        except Exception as e:
            await ctx.send(embed=inc.embederr(f'Failed to unload extension {type(e).__name__} - {e}'))
        else:
            await ctx.send(embed=inc.embednorm("Successfully unloaded extension"))
Example #2
0
 async def give(self, ctx, user: discord.Member, amount: int):
     # do some checks for user
     if user is None or amount is None:
         await ctx.send(embed=inc.embederr(
             str(user) +
             " The correct parameter for this command is !!addremove @user amount"
         ))
     else:
         if mysqlhandler.changebal(user.id, amount):
             await ctx.send(embed=inc.embednorm(
                 str(user) + " added/removed " + str(amount) + " from " +
                 user.mention + "'s account"))
Example #3
0
    async def pay(self, ctx, user: discord.Member, amount: int):
        # do some checks for user
        coins = mysqlhandler.getuser(ctx.message.author.id)

        if coins == "ERROR":
            coins = 0
        else:
            coins = int(coins)
        if amount < 1:
            await ctx.send(embed=inc.embederr(
                str(ctx.message.author) +
                " You cannot send a value less than 1"))
        else:
            if coins < amount:
                await ctx.send(embed=inc.embederr(
                    str(ctx.message.author) +
                    " You do not have enough coins to send"))
            else:
                if mysqlhandler.changebal(ctx.message.author.id, -amount):
                    print("deducted", "giving now")
                    if mysqlhandler.changebal(user.id, amount):
                        print("gave")
                        await ctx.send(embed=inc.embednorm(
                            str(user) + " Sent " + str(amount) + " to " +
                            user.mention))
                    else:
                        if mysqlhandler.changebal(ctx.message.author.id,
                                                  amount):
                            await ctx.send(embed=inc.embederr(
                                str(user) + " Failed to send coins to " +
                                str(user) + " , Refunded the coins sent"))
                        else:
                            await ctx.send(embed=inc.embederr(
                                str(user) +
                                " Something went terribly wrong, contact one of our admins to get your coins back (if you lost any)"
                            ))
Example #4
0
 async def payerr(self, ctx, error):
     await ctx.send(embed=inc.embederr(str(error)))