Skip to content

Commit baa7e5f

Browse files
committed
Fix bug where autotriggers are in dm context, resolve #2961
1 parent 3c42c22 commit baa7e5f

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
1616
### Fixed
1717

1818
- 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))
1920

2021
# v3.8.4
2122

bot.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -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

+1-3
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,7 @@ async def msglink(self, ctx, message_id: int):
617617
color=self.bot.error_color, description="Message not found or no longer exists."
618618
)
619619
else:
620-
embed = discord.Embed(
621-
color=self.bot.main_color, description=message.jump_url
622-
)
620+
embed = discord.Embed(color=self.bot.main_color, description=message.jump_url)
623621
await ctx.send(embed=embed)
624622

625623
@commands.command()

cogs/utility.py

-1
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,6 @@ async def autotrigger_edit(self, ctx, keyword, *, command):
17981798
split_cmd = command.split(" ")
17991799
for n in range(1, len(split_cmd) + 1):
18001800
if self.bot.get_command(" ".join(split_cmd[0:n])):
1801-
print(self.bot.get_command(" ".join(split_cmd[0:n])))
18021801
valid = True
18031802
break
18041803

0 commit comments

Comments
 (0)