crowbartools / Firebot

A powerful all-in-one bot for Twitch streamers
https://firebot.app
GNU General Public License v3.0
353 stars 100 forks source link

[Feature Request] on close/exit event #2332

Closed lublak closed 8 months ago

lublak commented 9 months ago

Describe the solution you'd like

it would be cool if there was not only a start event but also a close event. At the end of the stream I like to switch to Emojichat only. The reason for this is that after the stream ends and the bot is closed, there is no more moderation. Because all commands run via this bot. Means, in general an event would be useful which reacts shortly before firebot is closed to switch the chat automatically.

dennisrijsdijk commented 9 months ago

Personally I do this by hooking into OBS Stream Started and OBS Stream Ended. in update 5.60 there'll also be events for Twitch Stream Started and Twitch Stream Ended which you should be able to use for this, but I agree that a Firebot Closing type of event would be useful for cleanup as well.

lublak commented 9 months ago

@dennisrijsdijk Yes, that would also work. just Twitch stream started and ended. You would have to be careful not to close firebot first. I will definitely use it like this for the time being :)

itsjesski commented 9 months ago

@dennisrijsdijk @lublak with 5.60 out the door, is this ticket still needed or do you have everything you need now?

dennisrijsdijk commented 9 months ago

I think a "Firebot Closed" event would still be distinct, and useful in its own way, so please keep this issue open.

JoeruCodes commented 9 months ago

image

Where should set the trigger of the event? Should I do it using the 'before-quit' event of electron or should I do it within the 'close' event of electron as highlighted respectively?

Or maybe i can directly trigger it in the main.js like so... image

dennisrijsdijk commented 9 months ago

I would say this is probably best left to the core dev team. @zunderscore or @ebiggz thoughts?

ebiggz commented 9 months ago

Cool idea!

@JOELPOG Thanks for looking into implementing this. I think it would make the most sense to put this in the willClose event callback. I just pushed up some tweaks to the v5 branch to better support asynchronous close logic needed for it. With that in place, you should be able to trigger the "Firebot close" event in there:

image
JoeruCodes commented 9 months ago

Thank you! However, might there be a concern about potential memory leaks when directly calling the backend functions right?