Merge pull request 'Fixed id access #266' (#267) from #266 into 1.0.1

Reviewed-on: sh-edraft.de/kd_discord_bot#267
Reviewed-by: Ebola-Chan <nick.jungmann@gmail.com>
Closes #266
This commit is contained in:
Sven Heidemann 2023-03-28 23:29:22 +02:00
commit ccf171e876
3 changed files with 7 additions and 7 deletions

View File

@ -32,9 +32,9 @@ class AutoRoleReactionHandler:
return return
guild = self._bot.get_guild(payload.guild_id) guild = self._bot.get_guild(payload.guild_id)
user = guild.get_member(payload.user_id) user = guild.get_member(payload.id)
if user is None: if user is None:
self._logger.warn(__name__, f"User {payload.user_id} in {guild.name} not found - skipping") self._logger.warn(__name__, f"User {payload.id} in {guild.name} not found - skipping")
return return
if user.bot: if user.bot:

View File

@ -52,12 +52,12 @@ class BaseOnVoiceStateUpdateEventScheduledEventBonus(OnVoiceStateUpdateABC):
return return
server = self._servers.get_server_by_discord_id(member.guild.id) server = self._servers.get_server_by_discord_id(member.guild.id)
user = self._users.get_user_by_discord_id_and_server_id(member.id, server.server_id) user = self._users.get_user_by_discord_id_and_server_id(member.id, server.id)
if active_event.participants.any(lambda x: x.user_id == user.user_id): if active_event.participants.any(lambda x: x.id == user.id):
self._logger.debug(__name__, f"Module {type(self)} stopped") self._logger.debug(__name__, f"Module {type(self)} stopped")
return return
settings: BaseServerSettings = self._base_helper.get_config(server.discord_server_id) settings: BaseServerSettings = self._base_helper.get_config(server.discord_id)
user.xp += settings.xp_per_event_participation user.xp += settings.xp_per_event_participation
self._users.update_user(user) self._users.update_user(user)
self._db.save_changes() self._db.save_changes()

View File

@ -36,9 +36,9 @@ class BaseReactionHandler:
self._logger.trace(__name__, f"Handle reaction {payload} {r_type}") self._logger.trace(__name__, f"Handle reaction {payload} {r_type}")
guild = self._bot.get_guild(payload.guild_id) guild = self._bot.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id) member = guild.get_member(payload.id)
if member is None: if member is None:
self._logger.warn(__name__, f"User {payload.user_id} in {guild.name} not found - skipping") self._logger.warn(__name__, f"User {payload.id} in {guild.name} not found - skipping")
return return
try: try: