Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: USER Issue causing bug #3354

Open
auyylaso opened this issue Nov 5, 2024 · 4 comments
Open

[BUG]: USER Issue causing bug #3354

auyylaso opened this issue Nov 5, 2024 · 4 comments

Comments

@auyylaso
Copy link

auyylaso commented Nov 5, 2024

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.

@auyylaso auyylaso added the maybe: bug An unconfirmed bug label Nov 5, 2024
@sebkuip
Copy link
Member

sebkuip commented Nov 5, 2024

Well this is supposed to throw an error as this is unintentional behavior. Not sure what you expect a check to fix because the set permissions will fail anyways.

@auyylaso
Copy link
Author

auyylaso commented Nov 5, 2024

Just a catch that throws a message in the discord channel that the user is using. It's not needed but would be good to have some sort of feedback that isn't just terminal side.

The catch is already there for the exception. Maybe it's pointless but I'm more so thinking for the less technical savvy that may not know why the bot isn't setting permission and doesn't realize they can use ?debug to print the logs

@raidensakura
Copy link
Member

Duplicate of #3275

@auyylaso
Copy link
Author

auyylaso commented Nov 5, 2024

Duplicate of #3275

Not exactly the one you posted is an error caused by a lack of permissions aka a 403 response the error that I posted is about a missing category making it so the bot can't change permissions.

@sebkuip sebkuip added feature request code improvement and removed maybe: bug An unconfirmed bug labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants