-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamertag.js
75 lines (67 loc) · 1.71 KB
/
gamertag.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
exports.getScriptManifest = () => {
return {
name: "Platys Gamertag Script",
description: "Have different response to gamer tag command per title",
version: "0.1",
author: "PlatypusMuerte",
website: "https://twitter.com/PlatypusMuerte"
};
};
function getDefaultParameters() {
return new Promise((resolve, reject) => {
resolve({
channelName: {
type: "string",
description: "Type your channel name"
},
gamerTag: {
type: "string",
description: "Type your gamer tag"
}
});
});
}
exports.getDefaultParameters = getDefaultParameters;
function run(runRequest) {
var currentTitle,currentGame;
let channel = runRequest.parameters.channelName;
let gamerTag = runRequest.parameters.gamerTag;
var urls = {
channel: "https://mixer.com/api/v1/channels/" + channel
};
const request = runRequest.modules.request;
return new Promise((resolve, reject) => {
request(urls.channel, function (error, response, data) {
if (!error) {
channelData = JSON.parse(data);
currentTitle = channelData.name.toLowerCase();
currentGame = channelData.type.name.toLowerCase();
if((currentGame == "grand theft auto v") && currentTitle.includes("| rp")) {
resolve({
success: true,
effects: [{
type: EffectType.CHAT,
message: "This is an PC RP server, not GTA Online on Xbox. But my gamer tag is " + gamerTag,
chatter: "Streamer"
}]
});
} else {
resolve({
success: true,
effects: [{
type: EffectType.CHAT,
message: "My gamer tag is " + gamerTag,
chatter: "Streamer"
}]
});
}
} else {
resolve({
success: true,
effects: []
});
}
});
});
}
exports.run = run;