[commands] Restart the StringView properly in Context.reinvoke.
The old code for some reason assumed that the length of the command would be 1. This is because when I tested this I would use single letter command names and it would "just work" when in reality it was completely incorrect. A reminder to thoroughly test instead of just fitting something to work
This commit is contained in:
parent
bcaee518a1
commit
bd4505fec5
@ -152,6 +152,7 @@ class Context(discord.abc.Messageable):
|
|||||||
restart: bool
|
restart: bool
|
||||||
Whether to start the call chain from the very beginning
|
Whether to start the call chain from the very beginning
|
||||||
or where we left off (i.e. the command that caused the error).
|
or where we left off (i.e. the command that caused the error).
|
||||||
|
The default is to start where we left off.
|
||||||
"""
|
"""
|
||||||
cmd = self.command
|
cmd = self.command
|
||||||
view = self.view
|
view = self.view
|
||||||
@ -166,8 +167,9 @@ class Context(discord.abc.Messageable):
|
|||||||
|
|
||||||
if restart:
|
if restart:
|
||||||
to_call = cmd.root_parent or cmd
|
to_call = cmd.root_parent or cmd
|
||||||
view.index = len(self.prefix) + 1
|
view.index = len(self.prefix)
|
||||||
view.previous = 0
|
view.previous = 0
|
||||||
|
view.get_word() # advance to get the root command
|
||||||
else:
|
else:
|
||||||
to_call = cmd
|
to_call = cmd
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user