Skip to content

Commit a11c0ed

Browse files
committed
fix delete channel autoclose functionality
1 parent 46f711a commit a11c0ed

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
2424
- `use_nickname_channel_name` config to use nicknames instead of usernames for channel names. ([GH #3112](https://github.com/kyb3r/modmail/issues/3112))
2525
- `show_log_url_button` config to show Log URL button. ([GH #3122](https://github.com/kyb3r/modmail/issues/3122))
2626
- Select menus for certain paginators.
27+
- `Title` field in `?logs`. ([GH #3142](https://github.com/kyb3r/modmail/issues/3142))
2728

2829
### Improved
2930

@@ -45,6 +46,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
4546
- Commands now work in threads.
4647
- Audit log searching now properly works.
4748
- Old data causing `?blocked` to fail. ([GH #3131](https://github.com/kyb3r/modmail/issues/3131))
49+
- Delete channel auto close functionality now works.
4850

4951
### Internal
5052

bot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,9 +1336,13 @@ async def on_guild_channel_delete(self, channel):
13361336
return
13371337

13381338
audit_logs = self.modmail_guild.audit_logs(limit=10, action=discord.AuditLogAction.channel_delete)
1339-
entry = await audit_logs.find(lambda a: int(a.target.id) == channel.id)
1339+
found_entry = False
1340+
async for entry in audit_logs:
1341+
if int(entry.target.id) == channel.id:
1342+
found_entry = True
1343+
break
13401344

1341-
if entry is None:
1345+
if not found_entry:
13421346
logger.debug("Cannot find the audit log entry for channel delete of %d.", channel.id)
13431347
return
13441348

0 commit comments

Comments
 (0)