Skip to content

Adding support for creating custom emojis  #75

@swarajd

Description

@swarajd

I need the functionality of creating custom emojis for test guilds. I have the following test case:

@pytest.mark.asyncio
async def test_taking_an_L(bot):

    config = dpytest.get_config()
    guild = config.guilds[0]

    # create an emoji with an empty PNG
    await guild.create_custom_emoji(
        name="myemoji", 
        image=b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'
    )

    reg_mem = await dpytest.member_join()
    message = await dpytest.message(content="content to test on", member=reg_mem)
    assert "myemoji" in [r.emoji for r in message.reactions]

However, this functionality is not yet added as per this error log: https://pastebin.com/XVaGUTjJ

shorter error log as follows:

NotImplementedError: Operation occured that isn't captured by the tests framework. This is dpytest's fault, please reportan issue on github. Debug Info: POST https://discord.com/api/v7/guilds/980629415211958283/emojis with {'json': {'name': 'puyrun', 'image': 'data:image/png;base64,iVBORw0KGgo=', 'roles': []}, 'reason': None}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions