Skip to content

Instantly share code, notes, and snippets.

@KangDroid
Created September 13, 2021 08:51
Show Gist options
  • Save KangDroid/2e92a8f9e5ecc91c36690ba45690fe1f to your computer and use it in GitHub Desktop.
Save KangDroid/2e92a8f9e5ecc91c36690ba45690fe1f to your computer and use it in GitHub Desktop.
// 채팅방 정보를 가져오기
var roomId = await database.ChatRoomParticipants
.Where(p => p.ChatbotId == bot.Id || p.UserId == user.Id)
.GroupBy(p => p.RoomId)
.Where(g => g.Count() == 2)
.Select(g => g.Key)
.FirstOrDefaultAsync() ?? await CreateAndGetRoomId(bot, user, database);
// 봇이 참여하고 있는 '채팅방 참여자 정보' 가져오기
var chatroomParticipantId = await database.ChatRoomParticipants
.Where(p => p.RoomId == roomId && p.ChatbotId == bot.Id)
.Select(p => p.Id)
.SingleOrDefaultAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment