mirror of
https://github.com/owncast/owncast.git
synced 2024-11-29 11:39:08 +03:00
18 lines
666 B
TypeScript
18 lines
666 B
TypeScript
import { ConnectedClientInfoEvent } from '../../../interfaces/socket-events';
|
|
|
|
export default function handleConnectedClientInfoMessage(
|
|
message: ConnectedClientInfoEvent,
|
|
setChatDisplayName: (string) => void,
|
|
setChatDisplayColor: (number) => void,
|
|
setChatUserId: (number) => void,
|
|
setIsChatModerator: (boolean) => void,
|
|
setChatAuthenticated: (boolean) => void,
|
|
) {
|
|
const { user } = message;
|
|
const { id, displayName, displayColor, scopes, authenticated } = user;
|
|
setChatDisplayName(displayName);
|
|
setChatDisplayColor(displayColor);
|
|
setChatUserId(id);
|
|
setIsChatModerator(scopes?.includes('MODERATOR'));
|
|
setChatAuthenticated(authenticated);
|
|
}
|