Skip to content

[BUG]: USER Issue causing bug #3354

Open
@auyylaso

Description

@auyylaso

Bot Version

4.1.0

How are you hosting Modmail?

PM2

Error Logs

Check additional info

Screenshots

No response

Additional Information

0|modmail  | 11/05/24 10:15:24 core.config[295] - INFO: Setting level_permissions.
0|modmail  | 11/05/24 10:15:24 __main__[1122] - INFO: Updating permissions for SUPPORTER, 1293175166150639667 (add=True).
0|modmail  | 11/05/24 10:15:24 cogs.utility[1350] - INFO: Granting Chaos Mod access to Modmail category.
0|modmail  | 11/05/24 10:15:24 __main__[1555] - ERROR: Unexpected exception:
0|modmail  | Traceback (most recent call last):
0|modmail  |   File "/root/.local/share/virtualenvs/modmail-R5e9Y0tA/lib/python3.10/site-packages/discord/ext/commands/core.py", line 235,                                                                                 in wrapped
0|modmail  |     ret = await coro(*args, **kwargs)
0|modmail  |   File "/home/hehe/modmail/cogs/utility.py", line 1351, in permissions_add
0|modmail  |     await self.bot.main_category.set_permissions(key, read_messages=True)
0|modmail  | AttributeError: 'NoneType' object has no attribute 'set_permissions'
0|modmail  | The above exception was the direct cause of the following exception:
0|modmail  | Traceback (most recent call last):
0|modmail  |   File "/root/.local/share/virtualenvs/modmail-R5e9Y0tA/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350,                                                                                 in invoke
0|modmail  |     await ctx.command.invoke(ctx)
0|modmail  |   File "/root/.local/share/virtualenvs/modmail-R5e9Y0tA/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1650                                                                                , in invoke
0|modmail  |     await ctx.invoked_subcommand.invoke(ctx)
0|modmail  |   File "/root/.local/share/virtualenvs/modmail-R5e9Y0tA/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1029                                                                                , in invoke
0|modmail  |     await injected(*ctx.args, **ctx.kwargs)  # type: ignore
0|modmail  |   File "/root/.local/share/virtualenvs/modmail-R5e9Y0tA/lib/python3.10/site-packages/discord/ext/commands/core.py", line 244,                                                                                 in wrapped
0|modmail  |     raise CommandInvokeError(exc) from exc
0|modmail  | discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribu                                                                                te 'set_permissions'

If you delete the main_category_id on discord side without updating it in the config command it will cause the bot to throw this error when trying to set "perms add level (LEVEL) Role"

Very simple fix just add a check before trying to update perms in the event the user is an idiot like me :D
I know nothing about this project otherwise I'd just make a PR plus I'm awful at python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions