Skip to content

Commit 736863b

Browse files
committed
Redo alias conversion
1 parent cc890c4 commit 736863b

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

bot.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,32 +1013,20 @@ async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context)
10131013
alias = self.auto_triggers[trigger]
10141014

10151015
ctxs = []
1016+
10161017
if alias is not None:
10171018
ctxs = []
10181019
aliases = normalize_alias(alias)
10191020
if not aliases:
10201021
logger.warning("Alias %s is invalid as called in autotrigger.", invoker)
10211022

1022-
for alias in aliases:
1023-
view = StringView(invoked_prefix + alias)
1024-
invoked_with = view.get_word().lower()[1:]
1025-
found_command = self.all_commands.get(invoked_with)
1026-
1027-
# Check for alias
1028-
if not found_command:
1029-
invoked_with = self.aliases.get(invoked_with)[1:-1] # Get command linked to alias
1030-
view = StringView(invoked_prefix + invoked_with) # Create StringView for new command
1031-
invoked_with = view.get_word().lower()[1:] # Parse the new command
1032-
found_command = self.all_commands.get(invoked_with) # Get the command function
1023+
message.author = thread.recipient # Allow for get_contexts to work
10331024

1034-
ctx_ = cls(prefix=self.prefix, view=view, bot=self, message=message)
1035-
ctx_.command = found_command
1036-
1037-
ctx_.invoked_with = invoked_with
1038-
ctx_.thread = thread
1039-
discord.utils.find(view.skip_string, await self.get_prefix())
1025+
for alias in aliases:
1026+
message.content = invoked_prefix + alias
1027+
ctxs += await self.get_contexts(message)
10401028

1041-
ctxs += [ctx_]
1029+
message.author = self.modmail_guild.me # Fix message so commands execute properly
10421030

10431031
for ctx in ctxs:
10441032
if ctx.command:

0 commit comments

Comments
 (0)