Skip to content

Commit cdea8ed

Browse files
committed
The bot will tell you when a user is no longer in server when replying to a thread.
1 parent f97b76d commit cdea8ed

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
# v2.0.6
8+
9+
### Fixed
10+
- Fix logs sending duplicated thread close logs.
11+
- The bot will now tell you that a user is no longer in the server when you try to reply to a thread.
12+
- Before this, it looked like you replied to the thread but in reality the message didnt get sent.
13+
714
# v2.0.5
815

916
### Changed

bot.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ async def on_ready(self):
167167
{line}
168168
""").strip())
169169

170-
await self.threads.populate_cache()
170+
if not self.guild:
171+
print(Fore.RED + Style.BRIGHT + 'WARNING - The GUILD_ID provided does not exist!' + Style.RESET_ALL)
172+
else:
173+
await self.threads.populate_cache()
171174

172175
async def process_modmail(self, message):
173176
"""Processes messages sent to the bot."""
@@ -257,6 +260,8 @@ async def on_guild_channel_delete(self, channel):
257260
audit_logs = self.modmail_guild.audit_logs()
258261
entry = await audit_logs.find(lambda e: e.target.id == channel.id)
259262
mod = entry.user
263+
if mod.bot:
264+
return
260265

261266
log_data = await self.modmail_api.post_log(channel.id, {
262267
'open': False,

core/thread.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def edit_message(self, message_id, message):
6666
async def reply(self, message):
6767
if not message.content and not message.attachments:
6868
raise commands.UserInputError
69-
if not self.recipient:
70-
return await message.channel.send('This user does not share any servers with the bot and is thus unreachable.')
69+
if self.recipient not in self.bot.guild.members:
70+
return await message.channel.send('This user is no longer in the server and is thus unreachable.')
7171
await asyncio.gather(
7272
self.send(message, self.channel, from_mod=True), # in thread channel
7373
self.send(message, self.recipient, from_mod=True) # to user

0 commit comments

Comments
 (0)