Example #1
0
class ReloadCog(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True, is_owner=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(hidden=True)
    async def reload(self, ctx, cog):
        try:
            self.bot.unload_extension('{}'.format(cog))
            await sleep(1)
            self.bot.load_extension('{}'.format(cog))
            embed = discord.Embed(
                color=color,
                description=
                f'<:confirmado:519896822072999937>│Extenção **{cog}**, recarregada com sucesso!'
            )
            await ctx.send(embed=embed)
        except ModuleNotFoundError as e:
            embed = discord.Embed(
                color=discord.Color.red(),
                description=
                f'<:oc_status:519896814225457152>│Falha ao recarregar a extenção **{cog}**. \n```{e}```'
            )
            await ctx.send(embed=embed)
Example #2
0
class SlapClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='slap', aliases=['tapa'])
    async def slap(self, ctx):
        try:
            slapimg = [
                'https://media.giphy.com/media/2ni8mCQhDe6buYEzMG/giphy.gif',
                'https://media.giphy.com/media/c75UADvToGNZTBFBtO/giphy.gif',
                'https://media.giphy.com/media/7zMvSym6iPdlNvm8hd/giphy.gif',
                'https://media.giphy.com/media/3d5NhNnsXQ7LB1XhH5/giphy.gif',
                'https://media.giphy.com/media/U86rbsmKUVtQVODuoI/giphy.gif'
            ]
            slap = choice(slapimg)
            slapemb = discord.Embed(
                title='Tapa :wave:',
                description=
                '**{}** Ele(a) levou um tapa de **{}**! Acho que doeu... '
                'SOLDADO FERIDO! :broken_heart: '.format(
                    ctx.message.mentions[0].name, ctx.author.name),
                color=color)
            slapemb.set_image(url=slap)
            slapemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=slapemb)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'abraçar!``')
Example #3
0
class KickClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='kick', aliases=['chute'])
    async def kick(self, ctx):
        try:
            kickimg = [
                'https://media.giphy.com/media/28dP8puMEC1iVGgUtY/giphy.gif',
                'https://media.giphy.com/media/28DOzqSFj5RbODIeu8/giphy.gif',
                'https://media.giphy.com/media/1eEDH9ib0DpJ48F1oF/giphy.gif',
                'https://media.giphy.com/media/C9U5DgKIde7fjOWHf6/giphy.gif',
                'https://media.giphy.com/media/mMCXkn2YIFUdGcthIa/giphy.gif',
                'https://media.giphy.com/media/5kFQ3Dt7dEmlrUduSR/giphy.gif'
            ]
            kick = random.choice(kickimg)
            kickemb = discord.Embed(
                title='Chute :boot:',
                description='**{}** Ele(a) levou um chute de **{}**! {}'
                ':joy: '.format(
                    ctx.message.mentions[0].name, ctx.author.name, 'Tomo!'
                    if random.randint(1, 2) == 1 else 'Achei merecido.'),
                color=color)
            kickemb.set_image(url=kick)
            kickemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=kickemb)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'abraçar!``')
Example #4
0
class PushClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='push', aliases=['empurrao'])
    async def push(self, ctx):
        try:
            pushimg = [
                'https://media.giphy.com/media/2eqvwrFmCPz4ngW0DC/giphy.gif',
                'https://media.giphy.com/media/4Q1I8CEIjkQAvZnmPx/giphy.gif',
                'https://media.giphy.com/media/dB1Ds51ye6smSv09lX/giphy.gif',
                'https://media.giphy.com/media/vcAXxIghuHWaPainqe/giphy.gif',
                'https://media.giphy.com/media/65zUCIaDvzhyQdYThW/giphy.gif'
            ]
            push = choice(pushimg)
            pushemb = discord.Embed(
                title='Empurrão :raised_hands:',
                description=
                '**{}** Ele(a) recebeu um empurrão de **{}**! BRIGA! '
                ':laughing: '.format(ctx.message.mentions[0].name,
                                     ctx.author.name),
                color=color)
            pushemb.set_image(url=push)
            pushemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=pushemb)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'abraçar!``')
Example #5
0
class RoleInfo(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='roleinfo', aliases=['inforole'])
    async def roleinfo(self, ctx, *, role: commands.RoleConverter = None):
        if role is not None:
            embed = discord.Embed(color=color,
                                  description='**Informações do cargo:**')
            embed.add_field(name='`📋 | Nome:`', value=str(role))
            embed.add_field(name='`💻 | ID:`', value=str(role.id))
            embed.add_field(name='`🌈 | Cor:`', value=str(role.colour))
            embed.add_field(name='`📅 | Criado:`',
                            value=str(role.created_at))
            embed.add_field(name='`🗃 | Permissões:`',
                            value="```{}```".format(
                                perms_check(role.permissions)))
            await ctx.send(embed=embed)
        else:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa colocar um cargo para ver as informações!``'
            )
Example #6
0
class DanceClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='dance', aliases=['dança'])
    async def dance(self, ctx):
        try:
            dance_img = [
                'https://media.giphy.com/media/1woCaEQvSvKMODsyEA/giphy.gif',
                'https://media.giphy.com/media/xWfS0QepPvL3iYViCY/giphy.gif',
                'https://media.giphy.com/media/5kFckUFIHb5W07fpmJ/giphy.gif',
                'https://media.giphy.com/media/1X8U0exkuqAMMKAQ3Y/giphy.gif',
                'https://media.giphy.com/media/58FpXQi6fKXrQcZPba/giphy.gif'
            ]
            dance = choice(dance_img)
            dance_embed = discord.Embed(
                title='Dance <a:dyno:541775159460102167>',
                description=
                '**{}** Ele(a) esta dançando com **{}**! Alguem tira foto! EU '
                'SHIPPO! :heart_eyes: '.format(ctx.message.mentions[0].name,
                                               ctx.author.name),
                color=color)
            dance_embed.set_image(url=dance)
            dance_embed.set_footer(
                text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=dance_embed)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'dançar!``')
Example #7
0
class LickClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='lick', aliases=['lambida'])
    async def lick(self, ctx):
        try:
            lickimg = [
                'https://media.giphy.com/media/2tKBNfl2rCnpeJXS4H/giphy.gif',
                'https://media.giphy.com/media/3ZZ9tf6NpY0pxr9VYo/giphy.gif',
                'https://media.giphy.com/media/40bEkgVmarjulQAo1M/giphy.gif',
                'https://media.giphy.com/media/TIx5q55UTonDN0oxw2/giphy.gif',
                'https://media.giphy.com/media/PNxrsO5Ql0RibjZCxo/giphy.gif'
            ]
            lick = choice(lickimg)
            lickemb = discord.Embed(
                title='Lambida :heart:',
                description=
                '**{}** Ele(a) recebeu uma lambida de **{}**! Que casal fofo! '
                ':heart_eyes: '.format(ctx.message.mentions[0].name,
                                       ctx.author.name),
                color=color)
            lickemb.set_image(url=lick)
            lickemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=lickemb)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'abraçar!``')
Example #8
0
class Avatar(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='avatar', aliases=['a'])
    async def avatar(self, ctx):
        try:
            user = ctx.message.mentions[0]
            embed = discord.Embed(
                title="Avatar de: {}".format(user.name),
                color=color)
            embed.set_image(url=user.avatar_url)
            embed.set_footer(text="Pedido por {}#{}".format(ctx.author.name, ctx.author.discriminator))
            await ctx.channel.send(embed=embed)
        except IndexError:
            user2 = ctx.author
            embed2 = discord.Embed(
                title="Avatar de: {}".format(user2.name),
                color=color)
            embed2.set_image(url=user2.avatar_url)
            embed2.set_footer(text="Pedido por {}#{}".format(ctx.author.name, ctx.author.discriminator))
            await ctx.channel.send(embed=embed2)
Example #9
0
class PunchClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='punch', aliases=['soco'])
    async def punch(self, ctx):
        try:
            punchimg = [
                'https://media.giphy.com/media/loMkSw7gyB5FKOK7mR/giphy.gif',
                'https://media.giphy.com/media/8JW411NAN3yAT5dYst/giphy.gif',
                'https://media.giphy.com/media/1H84T9Cm1SF15uFca4/giphy.gif',
                'https://media.giphy.com/media/bwPqXlNEDvT3URFBIa/giphy.gif',
                'https://media.giphy.com/media/YVrv6Z9gdfqkHl4mHa/giphy.gif',
                'https://media.giphy.com/media/nyjEMeiIK7n9APuzrv/giphy.gif'
            ]
            punch = choice(punchimg)
            punchemb = discord.Embed(
                title='Soco :boxing_glove: ',
                description='**{}** Ele(a) levou um soco de **{}**! GAME! '
                ':regional_indicator_k: :regional_indicator_o:  '.format(
                    ctx.message.mentions[0].name, ctx.author.name),
                color=color)
            punchemb.set_image(url=punch)
            punchemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=punchemb)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'abraçar!``')
Example #10
0
class LickClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.color = self.bot.color

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='lick', aliases=['lambida', 'lamber'])
    async def lick(self, ctx, member: discord.Member = None):
        """Comando de gifs de lambida
        Use ash lick <@usuario a sua escolha>"""
        if member is None:
            return await ctx.send("<:alert:739251822920728708>│``Você precisa mencionar alguem!``")
        try:
            await ctx.message.delete()
        except discord.errors.Forbidden:
            pass
        try:
            lickimg = ['https://media1.tenor.com/images/5f73f2a7b302a3800b3613095f8a5c40/tenor.gif?itemid=10005495',
                       'https://media1.tenor.com/images/0c608b33607b4e92350198b53c8940c7/tenor.gif?itemid=16735374',
                       'https://media1.tenor.com/images/ec2ca0bf12d7b1a30fea702b59e5a7fa/tenor.gif?itemid=13417195',
                       'https://media1.tenor.com/images/c1d9ff6f013a3deba4b7941fa00374e5/tenor.gif?itemid=16150817',
                       'https://media1.tenor.com/images/6b701503b0e5ea725b0b3fdf6824d390/tenor.gif?itemid=12141727']
            lick = choice(lickimg)
            lickemb = discord.Embed(title='Lambida :heart:',
                                    description='**{}** Ele(a) recebeu uma lambida de **{}**! Que casal fofo! '
                                                ':heart_eyes: '.format(member.name, ctx.author.name),
                                    color=self.color)
            lickemb.set_image(url=lick)
            lickemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=lickemb)
        except IndexError:
            await ctx.send('<:negate:721581573396496464>│``Você precisa mencionar um usuário específico para '
                           'lamber!``')
Example #11
0
class LoadCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.color = self.bot.color

    @check_it(no_pm=True, is_owner=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='load')
    async def load(self, ctx, cog):
        """apenas desenvolvedores"""
        try:
            self.bot.load_extension('{}'.format(cog))
            embed = discord.Embed(
                color=self.color,
                description=
                f'<:confirmed:721581574461587496>│Extenção **{cog}**, carregada com sucesso!'
            )
            await ctx.send(embed=embed)
        except ModuleNotFoundError as e:
            embed = discord.Embed(
                color=discord.Color.red(),
                description=
                f'<:negate:721581573396496464>│Falha ao carregar a extenção **{cog}**. \n```{e}```'
            )
            await ctx.send(embed=embed)
Example #12
0
class KissClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='kiss', aliases=['beijo'])
    async def kiss(self, ctx):
        try:
            kissimg = [
                'https://media.giphy.com/media/xTDsoOpxyc0mfD5kRL/giphy.gif',
                'https://media.giphy.com/media/YFI5F1DGueggFIwjFQ/giphy.gif',
                'https://media.giphy.com/media/NRensrTKS7couFakNT/giphy.gif',
                'https://media.giphy.com/media/8cj4Ir95UFQGEiphsV/giphy.gif',
                'https://media.giphy.com/media/yvBl6HeIYNjiiKTw3W/giphy.gif'
            ]
            kiss = choice(kissimg)
            kissemb = discord.Embed(
                title='Beijo :heart:',
                description=
                '**{}** Ele(a) recebeu um beijo de **{}**! Que casal fofo! '
                ':heart_eyes: '.format(ctx.message.mentions[0].name,
                                       ctx.author.name),
                color=color)
            kissemb.set_image(url=kiss)
            kissemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=kissemb)
        except IndexError:
            await ctx.send(
                '<:negate:520418505993093130>│``Você precisa mencionar um usuário específico para '
                'abraçar!``')
Example #13
0
class Thinkers(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='thinker', aliases=['pensador'])
    async def thinker(self, ctx):
        """comando usado pra enviar uma frase do pensador
        Use ash thinker"""
        try:
            await ctx.message.delete()
        except discord.errors.Forbidden:
            pass

        thinker = self.bot.config['thinker']['list']
        answer = choice(thinker)

        msgs = ['``Assim diz o`` **pensador**', '``UM HOMEM UMA VEZ DISSE``', '``ME DISSERAM UM DIA QUE``',
                '``OUVIR FALAR QUE``', '``UMA PESSOA ME FALOU ASSIM``', '``UM DIA OUVIR ENQUANTO ANDAVA``']
        msg = choice(msgs)

        embed = discord.Embed(
            color=self.bot.color,
            description=f'<:confirmed:721581574461587496>│{msg}\n``{answer.upper()}``')
        await ctx.send(embed=embed)
Example #14
0
class DadoClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='roll', aliases=['rolar'])
    async def roll(self, ctx, dice: str = 'none'):
        if dice == 'none':
            return await ctx.send(
                '<:alert_status:519896811192844288>│`` Você precisa dizer: quantos e qual tipo de '
                'dado você quer rolar!``')
        try:
            rolls, limit = map(int, dice.split('d'))
        except ValueError:
            await ctx.send(
                '<:alert_status:519896811192844288>│``Não foi um formado:`` **N**d**N**!'
            )
            return
        global result
        result = ''
        for r in range(rolls):
            result += ''.join(str(random.randint(1, limit))) + ', '
        await ctx.send(f'```{result}```')
Example #15
0
class InviteClass(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='invite', aliases=['convite'])
    async def invite(self, ctx):
        await ctx.message.channel.send(
            "<:send:519896817320591385>│``Obrigado por querer participar da`` "
            "**MINHA COMUNIDADE** ``irei enviar para seu privado um convite "
            "para que você possa entrar!``")
        await sleep(1)
        try:
            await ctx.author.send(
                "<:confirmado:519896822072999937>│https://discord.gg/rYT6QrM")
            await ctx.author.send(
                "[clique aqui](https://discordapp.com/oauth2/authorize?client_id=478977311266570242&"
                "scope=bot&permissions=8) Caso você queria me add no seu servidor!"
            )
        except discord.errors.Forbidden:
            await ctx.send(
                '<:negate:520418505993093130>│``INFELIZMENTE NÃO FOI POSSIVEL ENVIAR A MENSAGEM PRA VOCÊ``'
            )
Example #16
0
class InviteClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.url = "https://discordapp.com/oauth2/authorize?client_id=478977311266570242&scope=bot&permissions=8"
        self.color = self.bot.color

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='invite', aliases=['convite'])
    async def invite(self, ctx):
        """comando usado pra gerar um convite pro server da ashley
        Use ash invite"""
        try:
            embed = discord.Embed(
                color=self.color,
                description=
                f'<:safada:530029764061298699>│[CLIQUE AQUI PARA ME ADICIONAR NO SEU '
                f'SERVIDOR]({self.url})')

            await ctx.author.send(
                "<:confirmed:721581574461587496>│https://discord.gg/rYT6QrM")
            await ctx.author.send(embed=embed)
            await ctx.send(
                "<:send:519896817320591385>│`Obrigado por querer participar da` "
                "**MINHA COMUNIDADE** `enviei para seu privado um convite "
                "para que você possa entrar!`")
        except discord.errors.Forbidden:
            await ctx.send(
                '<:negate:721581573396496464>│`INFELIZMENTE NÃO FOI POSSIVEL ENVIAR A MENSAGEM PRA VOCÊ '
                'SEU PRIVADO ESTA SEM ACESSO.`')
Example #17
0
class IaResponseClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx, vip=True))
    @commands.command(name='ia', aliases=['ai'])
    async def ia(self, ctx):
        """comando para habilitar/desabilitar a iteração com a IA da ashley
        use ash ia ou ash ai"""
        data = await self.bot.db.get_data("user_id", ctx.author.id, "users")
        update = data
        update['user']['ia_response'] = not update['user']['ia_response']
        response = update['user']['ia_response']
        await self.bot.db.update_data(data, update, "users")
        if response:
            embed = discord.Embed(
                color=discord.Color.green(),
                description=
                f'<:confirmed:721581574461587496>│`Interação com a Inteligencia Artificial '
                f'habilitada com sucesso!`')
            await ctx.send(embed=embed)
        else:
            embed = discord.Embed(
                color=discord.Color.red(),
                description=
                f'<:negate:721581573396496464>│`Interação com a Inteligencia Artificial '
                f'desabilitada com sucesso!`')
            await ctx.send(embed=embed)
Example #18
0
class DrawUsers(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.color = self.bot.color

    @check_it(no_pm=True)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.command(name='draw', aliases=['sorteio', 'sortear'])
    async def draw(self, ctx):
        """Comando de sorteio pro server inteiro
        Use ash draw"""
        draw_member = choice(list(ctx.guild.members))
        member = discord.utils.get(ctx.guild.members,
                                   name="{}".format(draw_member.name))
        embed = discord.Embed(
            title="``Fiz o sorteio de um membro``",
            colour=self.color,
            description=
            "Membro sorteado foi **{}**\n <a:palmas:520418512011788309>│``Parabens!!``"
            .format(member))
        embed.set_author(name=self.bot.user.name,
                         icon_url=self.bot.user.avatar_url)
        embed.set_footer(text="Ashley ® Todos os direitos reservados.")
        embed.set_thumbnail(url=member.avatar_url)
        await ctx.send(embed=embed)
Example #19
0
def listener():
    Db = Database()

    Db.execute(query='LISTEN "{}";'.format(os.environ["CONSOLE_ID"]))
    logger.info(
        'Waiting for notifications on channel "{}";'.format(os.environ["CONSOLE_ID"])
    )

    while True:
        Db.conn.poll()
        while Db.conn.notifies:
            notify = Db.conn.notifies.pop(0)
            logger.info(
                "Got NOTIFY:{} {} {}".format(notify.pid, notify.channel, notify.payload)
            )

            payload = json.loads(notify.payload)
            operation = payload["operation"]
            message = payload["message"]

            if operation in ["INSERT", "UPDATE"]:
                    job = """SELECT id, line_task_id, line_id, device_id, desired_state, exec_time, expire_time, status 
                    FROM jobs_queue
                    WHERE id = %(job_id)s"""
                messages = Db.execute(query=job, params={"job_id": message["id"]}, method="fetchone")
                msg = MsgAnalyzer(**message)
                msg.analyze_and_exec()
Example #20
0
class Reflection(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='reflect', aliases=['reflita'])
    async def reflect(self, ctx):
        image = Image.open('images/memes/reflita.png')
        draw = ImageDraw.Draw(image)
        message = choice(reflita)
        if 'zueira' in ctx.message.content:
            message = choice(reflita_zueira)
        msg = textwrap.wrap(message, width=25)
        font = ImageFont.truetype('fonts/text.ttf', 25)
        bounding_box = [310, 25, 620, 320]
        x1, y1, x2, y2 = bounding_box
        current_h = 250

        for line in msg:
            w, h = draw.textsize(line, font=font)
            x = (x2 - x1 - w) / 2 + x1
            y = (y2 - y1 - current_h) / 2 + y1
            draw.text((x, y), line, align='center', font=font)
            current_h -= h + 40

        draw.rectangle([x1, y1, x2, y2])
        image.save('reflita.png')
        await ctx.channel.send(file=discord.File('reflita.png'))
Example #21
0
class DadoClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='roll', aliases=['rolar'])
    async def roll(self, ctx, dice: str = 'none'):
        """Comando usado pra rolar um dado
        Use ash roll xdy, x sendo o numero de dados e y o numero do dado"""
        if dice == 'none':
            return await ctx.send(
                '<:alert:739251822920728708>│`` Você precisa dizer: quantos e qual tipo de '
                'dado você quer rolar!``')
        try:
            rolls, limit = map(int, dice.split('d'))
        except ValueError:
            await ctx.send(
                '<:alert:739251822920728708>│``Não foi um formato:`` **N**``d``**N**!'
            )
            return
        global result
        result = ''
        if rolls > 99:
            return await ctx.send(
                '<:alert:739251822920728708>│``Número muito grande de dados!``'
            )
        if limit > 99999:
            return await ctx.send(
                '<:alert:739251822920728708>│``Número muito grande de lados!``'
            )
        for r in range(rolls):
            result += ''.join(str(random.randint(1, limit))) + ', '
        await ctx.send(f'```{result[:-1]}```')
Example #22
0
class SourceGit(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.color = self.bot.color

    @check_it(no_pm=True, manage_guild=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx, vip=True))
    @commands.command(name='source')
    async def source(self, ctx, command: str = None):
        """Usado pra enviar codigos da ashley
        Use ash source <comando desejado>"""
        source_url = "https://github.com/Ashley-Lab/Ashley"
        if command is None:
            await ctx.send(source_url)
            return

        code_path = command.split('.')
        obj = self.bot
        for cmd in code_path:
            try:
                obj = obj.get_command(cmd)
                if obj is None:
                    embed = discord.Embed(
                        color=self.color,
                        description=
                        f"<:negate:721581573396496464>│``NÃO CONSEGUIR ENCONTRAR O COMANDO {cmd}!``"
                    )
                    return await ctx.send(embed=embed)
            except AttributeError:
                embed = discord.Embed(
                    color=self.color,
                    description=
                    f"<:negate:721581573396496464>│``{obj.name} ESSE COMANDO NÃO TEM SUB-COMANDOS!``"
                )
                return await ctx.send(embed=embed)

        src = obj.callback.__code__

        if not obj.callback.__module__.startswith('discord'):
            location = os.path.relpath(src.co_filename).replace('\\', '/')
            final_url = '<{}/tree/master/{}#L{}>'.format(
                source_url, location, src.co_firstlineno)
        else:
            location = obj.callback.__module__.replace('.', '/') + '.py'
            base = 'https://github.com/Rapptz/discord.py'
            final_url = '<{}/blob/master/{}#L{}>'.format(
                base, location, src.co_firstlineno)

        await ctx.send(final_url)

    @source.error
    async def source_error(self, ctx, error):
        if error.__str__() in ERRORS[12]:
            return await ctx.send(
                '<:negate:721581573396496464>│``Você precisa de uma permissão especifica:`` '
                '**manage_guild / Gerenciar Servidor**')
Example #23
0
File: say.py Project: euYosu/Ashley
class SaySomething(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.group(name='say',
                    aliases=['diga', 'dizer', 'falar', 'fale'],
                    invoke_without_command=True)
    async def say(self, ctx, *, msg: str = None):
        """comando usado pra ash enviar uma mensagem
        Use ash say <mensagem desejada>"""
        try:
            await ctx.message.delete()
        except discord.errors.Forbidden:
            pass
        if ctx.invoked_subcommand is None:
            if msg is None:
                return await ctx.send(
                    '<:negate:520418505993093130>│`DIGITE ALGO PARA EU FALAR`'
                )
            await ctx.send('```{}```'.format(msg.upper()))

    @check_it(no_pm=True, is_owner=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @say.command(name='channel', aliases=['canal'])
    async def _channel(self,
                       ctx,
                       channel: commands.TextChannelConverter,
                       *,
                       text: str = None):
        """apenas desenvolvedores"""
        if text is None:
            return await ctx.send(
                '<:negate:721581573396496464>│`DIGITE ALGO PARA EU FALAR`')
        try:
            await ctx.message.delete()
        except discord.errors.Forbidden:
            pass
        finally:
            await channel.send('```{}```'.format(text.upper()))
Example #24
0
class DoorClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True, is_owner=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='door', aliases=['porta'])
    async def door(self, ctx):
        """Sistema de segurança, controle de entra e sainda de membros (em desenvolvimento)"""
        pass
Example #25
0
class TransferClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='transfer', aliases=['trans', 'transferencia'])
    async def transfer(self, ctx):
        """comando usado pra transferir sua conta da ashley de um server pro outro
        Use ash transfer"""
        data_user = await self.bot.db.get_data("user_id", ctx.author.id, "users")
        data_guild_native = await self.bot.db.get_data("guild_id", data_user['guild_id'], "guilds")
        data_guild_future = await self.bot.db.get_data("guild_id", ctx.guild.id, "guilds")
        update_user = data_user
        update_guild_native = data_guild_native
        update_guild_future = data_guild_future
        a = '{:,.2f}'.format(float(update_user["treasure"]["money"]))
        b = a.replace(',', 'v')
        c = b.replace('.', ',')
        d = c.replace('v', '.')

        if data_user['guild_id'] == ctx.guild.id:
            return await ctx.send('<:negate:721581573396496464>│`Desculpe, você já está casdastrado nessa guilda!`')

        def check(m):
            if m.channel.id == ctx.channel.id and m.content.upper() in ['S', 'N']:
                perms = ctx.channel.permissions_for(m.author)
                if perms.manage_messages:
                    return True
            return False

        await ctx.send(f'**CAROS ADMINISTRADORES** `o membro` {ctx.author.mention} `quer associar sua conta do meu '
                       f'sistema na sua guilda. A conta dele contem exatos` **R${d} de Ethernyas** `alguem '
                       f'deseja recebe-lo? Responda com` **[S/N]**', delete_after=60.0)

        try:
            answer = await self.bot.wait_for('message', check=check, timeout=30.0)
        except TimeoutError:
            return await ctx.send('<:negate:721581573396496464>│`Desculpe, você demorou muito:` '
                                  '**COMANDO CANCELADO**')

        if answer.content.upper() == "S":
            if update_guild_native is not None:
                update_guild_native['data']['total_money'] -= update_user['treasure']['money']
                await self.bot.db.update_data(data_guild_native, update_guild_native, 'guilds')
            update_guild_future['data']['total_money'] += update_user['treasure']['money']
            update_user["guild_id"] = ctx.guild.id
            await self.bot.db.update_data(data_user, update_user, 'users')
            await self.bot.db.update_data(data_guild_future, update_guild_future, 'guilds')
            await ctx.send(f'<:confirmed:721581574461587496>│🎊 **PARABENS** 🎉 {ctx.author.mention} `Seu pedido foi'
                           f' aceito com sucesso, você agora faz parte da guilda` **{ctx.guild.name}**')
        else:
            await ctx.send('<:negate:721581573396496464>│`Desculpe, seu pedido de transferencia foi negado!`')
Example #26
0
class KissClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.color = self.bot.color

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='kiss',
                      aliases=['beijo', 'beijar', 'beijao', 'beijão'])
    async def kiss(self, ctx, member: discord.Member = None):
        """Comando de gifs de beijo
        Use ash kiss <@usuario a sua escolha>"""
        if member is None:
            return await ctx.send(
                "<:alert:739251822920728708>│`Você precisa mencionar alguem!`"
            )
        try:
            await ctx.message.delete()
        except discord.errors.Forbidden:
            pass
        try:
            kissimg = [
                'https://media1.tenor.com/images/ef4a0bcb6e42189dc12ee55e0d479c54/tenor.gif?itemid=12143127',
                'https://media1.tenor.com/images/b8d0152fbe9ecc061f9ad7ff74533396/tenor.gif?itemid=5372258',
                'https://media1.tenor.com/images/778d51aca07848160ad9b52e6df37b30/tenor.gif?itemid=16737083',
                'https://media1.tenor.com/images/693602b39a071644cebebdce7c459142/tenor.gif?itemid=6206552',
                'https://media1.tenor.com/images/e76e640bbbd4161345f551bb42e6eb13/tenor.gif?itemid=4829336'
            ]
            kiss = choice(kissimg)
            kissemb = discord.Embed(
                title='Beijo :heart:',
                description=
                '**{}** Ele(a) recebeu um beijo de **{}**! Que casal fofo! '
                ':heart_eyes: '.format(member.name, ctx.author.name),
                color=self.color)
            kissemb.set_image(url=kiss)
            kissemb.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=kissemb)

            data = await self.bot.db.get_data("user_id", ctx.author.id,
                                              "users")
            update = data
            try:
                update['ship'][str(member.id)] += 5
            except KeyError:
                update['ship'][str(member.id)] = 5
            await self.bot.db.update_data(data, update, 'users')

        except IndexError:
            await ctx.send(
                '<:negate:721581573396496464>│`Você precisa mencionar um usuário específico para '
                'beijar!`')
Example #27
0
class Thinkers(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='thinker', aliases=['pensador'])
    async def thinker(self, ctx):
        answer = choice(pensador)
        await ctx.message.channel.send(
            "Assim diz o **pensador**: ``{}``".format(answer))
Example #28
0
class AsciiText(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.command(name='ascii', aliases=['textao'])
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    async def ascii(self, ctx, *, msg="Digite Algo"):
        f = Figlet(font='slant')
        text = f.renderText(msg)
        await ctx.send("```{}```".format(text))
Example #29
0
class PingMS(object):
    def __init__(self, bot):
        self.bot = bot

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='ping', aliases=['latency'])
    async def ping(self, ctx):
        if ctx.message.guild is not None:
            ping = round(self.bot.latency * 1000)
            await ctx.send("🏓 ``Pong:`` **{}ms**".format(ping))
Example #30
0
File: hug.py Project: euYosu/Ashley
class HugClass(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.color = self.bot.color

    @check_it(no_pm=True)
    @commands.cooldown(1, 5.0, commands.BucketType.user)
    @commands.check(lambda ctx: Database.is_registered(ctx, ctx))
    @commands.command(name='hug', aliases=['abraço', 'abraco'])
    async def hug(self, ctx, member: discord.Member = None):
        """Comando de gifs de abraço
        Use ash hug <@usuario a sua escolha>"""
        if member is None:
            return await ctx.send(
                "<:alert:739251822920728708>│`Você precisa mencionar alguem!`")
        try:
            await ctx.message.delete()
        except discord.errors.Forbidden:
            pass
        try:
            hug_img = [
                'http://media1.tenor.com/images/e58eb2794ff1a12315665c28d5bc3f5e/tenor.gif?itemid=10195705',
                'http://media1.tenor.com/images/949d3eb3f689fea42258a88fa171d4fc/tenor.gif?itemid=4900166',
                'http://media1.tenor.com/images/11889c4c994c0634cfcedc8adba9dd6c/tenor.gif?itemid=5634578',
                'http://media1.tenor.com/images/d7529f6003b20f3b21f1c992dffb8617/tenor.gif?itemid=4782499',
                'https://media1.tenor.com/images/7db5f172665f5a64c1a5ebe0fd4cfec8/tenor.gif?itemid=9200935',
                'https://media1.tenor.com/images/1069921ddcf38ff722125c8f65401c28/tenor.gif?itemid=11074788',
                'https://media1.tenor.com/images/3c83525781dc1732171d414077114bc8/tenor.gif?itemid=7830142'
            ]
            hug = choice(hug_img)
            hug_embed = discord.Embed(
                title='Abraço :heart:',
                description=
                '**{}** Ele(a) recebeu um abraço de **{}**! Que casal fofo! '
                ':heart_eyes: '.format(member.name, ctx.author.name),
                color=self.color)
            hug_embed.set_image(url=hug)
            hug_embed.set_footer(text="Ashley ® Todos os direitos reservados.")
            await ctx.send(embed=hug_embed)

            data = await self.bot.db.get_data("user_id", ctx.author.id,
                                              "users")
            update = data
            try:
                update['ship'][str(member.id)] += 5
            except KeyError:
                update['ship'][str(member.id)] = 5
            await self.bot.db.update_data(data, update, 'users')

        except IndexError:
            await ctx.send(
                '<:negate:721581573396496464>│`Você precisa mencionar um usuário específico para abraçar!`'
            )