|
|
@ -63,10 +63,11 @@ from ..common import NotifyType
|
|
|
|
from ..utils import parse_list
|
|
|
|
from ..utils import parse_list
|
|
|
|
from ..utils import validate_regex
|
|
|
|
from ..utils import validate_regex
|
|
|
|
from ..utils import is_email
|
|
|
|
from ..utils import is_email
|
|
|
|
|
|
|
|
from ..utils import remove_suffix
|
|
|
|
from ..AppriseLocale import gettext_lazy as _
|
|
|
|
from ..AppriseLocale import gettext_lazy as _
|
|
|
|
|
|
|
|
|
|
|
|
# A Valid Bot Name
|
|
|
|
# A Valid Bot Name
|
|
|
|
VALIDATE_BOTNAME = re.compile(r'(?P<name>[A-Z0-9_]{1,32})(-bot)?', re.I)
|
|
|
|
VALIDATE_BOTNAME = re.compile(r'(?P<name>[A-Z0-9_-]{1,32})', re.I)
|
|
|
|
|
|
|
|
|
|
|
|
# Organization required as part of the API request
|
|
|
|
# Organization required as part of the API request
|
|
|
|
VALIDATE_ORG = re.compile(
|
|
|
|
VALIDATE_ORG = re.compile(
|
|
|
@ -122,7 +123,7 @@ class NotifyZulip(NotifyBase):
|
|
|
|
'botname': {
|
|
|
|
'botname': {
|
|
|
|
'name': _('Bot Name'),
|
|
|
|
'name': _('Bot Name'),
|
|
|
|
'type': 'string',
|
|
|
|
'type': 'string',
|
|
|
|
'regex': (r'^[A-Z0-9_]{1,32}(-bot)?$', 'i'),
|
|
|
|
'regex': (r'^[A-Z0-9_-]{1,32}$', 'i'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'organization': {
|
|
|
|
'organization': {
|
|
|
|
'name': _('Organization'),
|
|
|
|
'name': _('Organization'),
|
|
|
@ -183,7 +184,9 @@ class NotifyZulip(NotifyBase):
|
|
|
|
raise TypeError
|
|
|
|
raise TypeError
|
|
|
|
|
|
|
|
|
|
|
|
# The botname
|
|
|
|
# The botname
|
|
|
|
self.botname = match.group('name')
|
|
|
|
botname = match.group('name')
|
|
|
|
|
|
|
|
botname = remove_suffix(botname, '-bot')
|
|
|
|
|
|
|
|
self.botname = botname
|
|
|
|
|
|
|
|
|
|
|
|
except (TypeError, AttributeError):
|
|
|
|
except (TypeError, AttributeError):
|
|
|
|
msg = 'The Zulip botname specified ({}) is invalid.'\
|
|
|
|
msg = 'The Zulip botname specified ({}) is invalid.'\
|
|
|
|