Checking permission to create channels/roles

I have a command which can create a channel and/or role so I have code to ensure the bot has the correct permission to do so as shown below:
    public static async canCreateChannel(guild: Guild): Promise<boolean> {
        let botMember = await guild.members.fetchMe();

        if (!botMember) return false;

        return botMember.permissions.has(PermissionFlagsBits.ManageChannels);
    }


After I check this I then proceed to create the channel as shown in the screenshot.

For the majority of servers this seems to work, but for some reason I still get some errors in my logs for Missing Permission (also shown in a screenshot) when trying to create either the channel or role.
image.png
image.png
Was this page helpful?