Jerrie-Aries / modmail-plugins

Plugins for modmail-dev/Modmail
GNU General Public License v3.0
7 stars 16 forks source link

Rolemanager doesn't add buttons and reactions + embeds sometimes not generated #14

Closed RFlintstone closed 2 years ago

RFlintstone commented 2 years ago

I found rolemanager and the description was exactly what I was looking for however I find when I create embeds with [p]reactrole for manual roles it never seems to add buttons or reactions.

I tried all commands and the following commands didn't give back an embed and don't seem to work ([p] being the command prefix):

[p]autorole

[p]autorole add (only if the role exists) [p]autorole enable [p]autorole list

[p]reactrole

Is this plugin still under development, or is there something wrong with a dependency? Either way, cool plugin! 👌

Jerrie-Aries commented 2 years ago

The master branch should work.

Is there any error, can you post it if any? Also it is required to install the utils plugin first.

RFlintstone commented 2 years ago
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:32:37 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:32:37 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:32:45 __main__[1548] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 190, in wrapped
    ret = await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/moderation-master/moderation.py", line 328, in mute
    await member.timeout(duration.dt, reason=get_audit_reason(ctx.author, reason))
  File "/usr/local/lib/python3.9/site-packages/discord/member.py", line 975, in timeout
    await self.edit(timed_out_until=timed_out_until, reason=reason)
  File "/usr/local/lib/python3.9/site-packages/discord/member.py", line 874, in edit
    data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
  File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 738, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
10/25/22 12:32:50 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:32:50 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:35 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:33:35 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:35 __main__[1500] - ERROR: Ignoring exception in on_raw_bulk_message_delete.
10/25/22 12:33:35 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1389, in on_raw_bulk_message_delete
    reactrole = self.config.reactroles.find_entry(message_id)
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:49 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:33:49 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:49 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:33:49 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:49 __main__[1500] - ERROR: Ignoring exception in on_raw_bulk_message_delete.
10/25/22 12:33:49 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1389, in on_raw_bulk_message_delete
    reactrole = self.config.reactroles.find_entry(message_id)
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:58 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:33:58 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:33:58 __main__[1500] - ERROR: Ignoring exception in on_raw_bulk_message_delete.
10/25/22 12:33:58 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1389, in on_raw_bulk_message_delete
    reactrole = self.config.reactroles.find_entry(message_id)
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:34:11 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:34:11 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:41:18 __main__[1518] - WARNING: CommandNotFound: Command "warns" is not found
10/25/22 12:42:19 __main__[1518] - WARNING: CommandNotFound: Command "warnings" is not found
10/25/22 12:49:15 __main__[1500] - ERROR: Ignoring exception in on_raw_message_delete.
10/25/22 12:49:15 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1377, in on_raw_message_delete
    if not self.config.reactroles.find_entry(payload.message_id):
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
10/25/22 12:51:44 __main__[1500] - ERROR: Ignoring exception in on_raw_reaction_add.
10/25/22 12:51:44 __main__[1501] - ERROR: Unexpected exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 409, in _run_event
    await coro(*args, **kwargs)
  File "/modmailbot/plugins/Jerrie-Aries/modmail-plugins/rolemanager-master/rolemanager.py", line 1370, in on_raw_reaction_add_or_remove
    await self.config.reactroles.handle_reaction(payload)
AttributeError: '_MissingSentinel' object has no attribute 'reactroles'
Jerrie-Aries commented 2 years ago

Ok. The rolemanager plugin needs to be reloaded (uninstall and reinstall) after the utils plugin error. The utils must be the one that is loaded before rolemanager. Also maybe restarting the bot would do the trick.

RFlintstone commented 2 years ago

I restarted the bot but the problem is still there

RFlintstone commented 2 years ago

Reinstalled the plugin as well, issue persists

Jerrie-Aries commented 2 years ago

Resolved in commit 6ef58e4d.

The issue was fetching config from database (Config.fetch()) returning empty dictionary and the bot was trying to access the key with __get__ (i.e. accessing using square brackets), resulting KeyError and the plugin not properly loaded.