cias
v4.0.3
Published
Tools for helping run the Games in a Snap event on twitch.tv
Downloads
30
Maintainers
Readme
CiaS
npm install cias
//Required Dependencies
npm install mysql
npm install tmi.js
This library is meant to act as a twitch bot extension to allow for the smooth management and performance of Games in a Snap and other E-Sport events. It originally was written for the "Cities in a Snap" event, which Games in a Snap grew out of.
BEFORE YOU BEGIN
Reserved.
Implementation
Includes
const mysql = require(`mysql`); // Requirement
const tmi = require('tmi.js'); // Recommended for chat functionality, though not strictly necessary to function.
const config = require('./config'); // Recommended to store variables safely
Building the Config
const ciasOPTS = {
initialize: true, // Required true/false to initialize DB and Table automatically using the parameters given. Recommended for first use.
MYSQLhost: `path.to.host`, // Required
MYSQLuser: `sqlUser`, // Required
MYSQLpassword: `sqlPassword`, // Required
MYSQLdatabase: `<db_name>`, // Required
EventsTable: `<events_table>`, // Required
CompetitorsTable: `<competitors_table>`, // Required
UsersTable: `<UsersRegistration_table>`, // Required
channel: `<YourChannel>` // Required
}
USE
Announcements
Announces the input text to all participants in an event.
cias.announce(channel, msg);
Route
Announces the input text to a single participant as specified.
cias.announce(participant, msg);
Join
Same as tmi.js client.join(), but cycles through current participants.
cias.join();
Part
Same as tmi.js client.part(), but cycles through current participants.
cias.part();
Participant
Returns single Participant object based on the number given for the event in question.
cias.participant(participant, callback);
Participants
Returns All Participants as objects based on the event in question.
cias.participants(callback);
Refresh
Refreshes Participants list.
cias.refresh(callback);
Errors
Runs the CiaS Module's Error Module. (mostly for internal use)
cias.error(err);
Set Event Number
Sets the event number (integer) for the rest of the module to operate on. See the example for details on how to implement.
cias.setEvent(event, callback);
Timer
Manually runs the CiaS Module's Timer for a length of time (in minutes, float).
cias.timer(channel, length);
Ten Seconds Remaining
Calls the final 10 seconds sequence.
cias.tenseconds(channel);
Starting Timer (30 seconds)
Starts the event. Length (optional) is a value in minutes.
cias.starting(channel, length);
Notes: A length of 0 will result in the starting countdown running on its' own. A valid, non-zero integer (or decimal) will result in the starting countdown followed by the event timer starting. A length of 0 will result in the starting countdown running on its' own.
Developed by Cazgem (https://cazgem.com) for use as part of cities in a snap, and Games in a Snap (https://twitch.tv/gamesinasnap) specifically for his chatbot, Polyphony.