Beispiel #1
0
async def ex(args, message, bot, invoke):
    with open('permissions/kon_auth.json', encoding='utf-8') as auth_file:
        auth_data = json.loads(auth_file.read())
    if args:
        if owner_check(message):
            if args[0].lower() == 'enable':
                kon_p = auth_data['auth']
                if 'Enabled' not in kon_p:
                    kon_auth(auth_data, 'Enabled')
                    response = discord.Embed(title="🔓 Enabled Kon command",
                                             color=0xFFCC4d)
                else:
                    response = discord.Embed(
                        title="❗ Kon command already enabled", color=0xBE1931)
            elif args[0].lower() == 'disable':
                kon_p = auth_data['auth']
                if 'Disabled' not in kon_p:
                    kon_auth(auth_data, 'Disabled')
                    response = discord.Embed(title="🔒 Disabled Kon command",
                                             color=0xFFCC4d)
                else:
                    response = discord.Embed(
                        title="❗ Kon command already disabled", color=0xBE1931)
            else:
                response = discord.Embed(title="❗ Invalid input",
                                         color=0xBE1931)
        else:
            response = discord.Embed(title="⛔ You are not the owner",
                                     color=0xBE1931)
    else:
        kon_p = auth_data['auth']
        if not owner_check(message) or 'Enabled' in kon_p:
            await message.add_reaction(emoji='⛔')
            return
        else:
            global links
            if not links:
                filler_message = discord.Embed(
                    color=0xff3300,
                    title='🦊 One moment, filling Kon with foxes...')
                fill_notify = await message.channel.send(embed=filler_message)
                links = await grab_post_list('fox_tail')
                filler_done = discord.Embed(
                    color=0xff3300, title=f'🦊 We added {len(links)} foxes!')
                await fill_notify.edit(embed=filler_done)
            rand_pop = secrets.randbelow(len(links))
            post_choice = links.pop(rand_pop)
            icon = 'https://static.tvtropes.org/pmwiki/pub/images/Holo_Ears_7860.jpg'
            response = generate_embed(post_choice,
                                      embed_titles,
                                      0xff3300,
                                      icon=icon)
    await message.channel.send(None, embed=response)
Beispiel #2
0
async def ex(args, message, bot, invoke):
    if owner_check(message):
        if args or message.attachments:
            if message.attachments:
                image_url = message.attachments[0].url
            else:
                image_url = ' '.join(args)
            try:
                async with aiohttp.ClientSession() as session:
                    async with session.get(image_url) as image_response:
                        img_data = await image_response.read()
                await bot.user.edit(avatar=img_data)
                response = discord.Embed(
                    title=f'✅ My avatar has been changed.', color=0x77B255)
            except discord.Forbidden:
                response = discord.Embed(
                    title=f'❗ I was unable to change my avatar.',
                    color=0xBE1931)
        else:
            response = discord.Embed(
                title='❗ Give me a link or attach an image, please.',
                color=0xBE1931)
    else:
        response = discord.Embed(title="⛔ You are not the owner",
                                 color=0xBE1931)
    await message.channel.send(embed=response)
Beispiel #3
0
async def ex(args, message, bot, invoke):
    if owner_check(message):
        if args:
            try:
                name_input = ' '.join(args)
                await bot.user.edit(username=name_input)
                response = discord.Embed(color=0x77B255, title=f'✅ Changed username to {name_input}.')
            except discord.Forbidden:
                response = discord.Embed(color=0xBE1931, title=f'❗ I was unable to change my username.')
        else:
            response = discord.Embed(title='❗ Give me a username to change to, please.', color=0xBE1931)
    else:
        response = discord.Embed(title="⛔ You are not the owner", color=0xBE1931)
    await message.channel.send(embed=response)
Beispiel #4
0
async def ex(args: list, message: discord.Message, bot, invoke):
    if not owner_check(message):
        await message.channel.send(embed=discord.Embed(
            title="⛔ You are not the owner", color=0xBE1931))
    else:
        if not args:
            status = discord.Embed(color=0xBE1931,
                                   title='❗ Nothing Inputted To Process')
        else:
            try:
                execution = " ".join(args)
                output = eval(execution)
                if inspect.isawaitable(output):
                    output = await output
                status = discord.Embed(title='✅ Executed', color=0x77B255)
                status.add_field(name='Results', value=f'\n```\n{output}\n```')
            except Exception as e:
                status = discord.Embed(color=0xBE1931, description=f'{e}')
                status.set_author(name='Error',
                                  icon_url='https://i.imgur.com/S7aUuLU.png')
        await message.channel.send(None, embed=status)
Beispiel #5
0
async def ex(args, message, bot, invoke):
    if owner_check(message):
        if args:
            status = ' '.join(args)
            activity = discord.Activity(type=discord.ActivityType.playing,
                                        name=status)
            await bot.change_presence(activity=activity)
            response = discord.Embed(
                title=f'✅ New playing status set to {status}.', color=0x77B255)
            with open('config.json', 'r') as config_data:
                status_data = json.load(config_data)
            status_data['Status'] = f'{status}'
            with open('config.json', 'w') as config_data:
                json.dump(status_data, config_data, sort_keys=True, indent=4)
        else:
            response = discord.Embed(
                title='❗ Give me a status to change to, please.',
                color=0xBE1931)
    else:
        response = discord.Embed(title="⛔ You are not the owner",
                                 color=0xBE1931)
    await message.channel.send(embed=response)