Permalink
Browse files

Week 19 updates, replace twitch-api with twitch-helix, and continuing…

… work on events.
  • Loading branch information...
roncli committed Dec 21, 2017
1 parent 2af629b commit 16ed520685f7cdc5a1658df453e2be3515c2c863
Showing with 143 additions and 165 deletions.
  1. +19 −34 .eslintrc.json
  2. +4 −4 app/package.json
  3. +1 −1 app/site/js/apiSettings.js
  4. +7 −7 app/site/js/extensions.js
  5. +27 −16 app/site/js/index.js
  6. +83 −101 app/site/modules/chat/twitch/index.js
  7. +2 −2 package.json
@@ -1,10 +1,9 @@
{
"env": {
"browser": true,
"es6": true,
"jquery": true,
"node": true
},
"globals": {},
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
@@ -16,19 +15,17 @@
"rules": {
"array-element-newline": "off",
"capitalized-comments": "off",
"camelcase": "off",
"class-methods-use-this": "off",
"complexity": "off",
"consistent-this": "off",
"default-case": "off",
"dot-location": "off",
"func-names": "off",
"getter-return": "off",
"global-require": "off",
"id-length": "off",
"indent": [
"error", 4, {
"SwitchCase": 1
}
],
"indent": ["error", 4, {"SwitchCase": 1}],
"init-declarations": "off",
"line-comment-position": "off",
"linebreak-style": "off",
@@ -39,12 +36,12 @@
"max-statements": "off",
"multiline-ternary": "off",
"new-cap": [
"error", {
"properties": false
}
"error",
{"properties": false}
],
"newline-per-chained-call": "off",
"no-confusing-arrow": "off",
"no-console": "off",
"no-continue": "off",
"no-empty-function": "off",
"no-implicit-coercion": "off",
@@ -56,41 +53,29 @@
"no-nested-ternary": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-process-exit": "off",
"no-return-assign": "off",
"no-trailing-spaces": ["error", {"ignoreComments": false}],
"no-ternary": "off",
"no-trailing-spaces": [
"error", {
"skipBlankLines": false,
"ignoreComments": false
}
],
"no-underscore-dangle": "off",
"no-useless-constructor": "off",
"no-void": "off",
"object-property-newline": "off",
"one-var": [
"off", {
"const": "always"
}
],
"one-var": ["off", {"const": "always"}],
"padded-blocks": "off",
"prefer-destructuring": [
"error", {
"array": false
}, {
"enforceForRenamedProperties": true
}
],
"prefer-destructuring": ["error", {"array": false}, {"enforceForRenamedProperties": true}],
"sort-keys": "off",
"sort-vars": "off",
"space-before-function-paren": "off",
"quote-props": "off",
"valid-jsdoc": [
"error", {
"prefer": {
"return": "return"
}
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true
}
]
}],
"valid-jsdoc": ["error", {"prefer": {"return": "return"}}]
}
}
@@ -19,14 +19,14 @@
},
"dependencies": {
"bootstrap": "3.3.7",
"bootstrap-colorpicker": "2.5.1",
"express": "4.15.3",
"iconv-lite": "0.4.18",
"bootstrap-colorpicker": "2.5.2",
"express": "4.16.2",
"iconv-lite": "0.4.19",
"jquery": "3.2.1",
"node-fonts": "1.0.0",
"tinycolor2": "1.4.1",
"tmi.js": "1.2.1",
"twitch-api": "0.4.6"
"twitch-helix": "1.0.6"
},
"engines": {
"node": ">=8.0.0"
@@ -9,7 +9,7 @@ module.exports = {
},
twitch: {
clientId: "xetz9cvboym6sr1iz19qr0kubr2nl1",
clientSecret: undefined,
clientSecret: "-",
redirectUri: "http://127.0.0.1:65100/token",
scopes: [
"channel_commercial",
@@ -1,10 +1,10 @@
// # ## ## # # # ###
// # # # # # ## # # # #
// # # # # ## # ### ### # # # # ### ### ### ##
// # # # # # ## # # # # # ### # # # # ## # ##
// # # # # # # # ## ## # # # # # # ## # ## ##
// ## ## ## # # ## ## # # # # # # ### ##
// #
// # ## ## # # # ###
// # # # # # ## # # # #
// # # # # ## # ### ### # # # # ### ### ### ##
// # # # # # ## # # # # # ### # # # # ## # ##
// # # # # # # # ## ## # # # # # # ## # ## ##
// ## ## ## # # ## ## # # # # # # ### ##
// #
JSON.tryParse = (str) => {
return new Promise((resolve, reject) => {
var initialStr = str;
@@ -12,6 +12,16 @@ const path = require("path"),

let profileWin, editChannelWin;

// ### #
// # #
// # # ## ## # ### # #
// # ## # # ## # # # #
// # # # # # ##### #
// # # # # ## # # #
// ### # # ## # ### # #
/**
* A class for the entry point into the application.
*/
class Index {
// # ### ##
// # # # #
@@ -162,23 +172,24 @@ class Index {
return;
}

client.getStream(channelName).then((stream) => {
return new Promise((resolve, reject) => {
new Promise((resolve, reject) => {
client.getStream(channelName).then((stream) => {
if (stream) {
channels[channel].stream = stream;
channels[channel].channel = stream.channel;
Index.updateTitle(channel);
resolve();
} else {
delete channels[channel].stream;
client.getChannel(channelName).then((channelData) => {
channels[channel].channel = channelData;
Index.updateTitle(channel);
resolve();
}).catch(reject);
reject(new Error("Stream is offline."));
}
});
}).then(() => {

resolve();
}).catch(reject);
}).catch(() => {
delete channels[channel].stream;
}).then(() => new Promise((resolve, reject) => {
client.getChannel(channelName).then((channelData) => {
channels[channel].channel = channelData;
Index.updateTitle(channel);
}).catch(reject);
})).then(() => {
if (!channels[channel].badges) {
client.getChannelBadges(channels[channel].channel._id).then((badges) => {
channels[channel].badges = badges;
@@ -315,7 +326,7 @@ class Index {
</div>
${channels[channel].channel ? `<div class="topic-text">
${channel}${channels[channel].channel.status ? " - " : ""}${this.htmlEncode(channels[channel].channel.status)} ${channels[channel].channel.game ? `(${this.htmlEncode(channels[channel].channel.game)})` : ""}<br />
${channels[channel].stream ? `Online: ${this.getTimeSince(channels[channel].stream.created_at)} - Viewers: ${channels[channel].stream.viewers} - ` : ""}${channels[channel].chatters ? `Chatters: ${channels[channel].chatters.chatter_count} - ` : ""}Followers: ${channels[channel].channel.followers} - Views: ${channels[channel].channel.views}
${channels[channel].stream ? `Online: ${this.getTimeSince(channels[channel].stream.started_at)} - Viewers: ${channels[channel].stream.viewer_count} - ` : ""}${channels[channel].chatters ? `Chatters: ${channels[channel].chatters.chatter_count} - ` : ""}Followers: ${channels[channel].channel.followers} - Views: ${channels[channel].channel.views}
</div>` : ""}
</div>
</div>`);
@@ -1021,13 +1032,13 @@ $(document).ready(() => {

editChannelWin.on("updatechannel", (channel, title, game) => {
client.setStatus(channel, {status: title, game}).then((channelData) => {
channels[channelName].channel = channelData;
channels[channelName].channel = channelData.body;
Index.updateTitle(channelName);

if (editChannelWin) {
editChannelWin.emit("editchannel-ok");
}
}).catch((err) => {
}).catch(() => {
if (editChannelWin) {
editChannelWin.emit("editchannel-invalidchannel");
}
Oops, something went wrong.

0 comments on commit 16ed520

Please sign in to comment.