Schmavery / facebook-chat-api

Unofficial Facebook Chat API for Nodejs
MIT License
1.93k stars 596 forks source link

[Enhancement] Adding support for event emitters #766

Open PixelHir opened 4 years ago

PixelHir commented 4 years ago

I believe that Event Emitters are much more flexible than using a callback from listen function. That would be a nice addition to the library.

ptrcnull commented 4 years ago

Honestly, rewriting the library to use EventEmitters and Promises/async functions instead of callbacks would make it so much easier to use, but I don't think Schmavery has interest in anything like that.

PixelHir commented 4 years ago

Honestly, rewriting the library to use EventEmitters and Promises/async functions instead of callbacks would make it so much easier to use, but I don't think Schmavery has interest in anything like that.

Yeah, though this lib definitely deserves a rewrite since the state of it has been bad for a long time. (not because of the maintainers, but rather facebook that keeps making changes)

ptrcnull commented 4 years ago

IMO it deserves a rewrite, because currently there's quite a bit of left-over unused/commented code, a few different code styles and it lacks most of newer JS features, like Promises or BigInts (which could be used internally, like for generating OTIDs), current maintainers don't seem very active though :/ I was thinking about either making a principles fork of FCA by making a patchset or just abandoning this codebase and rewriting it from the ground, but it would take some time.

HossamMohsen7 commented 4 years ago

I'm actually working on a rewrite with new features. But I didn't have promises and event emitters in mind so I'll try to add them too it would be alot better.

ptrcnull commented 4 years ago

I see that @lequanglam has started fca-unofficial, looks promising.

BadAimWeeb commented 4 years ago

i'm working on it.

BadAimWeeb commented 4 years ago

https://github.com/fca-unofficial/fca-unofficial/releases/tag/1.3.8-u

oh yeah took me fricking 4 MONTHS TO DO THIS.

PixelHir commented 4 years ago

https://github.com/fca-unofficial/fca-unofficial/releases/tag/1.3.8-u

oh yeah took me fricking 4 MONTHS TO DO THIS.

You're a hero Unfortunately working with anything created by Facebook is pain in the ass

BadAimWeeb commented 4 years ago

https://github.com/fca-unofficial/fca-unofficial/releases/tag/1.3.8-u oh yeah took me fricking 4 MONTHS TO DO THIS.

You're a hero Unfortunately working with anything created by Facebook is pain in the ass

yeah that's true.