CiaS
npm install cias
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`);
const tmi = require('tmi.js');
const config = require('./config');
Building the Config
const ciasOPTS = {
initialize: true,
MYSQLhost: `path.to.host`,
MYSQLuser: `sqlUser`,
MYSQLpassword: `sqlPassword`,
MYSQLdatabase: `<db_name>`,
EventsTable: `<events_table>`,
CompetitorsTable: `<competitors_table>`,
UsersTable: `<UsersRegistration_table>`,
channel: `<YourChannel>`
}
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.