k8thekat / GatekeeperV2

Update to Gatekeeper
GNU General Public License v3.0
27 stars 11 forks source link

Whitelisting issues #68

Closed snaggo closed 1 year ago

snaggo commented 1 year ago

The whitelist feature is not working properly for me. Only Discord admins can request a whitelist, although permissions are set to "custom" and everyone is granted the "whitelist.request" permission.

A standard user can run the command, but only gets a "Handling your request, please wait..." response from the bot. At this point the request fails. The logs show the following output:

01/26/2023 10:31:13 AM [Gatekeeper] [ERROR] We ran into an issue. Hybrid command raised an error: Command 'request' raised an exception: IntegrityError: UNIQUE constraint failed: Users.MC_IngameName
01/26/2023 10:31:13 AM [Gatekeeper] [ERROR] Ignoring exception in on_command_error
Traceback (most recent call last):
File "/home/amp/.local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "/AMP/gatekeeperv2/GatekeeperV2-main/discordBot.py", line 90, in on_command_error
traceback.print_exception(exception)
TypeError: print_exception() missing 2 required positional arguments: 'value' and 'tb'"

When requesting the whitelist by an admin user, the request is executed correctly and the approval request appears in the specified channel. However, if the request is then accepted, the execution fails again and the following error appears in the logs:

"01/26/2023 10:40:06 AM [Gatekeeper] [INFO] We Accepted a Whitelist Request by Snaggolicious
01/26/2023 10:40:06 AM [Gatekeeper] [ERROR] Ignoring exception in view <Whitelist_view timeout=3600 children=2> for item <Accept_Whitelist_Button style=<ButtonStyle.success: 3> url=None disabled=False label ='Accept' emoji=None row=None>
Traceback (most recent call last):
File "/home/amp/.local/lib/python3.9/site-packages/discord/ui/view.py", line 425, in _scheduled_task
await item.callback(interaction)
File "/AMP/gatekeeperv2/GatekeeperV2-main/utils_ui.py", line 333, in callback
await self._view._whitelist_handler()
File "/AMP/gatekeeperv2/GatekeeperV2-main/utils_ui.py", line 309, in _whitelist_handler
discord_role = self._client.uBot.roleparse(db_server.Discord_Role, self._context, self._context.guild.id)
File "/AMP/gatekeeperv2/GatekeeperV2-main/utils.py", line 353, in roleparse
if parameter.isnumeric():
AttributeError: 'int' object has no attribute 'isnumeric'"

Rejecting the request works fine.

Interestingly, the same problem occurs with another MC server, but with a different error message:

"01/26/2023 10:46:10 AM [Gatekeeper] [INFO] We Accepted a Whitelist Request by Snaggolicious
01/26/2023 10:46:10 AM [Gatekeeper] [ERROR] Ignoring exception in view <Whitelist_view timeout=3600 children=2> for item <Accept_Whitelist_Button style=<ButtonStyle.success: 3> url=None disabled=False label ='Accept' emoji=None row=None>
Traceback (most recent call last):
File "/home/amp/.local/lib/python3.9/site-packages/discord/ui/view.py", line 425, in _scheduled_task
await item.callback(interaction)
File "/AMP/gatekeeperv2/GatekeeperV2-main/utils_ui.py", line 333, in callback
await self._view._whitelist_handler()
File "/AMP/gatekeeperv2/GatekeeperV2-main/utils_ui.py", line 316, in _whitelist_handler
await self._context.message.channel.send(content= f'{self._context.author.mention} \n{self._client.uBot.whitelist_reply_handler(whitelist_reply)}', delete_after= self._client.Message_Timeout)
TypeError: whitelist_reply_handler() missing 1 required positional argument: 'context'"

The error appears on both fabric servers and completely new vanilla servers.

It should be noted that the channels responsible for whitelisting on the Discord server are private channels. However, the bot definitely has the rights to these channels. He can also post the approval requests there.

k8thekat commented 1 year ago

Hey thanks for this report. These issues have been addressed on my devtesting branch and will be coming to main hopefully soon.

Much appreciated for the report.

k8thekat commented 1 year ago

Closing Issue as this has been fixed in v4.4.8 -> https://github.com/k8thekat/GatekeeperV2/commit/bc73355e879f4b6df0296e9a109f4e350234fab7