Teekeks / pyTwitchAPI

A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat
https://pytwitchapi.dev
MIT License
254 stars 38 forks source link

Chat: Commands on a per Room Basis #228

Closed Braastos closed 1 year ago

Braastos commented 1 year ago

This implementation allows multiple Rooms to listen to. It would be useful if commands could be defined on a optional per Room Basis.

So something like this could be possible: chat.register_command('reply', test_command, room="SomeChannelName") #register only for SomeChannelName chat.register_command('reply2', test_command2) #register for all channels

Teekeks commented 1 year ago

this would be reasonably easy to implement but I am still not sure if this is something that should be handled by the library. Adding logic ala "is this command supposed to be used in this channel" is much more flexible in the user code outside the library.

Maybe a flexible way to add this to the library would be to allow command middleware where people can insert their own command execution logic.

Teekeks commented 1 year ago

0086e00 should do exactly what you want and way more