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

feature: use custom avatar from wechat per msg #2

Open
2 of 3 tasks
wey-gu opened this issue Dec 15, 2022 · 12 comments
Open
2 of 3 tasks

feature: use custom avatar from wechat per msg #2

wey-gu opened this issue Dec 15, 2022 · 12 comments

Comments

@wey-gu
Copy link
Owner

wey-gu commented Dec 15, 2022

A avatar cache should be built to custom msg sender's profile image.

  • support generating random emoji as an avatar, via feat: support avatar with random emoji #6
  • support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)
  • A way better/cooler proposal is WIP by @frostming to create a service to generate URL of avatar w/o needing to actually put files there.
@wey-gu wey-gu changed the title use custom avatar from wechat per msg feature: use custom avatar from wechat per msg Dec 15, 2022
wey-gu added a commit that referenced this issue Dec 15, 2022
partially implement: #2

also add aiohttp as dep due to async slack client
@wey-gu
Copy link
Owner Author

wey-gu commented Dec 15, 2022

Now it's something like this:

Screenshot 2022-12-15 at 23 29 26

@wey-gu
Copy link
Owner Author

wey-gu commented Dec 16, 2022

TBD:

@frostming
Copy link
Collaborator

frostming commented Dec 16, 2022

support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)

Disagree with introducing extra dependencies. I will try a serverless solution that generates the image URLs from the base64 data. Something like:

https://make-image.serverless.app/${base64}

@wey-gu
Copy link
Owner Author

wey-gu commented Dec 16, 2022

support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)

Disagree with introducing extra dependencies. I will try a serverless solution that generates the image URLs from the base64 data. Something like:

https://make-image.serverless.app/${base64}

ok, this..., to put image in URL/base64 blew my mind 🤯!!!! It's totally next level🧎🏻...

@frostming
Copy link
Collaborator

frostming commented Dec 16, 2022

support upload avatar to object storage with URL and pass to slack(seems to be the only way to specify avatar)

Disagree with introducing extra dependencies. I will try a serverless solution that generates the image URLs from the base64 data. Something like:

https://make-image.serverless.app/${base64}

ok, this..., to put image in URL/base64 blew my mind 🤯!!!! It's totally next level🧎🏻...

Indeed it has been worked out with CF worker(yeah, THANKS TO ChatGPT), try visiting this URL. I am currently stuck by not able to get the contact avatar..

P.S. the API spec is:

https://mkimg.frostming.workers.dev/${base64_url_encoded}.${ext}

@wey-gu
Copy link
Owner Author

wey-gu commented Dec 16, 2022

Aha, my regular expression was written by ChatGPT, too :P

It worked like a charm! I am not familiar with the price model of CF worker, as it will require CF's edge computing resource to decode and respond with those small images, will this be scaling to anyone? (that is, we can place your single CF-worker-based endpoint by default to expect it will work for long? or do we need users to setup their own avatar base64 ping-pong service same as yours?

Screenshot 2022-12-16 at 15 32 10

@frostming
Copy link
Collaborator

I am currently stuck by not able to get the contact avatar..

Reported to wechaty: wechaty/python-wechaty#381

@wey-gu
Copy link
Owner Author

wey-gu commented Dec 16, 2022

I am currently stuck by not able to get the contact avatar..

Reported to wechaty: wechaty/python-wechaty#381

Oh, I encountered this, too, this is hard as python lib is just a wrapper and the gateway is the major part(hard for me to debug) :(

anyway, I will look into it later, too, I have to prepare for the slides of tomorrow now 🤦🏻‍♀️.

@frostming
Copy link
Collaborator

Indeed, but the error message argument of type 'NoneType' is not iterable indicates that it may come from Python code. Let's see.

@wey-gu
Copy link
Owner Author

wey-gu commented Dec 16, 2022

@frostming If the ContactAvatarResponse, and ContactAvatarRequest gRPC interface issue cannot be mitigated anyway, we could still leverage your CF worker URL encoded magic to add our customized avatars :)

@frostming
Copy link
Collaborator

@frostming If the ContactAvatarResponse, and ContactAvatarRequest gRPC interface issue cannot be mitigated anyway, we could still leverage your CF worker URL encoded magic to add our customized avatars :)

I came up with an EVIL approach to fix the issue in a DIRTY way, let me check.

@wey-gu
Copy link
Owner Author

wey-gu commented Dec 17, 2022

Wow, this sounds neat...😏

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

No branches or pull requests

2 participants