Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message.toString format discussion #1676

Closed
suntong opened this issue Dec 26, 2018 · 7 comments
Closed

Message.toString format discussion #1676

suntong opened this issue Dec 26, 2018 · 7 comments

Comments

@suntong
Copy link
Contributor

suntong commented Dec 26, 2018

Would it be OK that the Message.toString format be changed a bit?
https://github.com/Chatie/wechaty/blob/ae371981402b12f9a14c44071fbdde0da72c1836/src/user/message.ts#L227-L237

The current format makes it hard for me to quickly grasp who has said what at where.

I know it is much a personal preference, but would it be OK if I change the output format to

Message#Text[🗣Contact<From Who>@👥Room<Which Room>] The first 70 bytes...

as opposed to,

Message#Text(👥Room<WhichRoom>🗣Contact<From Who>👤Contact<Always My ID Thus Should be Omitted>)<<img class="qqemoji qqemoji106" text="[捂脸]_web" src="/zh_CN/htmledition/v2/images/spacer.gif" />>

I can do the fix and submit a PR if there is no strong oppose to the change. Thx.

@huan
Copy link
Member

huan commented Dec 26, 2018

Yes, it will be ok and I have no opposition to your change proposal.

Please go ahead to submit a PR for you to quickly grasp who has said what at where.

@suntong
Copy link
Contributor Author

suntong commented Dec 26, 2018

Thanks a lot. will do it right away.
BTW, I had been using '\t' to separate the people@room and message, which makes the messages lining up better, if their name length differ within 7 characters. I'll do this as well, if you don't mind...

@suntong
Copy link
Contributor Author

suntong commented Dec 26, 2018

Oh, @huan, sorry for a noob question -- I've made the changes locally in my npm root directory, but the output remains the same.

Do I need to trigger a rebuild/recompile or something for the change to take effect? If so, how. Thx a lot!

suntong added a commit to suntong/wechaty that referenced this issue Dec 26, 2018
change the Message.toString format, ref wechaty#1676
huan pushed a commit that referenced this issue Dec 27, 2018
change the Message.toString format, ref #1676
@huan
Copy link
Member

huan commented Dec 27, 2018

Merged.

@huan huan closed this as completed Dec 27, 2018
@suntong
Copy link
Contributor Author

suntong commented Dec 29, 2018

I've made the changes locally in my npm root directory, but the output remains the same.

Please help @huan/@windmemory --

I've done the npm run dist but the result still remains the same.

Basically, I'm following @windmemory's excellent tutorial article at:

https://github.com/botorange/wechaty-puppet-padpro/wiki/How-to-use-npm-link-to-develop-wechaty-puppet-padpro

and everything works fine, except that the result still remains the same.
Have I changed to the correct place?

Here is my work log:

cd ../wechaty
$ npm run dist
> [email protected] dist /path/to/wx/wechaty
> npm run clean && tsc


> [email protected] clean /path/to/wx/wechaty
> shx rm -fr dist/*

cd ../starter-bot

WECHATY_PUPPET=wechaty-puppet-mock node starter-bot.js 
Message#Text(🗣Contact<mock-name>👤Contact<mock-name>)<mock text>

cd ..
mv starter-bot/ /tmp

cd /tmp/starter-bot/


$ npm root
 /tmp/starter-bot/node_modules
$ grep -A10 'const msgStrList' node_modules/wechaty/src/user/message.ts
    const msgStrList = [
      'Message',
      `#${MessageType[this.type()]}`,
      '[',
        this.from()
          ? 'ð£' + this.from()
          : '',
        this.room()
          ? '@ð¥' + this.room()
          : '',
      ']',


WECHATY_LOG=silly WECHATY_PUPPET=wechaty-puppet-mock node starter-bot.js 
Message#Text(🗣Contact<mock-name>👤Contact<mock-name>)<mock text>

How to troubleshoot what went wrong? THX!

@huan
Copy link
Member

huan commented Dec 30, 2018

Please follow the issue template and describe the reproduce steps and your expect result in detail, or I can not understand what you want to do.

Please also open a new issue with your new problem, thanks!

@suntong
Copy link
Contributor Author

suntong commented Dec 30, 2018

Alright. Done @ #1681. Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants