self.db.recursive_set_and_report_change(update)
if not update.results:
return False
- for t in update.results:
- scope, value = t
- log_path = ':'.join(update.full_path)
+ for scope, result in update.results:
log_kwargs: dict[str, Any] = {'scope': scope}
if scope in {LogScope.CHAT, LogScope.USER}:
log_kwargs |= {'target': update.full_path[1]}
- if value is None:
- self.log(f'{log_path} cleared', **log_kwargs)
- elif isinstance(value, Topic):
- self.log(f'{value.who} set topic: {value.what}', **log_kwargs)
- elif isinstance(value, list):
+ if isinstance(result, Topic):
+ self.log(f'{result.who} set topic: {result.what}',
+ **log_kwargs)
+ elif isinstance(result, list):
msg = ''
- for item in value:
+ for item in result:
transform, content = item.split(':', maxsplit=1)
if transform in {'NICK', 'NUH'}:
nuh = self.db.users[content]
msg += content
self.log(msg, **log_kwargs)
else:
- announcement = f'{log_path} set to:'
- if isinstance(value, tuple):
- self.log(announcement, **log_kwargs)
- for item in value:
- self.log(f' {item}', **log_kwargs)
+ log_path = ':'.join(update.full_path)
+ if result is None:
+ self.log(f'{log_path} cleared', **log_kwargs)
else:
- self.log(f'{announcement} [{value}]', **log_kwargs)
+ announcement = f'{log_path} set to:'
+ if isinstance(result, tuple):
+ self.log(announcement, **log_kwargs)
+ for item in result:
+ self.log(f' {item}', **log_kwargs)
+ else:
+ self.log(f'{announcement} [{result}]', **log_kwargs)
for win in [w for w in self.windows if isinstance(w, _ChatWindow)]:
win.set_prompt_prefix()
return bool([w for w in self.windows if w.tainted])