Closed techygrrrl closed 1 year ago
Notes from the Discord conversation, for reference:
techygrrrl — 05/08/2022 I haven't tried yet but does TAU have a way to authenticate as one user and send messages and perform actions as that user on my channel? I have a separate bot user I use for bot-related things on my channel and it has mod abilities, wondering if I can use that user to post things and automate moderation with the help of TAU. FiniteSingularity [He/Him] — 05/09/2022 I assume you mean in terms of the Chatbot/IRC stuff? Currently, no, you can only send messages/perform actions as the user that is linked to the token you provided during setup. That said, I really need this functionality myself (so that I can move ChalkBoom bot from Comfy.js to using TAU), so it is on my priority "todos." FiniteSingularity [He/Him] — 05/09/2022 I think the way to do it, would be to provide an IRC token when the connection to the TAU IRC websocket is opened, if you want to use a different account. (so if you dont provide one, it will be your default user, but if you provide the login details, it will open a new IRC connection under that user account)
Quick summary of our chats on Discord in a quick tech spec document that outlines how we can authenticate bot users with separate callback URLs, store the tokens, and authorize acting on behalf of bot users for helix passthrough endpoints.
Deliberately left out IRC stuff as I'm not too familiar with that protocol.
I've been working on a PR for this, and thought I'd put some notes here. In order for this to happen, a few tasks must be accomplished:
ChatBot
model for django, which holds the data necessary to log a chat bot in, and refresh tokens. [Complete]A couple things I am thinking about:
ChatBotChannel
model that defines what channels a given chatbot should connect to when it runs. That way, you could have your bot connect to multiple channels, and remember what it needs to reconnect to the next time it connects to IRC.Made some great progress today. All of the above tasks are now complete. A few more things need to be done before we're ready for a PR:
These tasks should be a bit more straightforward than the first set. We're getting there!
This is so awesome! 🚀 I'm getting very excited for this feature!
💯 agree connecting to IRC only when the web socket is being listened to (rather than an always-on approach). This would also give devs more control to restart their local bots to re-connect if for whatever reason there was a connection error).
Looking forward to those features to add/remove bots and watched channels!
I'm also more than happy to pull down the PR and test it out and see if I can break anything.
Closing this, as it was merged in with #120
It would be great to be able to authorize a dedicated bot account for chat purposes so that it can be clear to my viewers when I am speaking and when my bot is speaking.
Instead of using the StreamElements bot, for example, I'd like to implement my own bot with chat commands but have my bot's code focus specifically on the business logic of the bot, and leave the heavy lifting around authenticating and Twitch API complexity to TAU.
Here are some examples how this could be applied:
!uptime
in the chat, I can use IRC to listen to chat messages. I don't mind doing this via my own implementation of tmi.js, or I can use the chat IRC from TAU (or tmi.js equivalent) if that's an option. I can use the TAU helix passthrough endpoints to fetch my stream data for my own account, using the auth tokens of my own account. I can send a message in chat from my bot account after doing business logic to return my total up time in hours/minutes, e.g.techydrrrroid: techygrrrl has been live for 1 hour, 30 minutes
.!so
in chat to shout out another user. I retrieve latest stream information from this user via the helix passthrough and I post a message as my bot account with a link to that user and include game information. Currently I use StreamElements for this but it's buggy and occasionally returns myself instead of the target user. If I implement it myself I can be sure this works properly.Implementation ideas
I'm not sure exactly what the API for this could look like, perhaps leverage either the websockets functionality, or a new endpoint for the TAU REST API, e.g.
POST /api/v1/twitch-chat
with data{ "message": "techygrrrl has been live for 1 hour, 30 minutes", "from_login": "techydrrroid" }
or send a different auth token for the bot. I believe you also mentioned on Discord something about passing an IRC token. Not picky about the API.Describe alternatives you've considered
Currently, I have a bot I built myself. I need to authorize it before every stream and it doesn't implement auto-refreshing of auth tokens. I'd like to take advantage of the auto-refreshing of auth tokens from TAU to simplify my bot implementation to have it be just the business logic and leverage TAU for the authentication and helix passthrough.
I also have some bot commands that use StreamElements and some serverless functions but these have limited functionality.
The ability to be able to send commands via my own branded bot and leverage TAU's functionality for authentication and Twitch API unifying would be great.
Additional context
Here is an example use case of my bot doing countdown functionality.
I could, for example, run my own bot server before every stream that connects via tmi.js, but when it needs to do something more than just read, I'd like to send it via TAU so that I don't have to deploy and implement refreshing tokens.