Skip to content

Commit

Permalink
Update twitch
Browse files Browse the repository at this point in the history
  • Loading branch information
MAPReiff committed May 6, 2018
1 parent c3a8863 commit 066b111
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions modules/functions.js
Expand Up @@ -29,8 +29,7 @@ module.exports = (client) => {
}

}
}
else {
} else {
permlvl = permlvl
}

Expand Down Expand Up @@ -254,7 +253,7 @@ module.exports = (client) => {
}
});
}

}

client.liveTwitch = async (twitch) => {
Expand All @@ -268,7 +267,7 @@ module.exports = (client) => {

if (fs.existsSync(userDir + "/" + twitch + ".txt")) { //varifies that the streamer is on record
var request = require("request"); //sets a var to request info
request("https://api.twitch.tv/kraken/channels/" + twitch + "?client_id=" + settings.twitch_id, function (error, response, body) { //request streamer's in in JSON form
request("https://api.twitch.tv/kraken/channels/" + twitch + "?client_id=" + settings.twitch_id2, function (error, response, body) { //request streamer's in in JSON form
if (!error && response.statusCode == 200) { //if there is no error
var twitchInfo = JSON.parse(body); //sets twitchInfo to the JSON data
if (twitchInfo.game == null) { //if there is no game set to the stream
Expand Down Expand Up @@ -322,6 +321,33 @@ module.exports = (client) => {
}
}

client.spendMoney = async (id, ammount) => {
const userInfo = await client.getUserInfo(id);
var points = parseInt(userInfo.points)

userInfo.points = points - ammount;
client.userInfo.get(id).update({
"userInfo": userInfo
}).run();
}

client.giveMoney = async (id, ammount) => {
const userInfo = await client.getUserInfo(id);
var points = parseInt(userInfo.points)

userInfo.points = points + ammount;
client.userInfo.get(id).update({
"userInfo": userInfo
}).run();
}

// client.livePingMixer = async (id, message) => {
// const serverSettings = await client.getsettings(id);
// var livePing = serverSettings.livePing
// if (livePing == "false"){

// }
// }

/* MISCELANEOUS NON-CRITICAL FUNCTIONS */

Expand Down

0 comments on commit 066b111

Please sign in to comment.