aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-10 02:56:24 -0500
committerRapptz <[email protected]>2016-01-10 02:56:24 -0500
commit50c83b5a3ce322e75f4fc8d248403f8bec0c8b0d (patch)
tree161d0e7ed18db5a04424d4b7a55e37ab87dec85d
parent[commands] Proper cleanup of cogs. (diff)
downloaddiscord.py-50c83b5a3ce322e75f4fc8d248403f8bec0c8b0d.tar.xz
discord.py-50c83b5a3ce322e75f4fc8d248403f8bec0c8b0d.zip
[commands] Strip arguments before searching for special cases.
-rw-r--r--discord/ext/commands/core.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 14dfd46d..c00e08f0 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -121,6 +121,7 @@ class Command:
discord.utils.create_task(injected(error, ctx), loop=ctx.bot.loop)
def _receive_item(self, message, argument, regex, receiver, generator):
+ argument = argument.strip()
match = re.match(regex, argument)
result = None
private = message.channel.is_private
@@ -165,15 +166,15 @@ class Command:
if message.channel.is_private:
raise NoPrivateMessage()
- role = discord.utils.get(message.server.roles, name=argument)
+ role = discord.utils.get(message.server.roles, name=argument.strip())
if role is None:
raise BadArgument('Role not found')
return role
elif converter is discord.Game:
- return discord.Game(name=argument)
+ return discord.Game(name=argument.strip())
elif converter is discord.Invite:
try:
- return bot.get_invite(argument)
+ return bot.get_invite(argument.strip())
except:
raise BadArgument('Invite is invalid')