diff options
Diffstat (limited to 'discord/utils.py')
| -rw-r--r-- | discord/utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/discord/utils.py b/discord/utils.py index 118b4691..9c4bd43a 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -451,6 +451,17 @@ def resolve_invite(invite): return m.group(1) return invite +def resolve_template(code): + from .template import Template # circular import + if isinstance(code, (Template, Object)): + return template.id + else: + rx = r'(?:https?\:\/\/)?discord(?:\.new|(?:app)?\.com\/template)\/(.+)' + m = re.match(rx, code) + if m: + return m.group(1) + return code + _MARKDOWN_ESCAPE_SUBREGEX = '|'.join(r'\{0}(?=([\s\S]*((?<!\{0})\{0})))'.format(c) for c in ('*', '`', '_', '~', '|')) |