提交 26c57e68 编写于 作者: L lijiarui 提交者: Huan (李卓桓)

291 (#318)

* #291 change throw error to return null

* add jsDoc

* fix room null error
上级 92800c28
......@@ -30,6 +30,7 @@ export async function onFriend(contact: Contact, request?: FriendRequest): Promi
if (request.hello === 'ding') {
const myRoom = await Room.find({ topic: 'ding' })
if (!myRoom) return
setTimeout(function() {
myRoom.add(contact)
myRoom.say('welcome ' + contact.name())
......
......@@ -36,6 +36,7 @@ export async function onMessage(message: Message): Promise<void> {
message.say('thanks for ding me')
const myRoom = await Room.find({ topic: 'ding' })
if (!myRoom) return
if (myRoom.has(sender)) {
sender.say('no need to ding again, because you are already in ding room')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册