mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 18:15:28 +03:00
v0.3.8
This commit is contained in:
@@ -8,7 +8,8 @@ from ..router.exceptions import (RepeatedCommandException,
|
||||
RepeatedFlagNameException,
|
||||
TooManyTransferredArgsException,
|
||||
RequiredArgumentNotPassedException,
|
||||
IncorrectNumberOfHandlerArgsException)
|
||||
IncorrectNumberOfHandlerArgsException,
|
||||
TriggerCannotContainSpacesException)
|
||||
|
||||
|
||||
class Router:
|
||||
@@ -71,6 +72,8 @@ class Router:
|
||||
|
||||
def _validate_command(self, command: Command):
|
||||
command_name: str = command.get_trigger()
|
||||
if command_name.find(' ') != -1:
|
||||
raise TriggerCannotContainSpacesException()
|
||||
if command_name in self.get_all_commands():
|
||||
raise RepeatedCommandException()
|
||||
if self._ignore_command_register:
|
||||
|
||||
@@ -21,3 +21,8 @@ class RequiredArgumentNotPassedException(Exception):
|
||||
class IncorrectNumberOfHandlerArgsException(Exception):
|
||||
def __str__(self):
|
||||
return "Handler has incorrect number of arguments"
|
||||
|
||||
|
||||
class TriggerCannotContainSpacesException(Exception):
|
||||
def __str__(self):
|
||||
return "Command trigger cannot contain spaces"
|
||||
|
||||
Reference in New Issue
Block a user