@@ -1010,6 +1010,7 @@ async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context)
10101010 if trigger :
10111011 invoker = trigger .lower ()
10121012
1013+ print ("looking for auto trigger" , trigger , self .auto_triggers [trigger ])
10131014 alias = self .auto_triggers [trigger ]
10141015
10151016 ctxs = []
@@ -1019,24 +1020,45 @@ async def trigger_auto_triggers(self, message, channel, *, cls=commands.Context)
10191020 if not aliases :
10201021 logger .warning ("Alias %s is invalid as called in autotrigger." , invoker )
10211022
1023+ print ("Aliases" , aliases )
1024+
10221025 for alias in aliases :
10231026 view = StringView (invoked_prefix + alias )
1027+ invoked_with = view .get_word ().lower ()
1028+ invoked_with = invoked_with [1 :]
1029+ print ("Looking for" , invoked_with )
1030+ found_command = self .all_commands .get (invoked_with )
1031+
1032+ # Check for alias
1033+ if not found_command :
1034+ print ("INVOKED WITH" , invoked_with )
1035+ command_alias = self .aliases .get (invoked_with )[1 :- 1 ]
1036+ view = StringView (invoked_prefix + command_alias )
1037+ split_cmd = command_alias .split (" " )
1038+ found_command = self .all_commands .get (split_cmd [0 ])
1039+
10241040 ctx_ = cls (prefix = self .prefix , view = view , bot = self , message = message )
1041+ ctx_ .command = found_command
1042+ ctx_ .invoked_with = invoked_with
10251043 ctx_ .thread = thread
10261044 discord .utils .find (view .skip_string , await self .get_prefix ())
1027- ctx_ . invoked_with = view . get_word (). lower ()
1028- ctx_ . command = self . all_commands . get ( ctx_ .invoked_with )
1045+
1046+ print ( "Command info:" , view , ctx_ , ctx_ . thread , ctx_ .invoked_with , ctx_ . command )
10291047 ctxs += [ctx_ ]
10301048
10311049 for ctx in ctxs :
10321050 if ctx .command :
1051+ print ("Found command" )
10331052 old_checks = copy .copy (ctx .command .checks )
1053+ print ("Old checks set" )
10341054 ctx .command .checks = [checks .has_permissions (PermissionLevel .INVALID )]
1035-
1055+ print ( "Command checks added, invoking..." , ctx )
10361056 await self .invoke (ctx )
10371057
10381058 ctx .command .checks = old_checks
10391059 continue
1060+ else :
1061+ print ("unable to find command" )
10401062
10411063 async def get_context (self , message , * , cls = commands .Context ):
10421064 """
0 commit comments