Permalink
Browse files

* Allow Twitch hosting commands from Discord.

* Allow users to register as Twitch streamers on Discord with Twitch confirmation.  This replaces the old hosting rotation system that had Twitch users manually entered.
* Created a secondary hosting rotation that users with the Podcasters role can freely add or remove from.  Streamers in the primary rotation are always given priority over this secondary rotation.
* Allow Discord users to create voice channels that auto-delete after being empty for 5 minutes.
* Added a system that creates Discord roles for games that can be subscribed to for notification.
  • Loading branch information...
roncli committed Jun 21, 2016
1 parent 64b35a7 commit b6741cbed8ab81b3e828346d543457f0388cbb1c
Showing with 1,036 additions and 145 deletions.
  1. +57 −0 README.md
  2. +56 −0 database.js
  3. +7 −5 index.js
  4. +7 −4 package.json
  5. +909 −136 sixgaming.js
View
@@ -15,6 +15,30 @@ Installation
node index.js
Database
========
The database is quite simple. Here is the script that creates it:
CREATE TABLE game (
id int IDENTITY(1,1) NOT NULL,
game varchar(255) NOT NULL,
code varchar(50) NOT NULL
)
CREATE TABLE host (
id int IDENTITY(1,1) NOT NULL,
streamer varchar(50) NOT NULL
)
CREATE TABLE streamer(
id int IDENTITY(1,1) NOT NULL,
discord varchar(50) NOT NULL,
streamer varchar(50) NOT NULL,
code int NOT NULL,
validated bit NOT NULL CONSTRAINT DF_streamer_validated DEFAULT (0)
)
settings.js
===========
@@ -32,17 +56,50 @@ The following should be the contents of settings.js:
autoConnect: false
}
},
discord: {
token: "(Your token, retrieved from your Discord bot account)",
options: {
autoReconnect: true
}
},
twitch: {
clientId: "(Your client ID, retrieved from your Twitch connected app)",
clientSecret: "(Your client secret, retrieved from your Twitch connected app)",
redirectUri: "(Your redirect URI from your Twitch connected app)",
scopes: []
},
database: {
server: "(Your SQL server's IP)",
port: (Your SQL server's port number),
user: "(Your SQL server's user account name)",
password: "(Your SQL server's password)",
database: "(Your SQL server's database)",
pool: {
max: 50,
min: 0,
idleTimeoutMillis: 30000
}
},
admin: {
username: "(Your Discord account name)",
discriminator: (Your Discord account discriminator, not including the pound sign)
}
};
Version History
===============
1.1 - 6/19/2016
---------------
This major release includes database connectivity and a Discord bot.
* Allow Twitch hosting commands from Discord.
* Allow users to register as Twitch streamers on Discord with Twitch confirmation. This replaces the old hosting rotation system that had Twitch users manually entered.
* Created a secondary hosting rotation that users with the Podcasters role can freely add or remove from. Streamers in the primary rotation are always given priority over this secondary rotation.
* Allow Discord users to create voice channels that auto-delete after being empty for 5 minutes.
* Added a system that creates Discord roles for games that can be subscribed to for notification.
1.0.1 - 3/7/2016
----------------
View
@@ -0,0 +1,56 @@
var settings = require("./settings"),
sql = require("mssql"),
_ = require("underscore");
module.exports.query = function(sqlStr, params, callback) {
"use strict";
var conn = new sql.Connection(settings.database, function(err) {
var ps;
if (err) {
callback(err);
return;
}
ps = new sql.PreparedStatement(conn);
_(params).each(function(param, key) {
ps.input(key, param.type);
});
ps.multiple = true;
ps.prepare(sqlStr, function(err) {
if (err) {
callback(err);
return;
}
ps.execute(
_.object(_(params).map(function(param, key) {
return [key, param.value];
})), function(err, data) {
if (err) {
callback(err);
return;
}
ps.unprepare(function(err) {
if (err) {
callback(err);
return;
}
callback(null, data);
});
}
);
});
});
};
module.exports.TYPES = sql.TYPES;
_(sql.TYPES).each(function(value, key) {
"use strict";
module.exports[key] = value;
module.exports[key.toUpperCase()] = value;
});
View
@@ -1,8 +1,10 @@
var irc = require("irc"),
twitchApi = require("twitch-api"),
var Irc = require("irc"),
Discord = require("discord.js"),
TwitchApi = require("twitch-api"),
settings = require("./settings"),
sixGaming = require("./sixgaming"),
client = new irc.Client(settings.irc.server, settings.irc.nick, settings.irc.options),
twitch = new twitchApi(settings.twitch);
irc = new Irc.Client(settings.irc.server, settings.irc.nick, settings.irc.options),
discord = new Discord.Client(settings.discord.options),
twitch = new TwitchApi(settings.twitch);
sixGaming.start(client, twitch);
sixGaming.start(irc, discord, twitch);
View
@@ -1,6 +1,6 @@
{
"name": "SixBotGG",
"version": "1.0.1",
"version": "1.1.0",
"description": "A Twitch IRC bot for Six Gaming.",
"homepage": "https://github.com/roncli/SixBotGG",
"bugs": {
@@ -18,12 +18,15 @@
"url": "https://github.com/roncli/SixBotGG.git"
},
"dependencies": {
"irc": "0.4.1",
"discord.js": "8.0.0",
"irc": "0.5.0",
"mssql": "3.3.0",
"promised-io": "0.3.5",
"twitch-api": "0.4.3"
"twitch-api": "0.4.3",
"underscore": "1.8.3"
},
"engines": {
"node": ">=5.0.0"
"node": ">=6.0.0"
},
"private": true
}
Oops, something went wrong.

0 comments on commit b6741cb

Please sign in to comment.