Skip to content

Commit

Permalink
Fix bug where autotriggers are in dm context, resolve #2961
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Mar 7, 2021
1 parent 3c42c22 commit baa7e5f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
### Fixed

- Non-master/development branch deployments no longer cause errors to be raised.
- Autotriggers now can search for roles/channels in guild context. ([GH #2961](https://github.com/kyb3r/modmail/issues/2961))

# v3.8.4

Expand Down
3 changes: 2 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ async def get_contexts(self, message, *, cls=commands.Context):
async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context):
message.author = self.modmail_guild.me
message.channel = channel
message.guild = channel.guild

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

for alias in aliases:
view = StringView(invoked_prefix + alias)
Expand Down
4 changes: 1 addition & 3 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,7 @@ async def msglink(self, ctx, message_id: int):
color=self.bot.error_color, description="Message not found or no longer exists."
)
else:
embed = discord.Embed(
color=self.bot.main_color, description=message.jump_url
)
embed = discord.Embed(color=self.bot.main_color, description=message.jump_url)
await ctx.send(embed=embed)

@commands.command()
Expand Down
1 change: 0 additions & 1 deletion cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,6 @@ async def autotrigger_edit(self, ctx, keyword, *, command):
split_cmd = command.split(" ")
for n in range(1, len(split_cmd) + 1):
if self.bot.get_command(" ".join(split_cmd[0:n])):
print(self.bot.get_command(" ".join(split_cmd[0:n])))
valid = True
break

Expand Down

0 comments on commit baa7e5f

Please sign in to comment.