diff --git a/disco/bot/parser.py b/disco/bot/parser.py index 16ee3f2..722abe6 100644 --- a/disco/bot/parser.py +++ b/disco/bot/parser.py @@ -2,7 +2,6 @@ import re import six import copy - # Regex which splits out argument parts PARTS_RE = re.compile('(\<|\[|\{)((?:\w+|\:|\||\.\.\.| (?:[0-9]+))+)(?:\>|\]|\})') @@ -16,6 +15,12 @@ TYPE_MAP = { 'snowflake': lambda ctx, data: int(data), } +try: + import dateparser + TYPE_MAP['duration'] = lambda ctx, data: dateparser.parse(data, settings={'TIMEZONE': 'UTC'}) +except ImportError: + pass + def to_bool(ctx, data): if data in BOOL_OPTS: diff --git a/disco/types/guild.py b/disco/types/guild.py index b478cd9..f93a88f 100644 --- a/disco/types/guild.py +++ b/disco/types/guild.py @@ -207,7 +207,7 @@ class GuildMember(SlottedModel): self.client.api.guilds_members_roles_add(self.guild.id, self.user.id, to_snowflake(role)) def remove_role(self, role): - self.clients.api.guilds_members_roles_remove(self.guild.id, self.user.id, to_snowflake(role)) + self.client.api.guilds_members_roles_remove(self.guild.id, self.user.id, to_snowflake(role)) @cached_property def owner(self):