Skip to Content
Nazu

MessageChat

메세지. message 이벤트 리스너의 chat 인자나 메세지 조회 메서드로 받습니다.

사진, 동영상 같은 종류는 하위 클래스로 받고 isPhoto() 같은 메서드로 좁힙니다. 답장은 chat instanceof ReplyChat으로 확인합니다.

확장

에 의해 확장됨

속성

속성수정자타입설명상속받은 타입:
attachmentreadonlyAttachment첨부 데이터. 첨부가 없으면 빈 객체-
idreadonlystring메세지 로그 ID-
originTypereadonlynumbertype에서 삭제 표시(0x4000)를 뺀 메세지 타입 번호 1 일반, 2 사진, 3 동영상, 5 음성, 12·20·25 이모티콘, 17 프로필, 18 파일, 26 답장, 27 여러 장의 사진, 100 지도. 카카오맵 공유가 아닌 100과 모르는 번호는 MessageChat으로 받습니다.-
rawreadonlyMessageChatRaw메세지 원본 데이터-
textreadonlystring메세지 내용-
threadIdreadonlystring | null스레드 ID. 스레드에 속하지 않으면 null-
typereadonlynumber받은 메세지 타입 번호. 삭제된 메세지는 삭제 표시(0x4000)가 더해져 있습니다.-
userreadonlyUser | null메세지를 보냈거나 피드와 관련된 유저. 정보가 없으면 nullUnknownFeedChat.user

접근자

command

get 시그니쳐

get command(): string;

text에서 첫 번째 띄어쓰기 앞부분. 띄어쓰기가 없으면 메세지 전체

반환값

string

mentions

get 시그니쳐

get mentions(): Promise<User[]>;

중복 없이 모은 멘션 유저 목록. 멘션이 없으면 빈 배열

반환값

Promise<User[]>

param

get 시그니쳐

get param(): string;

text에서 첫 번째 띄어쓰기 뒤의 나머지. 띄어쓰기가 없으면 빈 문자열

반환값

string

readMembers

get 시그니쳐

get readMembers(): Promise<User[]>;

이 메세지를 읽은 유저 목록

반환값

Promise<User[]>

unreadMembers

get 시그니쳐

get unreadMembers(): Promise<User[]>;

이 메세지를 읽지 않은 유저 목록

반환값

Promise<User[]>

메서드

getAttachment()

getAttachment<T>(): Partial<T>;

첨부 데이터를 원하는 타입으로 가져옵니다. 데이터가 그 타입과 맞는지는 확인하지 않습니다.

타입 매개변수

타입 매개변수기본 타입
T extends AttachmentAttachment

반환값

Partial<T>

getNextChat()

getNextChat(count?): Promise<MessageChat | null>;

이 메세지보다 뒤의 메세지를 조회합니다. 없으면 null

매개변수

매개변수타입기본값설명
count?number1뒤로 갈 개수. 소수점 아래는 버리고, 0이면 이 메세지를, 음수면 앞쪽 메세지를 돌려줍니다.

반환값

Promise<MessageChat | null>

getPrevChat()

getPrevChat(count?): Promise<MessageChat | null>;

이 메세지보다 앞의 메세지를 조회합니다. 없으면 null

매개변수

매개변수타입기본값설명
count?number1앞으로 갈 개수. 소수점 아래는 버리고, 0이면 이 메세지를, 음수면 뒤쪽 메세지를 돌려줍니다.

반환값

Promise<MessageChat | null>

getSource()

getSource(): Promise<MessageChat>;

답장이나 스레드의 원본 메세지를 조회합니다. 답장은 첨부 데이터의 src_logId를, 그 밖에는 threadId를 씁니다.

반환값

Promise<MessageChat>

Throws

원본 메세지 ID가 없을 때

isAudio()

isAudio(): this is AudioChat;

음성 여부

반환값

this is AudioChat

isEmoticon()

isEmoticon(): this is EmoticonChat;

이모티콘 여부

반환값

this is EmoticonChat

isFeedChat()

isFeedChat(): this is FeedChat;

피드 여부

반환값

this is FeedChat

상속받은 타입:

Chat.isFeedChat

isFile()

isFile(): this is FileChat;

파일 여부

반환값

this is FileChat

isMap()

isMap(): this is MapChat;

지도 여부

반환값

this is MapChat

isMessageChat()

isMessageChat(): this is MessageChat;

메세지 여부

반환값

this is MessageChat

오버라이드 대상:

Chat.isMessageChat

isMiniEmoticon()

isMiniEmoticon(): this is MiniEmoticonChat;

미니 이모티콘이 들어 있는 메세지 여부

반환값

this is MiniEmoticonChat

isMultiPhoto()

isMultiPhoto(): this is MultiPhotoChat;

여러 장의 사진 여부

반환값

this is MultiPhotoChat

isNormal()

isNormal(): this is NormalChat;

일반 메세지 여부

반환값

this is NormalChat

isPhoto()

isPhoto(): this is PhotoChat;

사진 여부

반환값

this is PhotoChat

isProfile()

isProfile(): this is ProfileChat;

프로필 공유 여부

반환값

this is ProfileChat

isReply()

isReply(): boolean;

답장이거나 스레드에 속한 메세지 여부. 타입을 좁히지 않으므로 ReplyChat인지는 chat instanceof ReplyChat으로 확인하세요.

반환값

boolean

isVideo()

isVideo(): this is VideoChat;

동영상 여부

반환값

this is VideoChat

On this page