mlopezr / node-red-contrib-matrixbot

Matrix.org chat bot nodes for Node-RED
16 stars 14 forks source link

Added SendImage support #8

Closed kitzler-walli closed 3 years ago

kitzler-walli commented 3 years ago

I updated the js-api and added a SendImage functionality to your code.

dotWee commented 3 years ago

I updated the js-api and added a SendImage functionality to your code.

Since the matrix sender node now accepts msg.payload.content, msg.payload.raw, msg.payload.imgType & msg.payload.text, could you provide an example injection? Not sure about the new parameters, except msg.payload.text.

kitzler-walli commented 3 years ago

This is how I use it in a function node before sending it to the bot:

let img = msg.payload;
//msg.payload = flow.get('payload');
msg.payload = {};
msg.payload.content = img;
msg.payload.raw = false;
msg.payload.imgType = 'image/jpeg';
msg.payload.type = "image";
return msg;
dotWee commented 3 years ago

Got it running and it works like a charm, thanks! Your implementation is really appreciated!

kitzler-walli commented 3 years ago

I'll probably add encryption support next

dotWee commented 3 years ago

Maybe think about releasing your contributions as an active fork, since this repo sadly seems unmaintained.

yousefamar commented 3 years ago

@mlopezr If you no longer wish to maintain this package, would you mind making @kitzler-walli a maintainer on both GitHub and npm? @kitzler-walli would you be open to that? If not, I would be happy to do it on your behalf (my npm username is amar).

If @mlopezr is AWOL, then @kitzler-walli would you be willing to publish your fork on npm under a different name so that it shows up in the palette search? I think it will take over quickly when you look at the dates.

Then in the future, others won't be in my situation where I found out about the fork after already having started to replicate the work @kitzler-walli has already done. @kitzler-walli, unless you've already started E2EE support, I'll PR to your fork for now once I've finished that.

mlopezr commented 3 years ago

Thanks so much for the pull request @kitzler-walli, I have merged it and published a new version on npm.

It's great to see people using and improving this!

I haven't used Matrix or NodeRed in a while so I can't maintain this repo any more. As per @yousefamar's suggestion, I've invited @kitzler-walli to become maintainer on GitHub, and I can do it for npm as well if you give me your login.

kitzler-walli commented 3 years ago

My username at npm is kitzler_walli