diff options
| author | 2021-12-06 21:20:27 +0400 | |
|---|---|---|
| committer | 2021-12-06 21:20:27 +0400 | |
| commit | cfe4d495f7e9581fe58576cdf5e5dd9a490e52ed (patch) | |
| tree | a3919899b8adbbed5822d40e2ab7dacfa084ab9c /botcore | |
| parent | Merge pull request #1 from python-discord/mbaruh/setup (diff) | |
| parent | Move Doc Dependencies Into Dev Section (diff) | |
Merge pull request #2 from python-discord/docs-buildv1.1.0
Documentation
Diffstat (limited to 'botcore')
| -rw-r--r-- | botcore/__init__.py | 9 | ||||
| -rw-r--r-- | botcore/regex.py | 21 | 
2 files changed, 30 insertions, 0 deletions
diff --git a/botcore/__init__.py b/botcore/__init__.py index e69de29b..c582d0df 100644 --- a/botcore/__init__.py +++ b/botcore/__init__.py @@ -0,0 +1,9 @@ +from botcore import ( +    regex, +) + +__all__ = [ +    regex, +] + +__all__ = list(map(lambda module: module.__name__, __all__)) diff --git a/botcore/regex.py b/botcore/regex.py new file mode 100644 index 00000000..cb1832d3 --- /dev/null +++ b/botcore/regex.py @@ -0,0 +1,21 @@ +"""Common regular expressions.""" + +import re + +DISCORD_INVITE = re.compile( +    r"(discord([.,]|dot)gg|"                     # Could be discord.gg/ +    r"discord([.,]|dot)com(/|slash)invite|"      # or discord.com/invite/ +    r"discordapp([.,]|dot)com(/|slash)invite|"   # or discordapp.com/invite/ +    r"discord([.,]|dot)me|"                      # or discord.me +    r"discord([.,]|dot)li|"                      # or discord.li +    r"discord([.,]|dot)io|"                      # or discord.io. +    r"((?<!\w)([.,]|dot))gg"                     # or .gg/ +    r")([/]|slash)"                              # / or 'slash' +    r"(?P<invite>[a-zA-Z0-9\-]+)",               # the invite code itself +    flags=re.IGNORECASE +) +""" +Regex for discord server invites. + +:meta hide-value: +"""  |