Open 9cat opened 1 year ago
同一个程序, 通过 .on('message', async (message) => { const talker = message.talker() const room = message.room() 的方法,可以实现正常移除: room.remove(talker) ------------- 但用以下方式则不成功:
const roomstr = '1234567890@chatroom' const toRoom = await bot.Room.find({ id: roomstr }) console.log(` toRoom ` + toRoom) const talker = await bot.Contact.find({ id: ‘xxxxxx' }) console.log(` talker ` + talker) await toRoom.remove(talker!)
const talker = await room.member('马斯克') toRoom.remove(talker!)
可以成功。 但会删除名字相同的名字: 16:38:50 WARN Room member("马斯克") get 2 contacts, use the first one by default
如何 通过wxid_来定位群里面的用户?
同一个程序, 通过 .on('message', async (message) => { const talker = message.talker() const room = message.room() 的方法,可以实现正常移除: room.remove(talker) ------------- 但用以下方式则不成功:
------------------调试信息------------------ INFO TestBot OK Kick xxxxxxx@1234567890 room Room<#训练营> talker Contact<马斯克> 12:38:52 ERR [Request] [tid:6e3f25a5], padlocal grpc request failed: 1, error: Error: 2 UNKNOWN: [tid:6e3f25a5] 踢人失败:被踢用户(xxxxxxx)并不在聊天室中(1234567890@chatroom)