Skip to content

Commit

Permalink
The bot will tell you when a user is no longer in server when replyin…
Browse files Browse the repository at this point in the history
…g to a thread.
  • Loading branch information
kyb3r committed Jan 6, 2019
1 parent f97b76d commit cdea8ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# v2.0.6

### Fixed
- Fix logs sending duplicated thread close logs.
- The bot will now tell you that a user is no longer in the server when you try to reply to a thread.
- Before this, it looked like you replied to the thread but in reality the message didnt get sent.

# v2.0.5

### Changed
Expand Down
7 changes: 6 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ async def on_ready(self):
{line}
""").strip())

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

async def process_modmail(self, message):
"""Processes messages sent to the bot."""
Expand Down Expand Up @@ -257,6 +260,8 @@ async def on_guild_channel_delete(self, channel):
audit_logs = self.modmail_guild.audit_logs()
entry = await audit_logs.find(lambda e: e.target.id == channel.id)
mod = entry.user
if mod.bot:
return

log_data = await self.modmail_api.post_log(channel.id, {
'open': False,
Expand Down
4 changes: 2 additions & 2 deletions core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def edit_message(self, message_id, message):
async def reply(self, message):
if not message.content and not message.attachments:
raise commands.UserInputError
if not self.recipient:
return await message.channel.send('This user does not share any servers with the bot and is thus unreachable.')
if self.recipient not in self.bot.guild.members:
return await message.channel.send('This user is no longer in the server and is thus unreachable.')
await asyncio.gather(
self.send(message, self.channel, from_mod=True), # in thread channel
self.send(message, self.recipient, from_mod=True) # to user
Expand Down

0 comments on commit cdea8ed

Please sign in to comment.