-
Notifications
You must be signed in to change notification settings - Fork 26
Exceptions
sharkbound edited this page Sep 3, 2022
·
10 revisions
Used to trigger an automatic error message showing the reason for the error (passed as reason=
in InvalidArgumentsError(reason='<message to chat here>')
)
example:
from twitchbot import Command, Message, InvalidArgumentsError
@Command(name='error')
async def cmd_test(msg: Message):
raise InvalidArgumentsError(reason='<message to chat here>',
cmd=cmd_test) # cmd= is not required, but is used to signal which command raised the error
The above code will print this error message in twitch chat:
<message to chat here> - syntax: "" - do "?help error" for more details