Skip to content

Instantly share code, notes, and snippets.

@Anaerin
Last active April 18, 2017 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anaerin/c5bcdc45f9765589ffb913e63ec40184 to your computer and use it in GitHub Desktop.
Save Anaerin/c5bcdc45f9765589ffb913e63ec40184 to your computer and use it in GitHub Desktop.

Code Map

Okay, here's how this sucker's going to work.

/lib

General utility functions and objects. For instance...

log.js

Initializes and sets up logging using winston

oAuth.js

Handles oAuth handshakes, for TMI login details and the like.

/plugins

Plugins extend functionality. They can be enabled or disabled on a per-channel basis, they may raise websockets events and API values, and can be configured via the web interface for the owner (and mods? - Can't get from the API, would have to log from chat, which has issues of its own) of a channel. Should be monolithic, one plugin per file, so index.js can load them all and they do their own setup with DB definitions and the like.

/db

Holds basic database initializers. Stores channels, users, and settings. Also loads/initializes DB extensions from plugins... somehow. Using sequelize, with their ES6 constructor syntax (which appears not to be documented outside tickets, as it's not in the current stable release yet)

/tmi

Client.js

Opens a connection to Twitch Chat through TMI.js, maintains that connection, handles global events, creates/destroys channel objects and passes channel events through to them.

Channel.js

Handles events for channels, uses settings to attach plugins.

/web

index.js

Provides top-level control.

live.js

Shows currently live channels.

login.js

Handles oAuth for Twitch, stores Twitch user ID in DB and in session, to keep user authorized for items that require it. Like...

/web/admin

REQUIRES oAUTH

Allows user to control leg_bot in their channel, enabling and disabling plugins and configuring them as necessary.

/web/public

Shows public pages from plugins, like statistics, quotes and the like. If user is logged in, allows them to make/change votes and the like, but login is not required to view.

/web/api

Various API endpoints for overlays and the like.

/web/ws

Websockets endpoints. Hopefully working ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment