Skip to content

옵챗 유저의 userId는 어떻게 따오면 될까요? #347

Answered by raravel
williameom5678 asked this question in Q&A
Discussion options

You must be logged in to vote

채팅 이벤트를 받았을 땐 다음 함수를 사용해서 전송자 정보를 가져옵니다.

/**
* Get channel user info from channel.
* this is equivalent of calling channel.getUserInfo(data.chat.sender);
*
* @param {TalkChannel} channel
* @return {ChannelUserInfo | undefined}
*/
getSenderInfo(channel: TalkChannel): ChannelUserInfo | undefined {
return channel.getUserInfo(this._chat.sender);
}

사용법:

client.on('chat', (chat: TalkChatData, channel: TalkOpenChannel) => {
    const sender: ChannelUserInfo = chat.getSenderInfo(channel);
});

TalkOpenChannel 클래스에서는 다음 함수를 가지고 유저 정보를 가져올 수 있습니다.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@williameom5678
Comment options

Answer selected by raravel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants