Cyanic76 / discord-modmail

THIS IS A MIRROR. ISSUES AND PR MUST BE SUBMITTED TO CODEBERG.
https://codeberg.org/Cyanic76/discord-modmail
MIT License
77 stars 48 forks source link

Supplied parameter is not a User nor a Role. #39

Closed Todgins closed 3 years ago

Todgins commented 3 years ago

Have booted up the bot an enabled DM's to true via config. Upon DMing the bot I receive the following

Logged in as BOTUSERNAME
/home/pi/Lillette/modmail/node_modules/discord.js/src/structures/PermissionOverwrites.js:184
    if (!userOrRole) throw new TypeError('INVALID_TYPE', 'parameter', 'User nor a Role');
                           ^

TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
    at Function.resolve (/home/pi/Lillette/modmail/node_modules/discord.js/src/structures/PermissionOverwrites.js:184:28)
    at /home/pi/Lillette/modmail/node_modules/discord.js/src/managers/GuildChannelManager.js:127:81
    at Array.map (<anonymous>)
    at GuildChannelManager.create (/home/pi/Lillette/modmail/node_modules/discord.js/src/managers/GuildChannelManager.js:127:51)
    at Client.<anonymous> (/home/pi/Lillette/modmail/bot.js:43:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  [Symbol(code)]: 'INVALID_TYPE'
}
Todgins commented 3 years ago

It appears to be related to this block of code, as it runs as intended (minus handling permissions) when it is isolated from bot.js

                /*permissionOverwrites: [
                    {id: guild.roles.everyone, deny: [Permissions.FLAGS.VIEW_CHANNEL]},
                    {id: guild.roles.fetch(config.roles.mod), allow: [
                        Permissions.FLAGS.VIEW_CHANNEL,
                        Permissions.FLAGS.SEND_MESSAGES,
                        Permissions.FLAGS.ATTACH_FILES,
                        Permissions.FLAGS.EMBED_LINKS,
                        Permissions.FLAGS.READ_MESSAGE_HISTORY
                    ]},
                                        {id: guild.roles.fetch(config.roles.bot), allow: [
                                                Permissions.FLAGS.VIEW_CHANNEL,
                                                Permissions.FLAGS.SEND_MESSAGES,
                                                Permissions.FLAGS.ATTACH_FILES,
                                                Permissions.FLAGS.EMBED_LINKS,
                                                Permissions.FLAGS.READ_MESSAGE_HISTORY
                                        ]}
                ]*/
Cyanic76 commented 3 years ago

guild.roles.everyone actually works, so it doesn't appear to be related to this. Could be related to other roles IDs. guild.roles.everyone should return the server ID.

stale[bot] commented 3 years ago

This issue was marked as stale because it had no activity during the past 2 weeks. If this issue keeps being inactive, it will get closed in 3 days. Thanks for your contributions!

stale[bot] commented 3 years ago

This issue was closed due to inactivity. Thanks for your contributions!