Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for A Twitch chatbot powered by Notion
Paula Santamaría
Paula Santamaría

Posted on • Edited on

     

A Twitch chatbot powered by Notion

AchoBot is an open-source Twitch chatbot I built for myself. It allows you to manage your chatbot's commands using Notion:

notion-database

It relies on the power of Notion Databases to manage command responses, permissions, and documentation.

Table of contents


The repo

Check the repo here 👇

GitHub logo pawap90 / acho-bot

🐶💬 A Twitch chatbot powered by Notion

buildachobot-gh-banner

Use Notion to configure your Twitch chatbot commands!

notion-database

Features

Manage your Twitch Chatbot from Notion

Add, update or delete commands in a Notion database. AchoBot will use the information from Notion to answer your viewers when they invoke a command.

Assign Permissions to each Command

The database includes aPermissions column where you can specify who can invoke each command. Leave it empty, and everyone will have access to it.The column accepts one or more of the following values:

  • Broadcaster
  • Moderator
  • Subscriber
  • Viewer

Specific user permissions

You can also create commands that can only be invoked by a single specific user. To do that use the valueusr:<username>, for example:usr:paulasantamaria

Commands

Features

Here's the complete list of features:

Manage your Twitch Chatbot from Notion

Add, update or delete commands in a Notion database. AchoBot will use the information from Notion to answer your viewers when they invoke a command.

Assign Permissions to each Command

The database includes aPermissions column where you can specify who can invoke each command. Leave it empty, and everyone will have access to it.

Permissions column

Specific user permissions

You can also create commands that can only be invoked by a single specific user. To do that use the valueusr:<username>, for example:usr:paulasantamaria

Commands view

Navigate to/commands to get a list of every public command. Your viewers can use it to see the available commands.
Also, you can navigate to/commands?mode=image to get a ready-to-download image you can add to your Twitch panels.

A table showing every public commands on localhost:5000/commands

Scripted commands

You can specify the type of command in the "Type" column. Available options are:

Command types

Text commands return a plain text response. E.g: "Welcome to the stream".

Scripted commands can implement some logic (JavaScript) and receive parameters.

For example, imagine the following command!say <text>:

(context)=>{consttextToPrint=context.params.text;return`You said:${textToPrint}`;}
Enter fullscreen modeExit fullscreen mode

When a viewer invokes it:!say hello
Output:You said: hello

This feature is new and still has some limitations and issues. Writing code in a Notion DB cell is not ideal 😅.

Single account

The chatbot service will work only for the accounts and channels specified in the environment variables.
If any other account tries to log in using the chatbot authorization endpoints, it will get an authorization error.

The service is not currently designed to handle multiple accounts. This is a limitation, but it also makes the hosting and configuration of the service easier.

Status view

Use the status view to see if your bot's Twitch account is correctly authorized.
You can use this view in OBS to get real-time feedback on your chatbot status (it auto-updates every minute).

Built-in commands

Built-in commands are defined in the codebase instead of Notion. They usually require more logic and access to resources unavailable to the Notion commands. There are currently two built-in commands that you can use:

  • !help prints a list of available commands.
  • !refresh invalidates the command cache, so next time a command is triggered, the app needs to go to Notion to retrieve the commands, thus updating them to the latest version. Only available for Broadcaster and Moderators.

Placeholder commands

Some commands are triggered via code but defined in Notion. This allows AchoBot to react to certain events (like a user logging in or subscribing) while also allowing each user to specify what they want AchoBot to do in each case.
Right now, the only placeholder command is:

  • !welcome: Executed when AchoBot joins the chat room immediately after a stream starts. If you define this command in Notion when the bot logs in, it can say hi and leave some relevant information in the chat. E.g., "Hi, I'm AchoBot! Type !help to see what I can do".

Development

AchoBot runs on Node.js. It was developed with TypeScript and uses Nodemon to run the development server. It relies ontmi.js to connect and interact with Twitch's chat.

How it works

Once the service starts, AchoBot retrieves the commands from Notion (and other sources) and stores them in cache. When viewers execute a command, we search for it in the cache and execute it to generate a response:

AchoBot flow

Extensible

The project is designed to be easily extensible. It uses the command pattern to define the list of commands. You can extend this list using different strategies depending on what you aim to achieve. To know more:Extend AchoBot

Try it

Here's a detailed step-by-step guide on how to run AchoBot:AchoBot Setup - Full Guide


Stream

I developed this chatbot live on stream. Join me if you are interested inlive coding sessions where I experiment withdifferent tech stacks and buildopen-source software!

👉 twitch.tv/paulasantamaria

Right now, I'm working on a new portfolio withSvelte-kit, markdown, and TailwindCSS.

Top comments(5)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
kasuken profile image
Emanuele Bartolesi
🏆 Microsoft MVP & GitHub Star ⭐👨‍🎓 LinkedIn Technical Instructor 🎓
  • Email
  • Location
    Zurich, Switzerland
  • Pronouns
    he/him
  • Work
    Cloud Architect
  • Joined

Nice work!
I have a bot as well, but I love the idea to use Notion as "commands database"!

CollapseExpand
 
paulasantamaria profile image
Paula Santamaría
Passionate about creating stuff. Gamer, digital artist and guitarist on my free time. She/her
  • Location
    Buenos Aires, Argentina
  • Education
    IT Management Degree from UADE (Argentine University of Enterprise)
  • Work
    Freelance
  • Joined

Thank you!
Yes, it's super convenient to have your commands in Notion. I can just update everything I need before every stream without having to login anywhere. Can't wait to.keep adding more features to use on my streams!

CollapseExpand
 
gianpaj profile image
Gianfranco P.
Coding Mentor ✦ Tinkerer ✦ Senior Software Developer 🌞FREE coding class at @escuela.dev – online in Malaga or Madrid #webdev #mentor
  • Location
    Malaga, Spain
  • Joined

how often do you update your bot commands? or do non-developers need to update those often?

CollapseExpand
 
imkarthikeyan profile image
Karthikeyan
Passionate about tech | Gamer | Front End engineer
  • Location
    Bangalore
  • Education
    B.E Computer Science @ Velammal Engineering College
  • Work
    Front End Engineer @ Granicus
  • Joined

Nice work

CollapseExpand
 
paulasantamaria profile image
Paula Santamaría
Passionate about creating stuff. Gamer, digital artist and guitarist on my free time. She/her
  • Location
    Buenos Aires, Argentina
  • Education
    IT Management Degree from UADE (Argentine University of Enterprise)
  • Work
    Freelance
  • Joined

Thanks!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Passionate about creating stuff. Gamer, digital artist and guitarist on my free time. She/her
  • Location
    Buenos Aires, Argentina
  • Education
    IT Management Degree from UADE (Argentine University of Enterprise)
  • Work
    Freelance
  • Joined

More fromPaula Santamaría

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp