Skip to content

Commit

Permalink
fixed send at msg err (#214)
Browse files Browse the repository at this point in the history
* 3.9.2.23 init (#180)

* 3.9.2.23 initt

* Update init-agent-script.js

* 3.9.2.23 adapter

* 3.9.2.23 init (#182)

* 3.9.2.23 initt

* Update init-agent-script.js

* 3.9.2.23 adapter

* 适配3.9.2.23

* Delete agent-script-3.9.2.23-new.js

* 适配3.9.2.23 (#185)

* 3.9.2.23 initt

* Update init-agent-script.js

* 3.9.2.23 adapter

* 适配3.9.2.23

* Delete agent-script-3.9.2.23-new.js

* 适配3.9.2.23

---------

Co-authored-by: LuChao <[email protected]>

* add 1.3.0 illustrate

* Update README.md

* Update README.md

* add demo

* 1.13.1

* 1.13.1

* 1.13.2 dev

* 增加扫码登录、检测登录状态

* 增加登入登出事件

* 增加ts改造init

* 1.13.2

* 1.13.2

* 1.13.2

* 1.13.2

* 1.13.2

1. 修复获取群成员昵称乱码

* Update .npmignore

* Update .gitignore

* 1.13.2删除agent的ts文件

* 1.13.4

* 1.13.5

* Update init-agent-script.ts

* 1.13.5

* 1.13.6

* del png file

* Update init-agent-script.js

* 1.13.7 修复@好友出现两个昵称的bug

* 1.13.7 修复@好友昵称重复bug (#209)

* 3.9.2.23 init (#180)

* 3.9.2.23 initt

* Update init-agent-script.js

* 3.9.2.23 adapter

* 3.9.2.23 init (#182)

* 3.9.2.23 initt

* Update init-agent-script.js

* 3.9.2.23 adapter

* 适配3.9.2.23

* Delete agent-script-3.9.2.23-new.js

* 适配3.9.2.23 (#185)

* 3.9.2.23 initt

* Update init-agent-script.js

* 3.9.2.23 adapter

* 适配3.9.2.23

* Delete agent-script-3.9.2.23-new.js

* 适配3.9.2.23

---------

Co-authored-by: LuChao <[email protected]>

* add 1.3.0 illustrate

* Update README.md

* Update README.md

* add demo

* 1.13.1

* 1.13.1

* 1.13.2 dev

* 增加扫码登录、检测登录状态

* 增加登入登出事件

* 增加ts改造init

* 1.13.2

* 1.13.2

* 1.13.2

* 1.13.2

* 1.13.2

1. 修复获取群成员昵称乱码

* Update .npmignore

* Update .gitignore

* 1.13.2删除agent的ts文件

* 1.13.4

* 1.13.5

* Update init-agent-script.ts

* 1.13.5

* 1.13.6

* del png file

* Update init-agent-script.js

* 1.13.7 修复@好友出现两个昵称的bug

---------

Co-authored-by: choogoo <[email protected]>

* 1.13.7

* Update README.md

* 1.13.8

---------

Co-authored-by: choogoo <[email protected]>
  • Loading branch information
atorber and choogoo authored Jan 19, 2024
1 parent 151f423 commit c02395a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 2 additions & 0 deletions examples/raw-sidecar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ async function main() {
// for (const room of roomListJSON) {
// console.info('room:', room)
// }
// await sidecar.sendAtMsg('21341182572@chatroom', new Date().toLocaleString(), 'atorber', '超哥');

}

const onLogout = (bySrv: number) => {
Expand Down
14 changes: 7 additions & 7 deletions examples/ripe-wechaty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ async function onLogin (user: Contact) {
log.info('好友数量:', friends.length)

// 发送@好友消息
// const room = await bot.Room.find({topic:'大师是群主'})
// const contact = await bot.Contact.find({name:'luyuchao'})
// log.info('room:', room)
// if(room && contact){
// const contacts:Contact[]= [contact]
// await room.say(new Date().toLocaleString() + ':瓦力上线了!', ...contacts)
// }
const room = await bot.Room.find({topic:'大师是群主'})
const contact = await bot.Contact.find({name:'luyuchao'})
log.info('room:', room)
if(room && contact){
const contacts:Contact[]= [contact]
await room.say(new Date().toLocaleString() + ':瓦力上线了!', ...contacts)
}
}

function onLogout (user: Contact) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechaty-puppet-xp",
"version": "1.13.7",
"version": "1.13.8",
"description": "Puppet XP for Wechaty",
"type": "module",
"exports": {
Expand Down
6 changes: 3 additions & 3 deletions src/init-agent-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,11 +987,11 @@ var asmAtMsg = null;
var roomid_, msg_, wxid_, atid_;
var ecxBuffer;
var sendAtMsgNativeFunction = (function (roomId, text, contactId, nickname) {
// console.log('Function called with roomId:', roomId, 'text:', text, 'contactId:', contactId, 'nickname:', nickname)
asmAtMsg = Memory.alloc(Process.pageSize);
ecxBuffer = Memory.alloc(0x3b0);
var atContent = text;
if (!text.startsWith('@' + nickname))
atContent = '@' + nickname + ' ' + text;
// console.log('xxxx', text.indexOf('@'+nickname))
var atContent = text.indexOf('@' + nickname) !== -1 ? text : ('@' + nickname + ' ' + text);
roomid_ = initStruct(roomId);
wxid_ = initidStruct(contactId);
msg_ = initmsgStruct(atContent);
Expand Down
9 changes: 4 additions & 5 deletions src/init-agent-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1116,13 +1116,12 @@ const sendMsgNativeFunction = (talkerId: any, content: any) => {
let asmAtMsg:any = null
let roomid_, msg_, wxid_, atid_
let ecxBuffer
const sendAtMsgNativeFunction = ((roomId, text, contactId, nickname) => {

const sendAtMsgNativeFunction = ((roomId, text, contactId,nickname) => {
// console.log('Function called with roomId:', roomId, 'text:', text, 'contactId:', contactId, 'nickname:', nickname)
asmAtMsg = Memory.alloc(Process.pageSize)
ecxBuffer = Memory.alloc(0x3b0)
let atContent = text

if(!text.startsWith('@'+nickname)) atContent = '@'+nickname+' '+text
// console.log('xxxx', text.indexOf('@'+nickname))
const atContent = text.indexOf('@'+nickname)!==-1? text:('@'+nickname+' '+text)

roomid_ = initStruct(roomId)
wxid_ = initidStruct(contactId)
Expand Down

0 comments on commit c02395a

Please sign in to comment.