提交 d75e5d24 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

better bot

上级 87f544f1
......@@ -108,25 +108,39 @@ bot
roomList.map(async room => await room.topic()),
)
let n = 0
await msg.say(
topicList
.map(topic => ++n + '. ' + topic)
.join('\n'),
)
const totalNum = roomList.length
let n = 0
const replyText = [
`Total room number: ${totalNum}`,
...topicList
.slice(0, 17)
.map(topic => ++n + '. ' + topic),
].join('\n')
await msg.say(replyText)
return
}
// Contact.findAll()
if (/^testContact$/i.test(text)) {
const contactList = await bot.Contact.findAll()
console.log('bot.Contact.findAll() done.')
const totalNum = contactList.length
let n = 0
await from.say(
const replyText = [
`Total contact number: ${totalNum}`,
contactList
.slice(0, 17)
.map(contact => contact.name())
.map(name => ++n + '. ' + name)
.join('\n'),
)
.map(name => ++n + '. ' + name),
].join('\n')
await from.say(replyText)
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册