def edit_mod_entry(self, modcfg, data):
"""Edit a moderation entry."""
modlog = data['guild'].get_channel(modcfg['mod_log_id'])
if modlog is None:
raise self.SayException('Moderation channel not found')
try:
action_data = self.cache[data['action_id']]
except KeyError:
raise self.SayException("Can't find action ID in cache, sorry :c")
old_data = action_data['data']
old_data['reason'] = data['reason']
try:
message = await modlog.get_message(action_data['message_id'])
except discord.NotFound:
raise self.SayException('Message to edit not found')
except discord.Forbidden:
raise self.SayException("Can't read messages")
except discord.HTTPException as err:
raise self.SayException(f'fug `{err!r}`')
await message.edit(content=self.modlog_fmt(old_data))
评论列表
文章目录