feat: add polls

This commit is contained in:
firedotguy
2026-02-12 19:56:57 +03:00
parent c1042d32ae
commit 62730b48e9
4 changed files with 124 additions and 22 deletions

View File

@@ -49,11 +49,11 @@ class UserBanned(Exception):
return 'User banned'
class ValidationError(Exception):
def __init__(self, name: str, value: str):
self.name = name
self.value = value
# def __init__(self, name: str, value: str):
# self.name = name
# self.value = value
def __str__(self):
return f'Failed validation on {self.name}: "{self.value}"'
return 'Failed validation'# on {self.name}: "{self.value}"'
class PendingRequestExists(Exception):
def __str__(self):
@@ -117,4 +117,16 @@ class AlreadyFollowing(Exception):
class AccountBanned(Exception):
def __str__(self) -> str:
return 'Account has been deactivated'
return 'Account has been deactivated'
class OptionsNotBelong(Exception):
def __str__(self) -> str:
return 'One or more options do not belong to poll'
class NotMultipleChoice(Exception):
def __str__(self) -> str:
return 'Only one option can be choosen in this poll'
class EmptyOptions(Exception):
def __str__(self) -> str:
return 'Options cannot be empty (pre-validation)'