-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
64 lines (49 loc) · 1.78 KB
/
main.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
const axios = require('axios');
const token = 'paste-token-here'; // Paste token from Lumia Stream (Settings > Advanced > Developers API > Show Token)
const run = async () => {
try {
if (!token) {
throw new Error('Token is required');
}
// Get Possible Types and Values
const retrieveRes = await axios.get(`http://localhost:39231/api/retrieve?token=${token}`);
console.log('API Retrieve response: ', retrieveRes.data);
// Senc Chat Command Blue
const commandRes = await axios.post(`http://localhost:39231/api/send?token=${token}`, {
type: 'chat-command',
params: {
value: 'blue',
},
});
console.log('API Command response: ', commandRes.data);
// Send Alert
const alertRes = await axios.post(`http://localhost:39231/api/send?token=${token}`, {
type: 'alert',
params: {
value: 'twitch-follower',
},
});
console.log('API Alert response: ', alertRes.data);
// Send RGB Colors with Brightness
const genericRes = await axios.post(`http://localhost:39231/api/send?token=${token}`, {
type: 'rgb-color',
params: { value: { r: 20, g: 100, b: 10 }, brightness: 100, transition: 0, duration: 5000 },
});
console.log('API Generic response: ', genericRes.data);
// Send Text To Speech
const ttsRes = await axios.post(`http://localhost:39231/api/send?token=${token}`, {
type: 'tts',
params: { value: 'Wow, this tutorial is so cool' },
});
console.log('API TTS response: ', ttsRes.data);
// Send Chatbot message
const chatbotRes = await axios.post(`http://localhost:39231/api/send?token=${token}`, {
type: 'chatbot-message',
params: { value: 'Wow, this tutorial is so cool', platform: 'twitch' },
});
console.log('API Chatbot response: ', chatbotRes.data);
} catch (err) {
console.error('API run err: ', err);
}
};
run();