feat(eventsub): implement suspicious user message (#6007)

This commit is contained in:
nerix
2025-03-01 13:48:01 +01:00
committed by GitHub
parent c5d4a3a69b
commit bced3c658d
22 changed files with 872 additions and 62 deletions
@@ -25,6 +25,8 @@ class CommentCommands:
inner_root: str = ""
default: Optional[str] = None
def __init__(self, parent: Optional["CommentCommands"] = None) -> None:
if parent is not None:
self.name_transform = parent.name_transform
@@ -59,6 +61,8 @@ class CommentCommands:
pass
case "json_tag":
self.tag = value
case "default":
self.default = value
case other:
log.warning(f"Unknown comment command found: {other} with value {value}")
+3 -1
View File
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import List
from typing import List, Optional
import logging
@@ -20,6 +20,7 @@ class Enum:
self.comment_commands = CommentCommands()
self.inner_root: str = ""
self.namespace = namespace
self.default: Optional[str] = None
@property
def full_name(self) -> str:
@@ -48,3 +49,4 @@ class Enum:
def apply_comment_commands(self, comment_commands: CommentCommands) -> None:
self.inner_root = comment_commands.inner_root
self.default = comment_commands.default
@@ -15,5 +15,9 @@ boost::json::result_for<{{enum.full_name}}, boost::json::value>::type tag_invoke
}
{%- endfor %}
{%- if enum.default -%}
return {{enum.full_name}}::{{enum.default}};
{%- else -%}
EVENTSUB_BAIL_HERE(error::Kind::UnknownEnumValue);
{%- endif -%}
}