Skip to content

Commit 480ad57

Browse files
committed
Merge branch 'development'
2 parents 049508f + baa7e5f commit 480ad57

File tree

7 files changed

+67
-9
lines changed

7 files changed

+67
-9
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
This project mostly adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html);
77
however, insignificant breaking changes do not guarantee a major version bump, see the reasoning [here](https://github.com/kyb3r/modmail/issues/319). If you're a plugin developer, note the "BREAKING" section.
88

9+
# v3.8.5
10+
11+
### Added
12+
13+
- `?msglink <message id>`, allows you to obtain channel + message ID for T&S reports. ([GH #2963](https://github.com/kyb3r/modmail/issues/2963), [PR #2964](https://github.com/kyb3r/modmail/pull/2964))
14+
- `?mention disable/reset`, disables or resets mention on thread creation. ([PR #2951](https://github.com/kyb3r/modmail/pull/2951))
15+
16+
### Fixed
17+
18+
- Non-master/development branch deployments no longer cause errors to be raised.
19+
- Autotriggers now can search for roles/channels in guild context. ([GH #2961](https://github.com/kyb3r/modmail/issues/2961))
20+
921
# v3.8.4
1022

1123
This update is a quick hotfix for a weird behaviour experienced on 1 Feb 2021 where users were not properly cached.

bot.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "3.8.4"
1+
__version__ = "3.8.5"
22

33

44
import asyncio
@@ -939,6 +939,7 @@ async def get_contexts(self, message, *, cls=commands.Context):
939939
async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context):
940940
message.author = self.modmail_guild.me
941941
message.channel = channel
942+
message.guild = channel.guild
942943

943944
view = StringView(message.content)
944945
ctx = cls(prefix=self.prefix, view=view, bot=self, message=message)
@@ -967,7 +968,7 @@ async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context)
967968
ctxs = []
968969
aliases = normalize_alias(alias)
969970
if not aliases:
970-
logger.warning("Alias %s is invalid as called in automove.", invoker)
971+
logger.warning("Alias %s is invalid as called in autotrigger.", invoker)
971972

972973
for alias in aliases:
973974
view = StringView(invoked_prefix + alias)

cogs/modmail.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ async def move(self, ctx, *, arguments):
341341

342342
if self.bot.config["thread_move_notify_mods"]:
343343
mention = self.bot.config["mention"]
344-
await thread.channel.send(f"{mention}, thread has been moved.")
344+
if mention is not None:
345+
msg = f"{mention}, thread has been moved."
346+
else:
347+
msg = "Thread has been moved."
348+
await thread.channel.send(msg)
345349

346350
sent_emoji, _ = await self.bot.retrieve_emoji()
347351
await self.bot.add_reaction(ctx.message, sent_emoji)
@@ -601,6 +605,21 @@ async def sfw(self, ctx):
601605
sent_emoji, _ = await self.bot.retrieve_emoji()
602606
await self.bot.add_reaction(ctx.message, sent_emoji)
603607

608+
@commands.command()
609+
@checks.has_permissions(PermissionLevel.SUPPORTER)
610+
@checks.thread_only()
611+
async def msglink(self, ctx, message_id: int):
612+
"""Retrieves the link to a message in the current thread."""
613+
try:
614+
message = await ctx.thread.recipient.fetch_message(message_id)
615+
except discord.NotFound:
616+
embed = discord.Embed(
617+
color=self.bot.error_color, description="Message not found or no longer exists."
618+
)
619+
else:
620+
embed = discord.Embed(color=self.bot.main_color, description=message.jump_url)
621+
await ctx.send(embed=embed)
622+
604623
@commands.command()
605624
@checks.has_permissions(PermissionLevel.SUPPORTER)
606625
@checks.thread_only()

cogs/utility.py

+23-4
Original file line numberDiff line numberDiff line change
@@ -674,20 +674,40 @@ async def ping(self, ctx):
674674

675675
@commands.command()
676676
@checks.has_permissions(PermissionLevel.ADMINISTRATOR)
677-
async def mention(self, ctx, *mention: Union[discord.Role, discord.Member]):
677+
async def mention(self, ctx, *mention: Union[discord.Role, discord.Member, str]):
678678
"""
679679
Change what the bot mentions at the start of each thread.
680680
681681
Type only `{prefix}mention` to retrieve your current "mention" message.
682+
`{prefix}mention disable` to disable mention.
683+
`{prefix}mention reset` to reset it to default value.
682684
"""
683-
# TODO: ability to disable mention.
684685
current = self.bot.config["mention"]
685-
686686
if not mention:
687687
embed = discord.Embed(
688688
title="Current mention:", color=self.bot.main_color, description=str(current)
689689
)
690+
elif (
691+
len(mention) == 1
692+
and isinstance(mention[0], str)
693+
and mention[0].lower() in ["disable", "reset"]
694+
):
695+
option = mention[0].lower()
696+
if option == "disable":
697+
embed = discord.Embed(
698+
description=f"Disabled mention on thread creation.", color=self.bot.main_color,
699+
)
700+
self.bot.config["mention"] = None
701+
else:
702+
embed = discord.Embed(
703+
description="`mention` is reset to default.", color=self.bot.main_color,
704+
)
705+
self.bot.config.remove("mention")
706+
await self.bot.config.update()
690707
else:
708+
for m in mention:
709+
if not isinstance(m, (discord.Role, discord.Member)):
710+
raise commands.BadArgument(f'Role or Member "{m}" not found.')
691711
mention = " ".join(i.mention for i in mention)
692712
embed = discord.Embed(
693713
title="Changed mention!",
@@ -1778,7 +1798,6 @@ async def autotrigger_edit(self, ctx, keyword, *, command):
17781798
split_cmd = command.split(" ")
17791799
for n in range(1, len(split_cmd) + 1):
17801800
if self.bot.get_command(" ".join(split_cmd[0:n])):
1781-
print(self.bot.get_command(" ".join(split_cmd[0:n])))
17821801
valid = True
17831802
break
17841803

core/changelog.py

+3
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ async def from_url(cls, bot, url: str = "") -> "Changelog":
180180
if not branch or err:
181181
branch = "master" if not bot.version.is_prerelease else "development"
182182

183+
if branch not in ("master", "development"):
184+
branch = "master"
185+
183186
url = url or f"https://raw.githubusercontent.com/kyb3r/modmail/{branch}/CHANGELOG.md"
184187

185188
async with await bot.session.get(url) as resp:

core/config_help.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@
706706
"`{prefix}config set confirm_thread_creation yes`"
707707
],
708708
"notes": [
709-
"See also: `confirm_thread_creation_title`, `confirm_thread_response`, `confirm_thread_creation_accept`, `confirm_thread_creation_deny``"
709+
"See also: `confirm_thread_creation_title`, `confirm_thread_response`, `confirm_thread_creation_accept`, `confirm_thread_creation_deny`"
710710
]
711711
},
712712
"confirm_thread_creation_title": {

core/thread.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,11 @@ def _format_info_embed(self, user, log_url, log_count, color):
300300
# embed.add_field(name='Mention', value=user.mention)
301301
# embed.add_field(name='Registered', value=created + days(created))
302302

303-
footer = "User ID: " + str(user.id)
303+
if user.dm_channel:
304+
footer = f"User ID: {user.id} • DM ID: {user.dm_channel}"
305+
else:
306+
footer = f"User ID: {user.id}"
307+
304308
embed.set_author(name=str(user), icon_url=user.avatar_url, url=log_url)
305309
# embed.set_thumbnail(url=avi)
306310

0 commit comments

Comments
 (0)