Skip to content

Commit 61d4dc1

Browse files
committed
Merge from "master"
2 parents 7ecc34e + 6ee9479 commit 61d4dc1

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ Heroku is a container based cloud platform that currently offers a free plan to
5757
There is a range of config variables you can dynamically change with the `config` command to change the appearance of the bot. For example embed color, responses, reactions, status etc. Snippets and custom command aliases are also supported, snippets are shortcuts for predefined messages that you can send. Add and remove snippets with the `snippets` command. The list of things you can change is ever growing thanks to the community for code contributions.
5858

5959
### Linked Messages
60-
<img src='https://i.imgur.com/eo3CwLm.png' height=300 align='right'></img>
60+
<img src='https://i.imgur.com/6L9aaNw.png' height=300 align='right'></img>
6161

6262
Did you accidentally send something you didn't mean to with the `reply` command? Don't fret, if you delete the original message on your side, this bot automatically deletes the corresponding message that was sent to the recipient of the thread! This also works when you use the `edit` command to edit a message you have sent.
6363

6464
### Thread Logs
6565

66-
Thread conversations are automatically logged and a log link is provided with each thread. Logs are rendered with HTML and are presented in an aesthetically pleasing way, exactly like on discord, this especially integrates seamlessly with the mobile version of discord.
66+
Thread conversations are automatically logged and a log link is provided with each thread. Logs are rendered with HTML and are presented in an aesthetically pleasing way, exactly like on discord, this especially integrates seamlessly with the mobile version of discord. Heres a link to an [example](https://logs.modmail.tk/02032d65a6f3).
6767

6868
### Automatic Updates
6969
The bot checks for new updates every hour and automatically updates to a newer version if found. This bot is under active development so you can always look forward to new, useful features! If you do not want this functionality, for example, if you want to make changes to your fork, you can do so by adding a `disable_autoupdates` config variable.

cogs/modmail.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ async def nsfw(self, ctx):
347347

348348
@commands.command()
349349
async def loglink(self, ctx):
350+
"""Return the link to the current thread's logs."""
350351
thread = await self.bot.threads.find(channel=ctx.channel)
351352
if thread:
352353
log_link = await self.bot.api.get_log_link(ctx.channel.id)
@@ -446,6 +447,14 @@ async def reply(self, ctx, *, msg=''):
446447

447448
@commands.command()
448449
async def anonreply(self, ctx, *, msg=''):
450+
"""Reply to a thread anonymously.
451+
452+
You can edit the anonymous user's name,
453+
avatar and tag using the config command.
454+
455+
Edit the `anon_username`, `anon_avatar_url`
456+
and `anon_tag` config variables to do so.
457+
"""
449458
ctx.message.content = msg
450459
thread = await self.bot.threads.find(channel=ctx.channel)
451460
if thread:

core/thread.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def ready(self):
7070
def ready(self, flag):
7171
if flag:
7272
self._ready_event.set()
73+
else:
74+
self._ready_event.clear()
7375

7476
def _close_after(self, closer, silent, delete_channel, message):
7577
return self.bot.loop.create_task(
@@ -335,6 +337,7 @@ async def send(self, message, destination=None,
335337

336338
prioritize_uploads = any(i[1] is not None for i in images)
337339

340+
additional_images = []
338341
additional_count = 1
339342

340343
for att in images: # TODO: Logic needs review
@@ -346,12 +349,20 @@ async def send(self, message, destination=None,
346349
embed.set_image(url=att[0])
347350
embedded_image = True
348351
elif att[1] is not None:
349-
link = f'[{att[1]}]({att[0]})'
350-
embed.add_field(
351-
name=f'Additional Image upload ({additional_count})',
352-
value=link,
353-
inline=False
352+
if note:
353+
color = discord.Color.blurple()
354+
elif from_mod:
355+
color = self.bot.mod_color
356+
else:
357+
color = self.bot.recipient_color
358+
359+
img_embed = discord.Embed(color=color)
360+
img_embed.set_image(url=att[0])
361+
img_embed.set_footer(
362+
text=f'Additional Image Upload ({additional_count})'
354363
)
364+
img_embed.timestamp = message.created_at
365+
additional_images.append(destination.send(embed=img_embed))
355366
additional_count += 1
356367

357368
file_upload_count = 1
@@ -393,6 +404,11 @@ async def send(self, message, destination=None,
393404

394405
await destination.send(mentions, embed=embed)
395406

407+
if additional_images:
408+
self.ready = False
409+
await asyncio.gather(*additional_images)
410+
self.ready = True
411+
396412
if delete_message:
397413
try:
398414
await message.delete()

0 commit comments

Comments
 (0)