This commit is contained in:
Timothy Jaeryang Baek 2026-10-13 22:04:15 +04:00
parent 4f9f04ceee
commit 3f6c3e31a0
2 changed files with 11 additions and 3 deletions

View file

@ -113,14 +113,19 @@ class MessageUserResponse(MessageModel):
class MessageUserSlimResponse(MessageUserResponse):
data: bool | None = None
data: dict | bool | None = None
@field_validator('data', mode='before')
def convert_data_to_bool(cls, v):
def summarize_data(cls, v):
# No data or not a dict → False
if not isinstance(v, dict):
return False
# Reply previews need card text, but not actions or other message data.
app = v.get('app')
if isinstance(app, dict) and app.get('embeds'):
return {'app': {'embeds': app['embeds']}}
# True if ANY value in the dict is non-empty
return any(bool(val) for val in v.values())

View file

@ -107,7 +107,10 @@
browser &&
idType === 'U' &&
requestedUserId !== id &&
(!token?.label || token.label === id || /^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(token.label))
(!token?.label ||
token.label === _id ||
token.label === id ||
/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(token.label))
) {
requestedUserId = id;
resolvedUser = null;