Guest User

Untitled

a guest
Oct 14th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. fs.readFile("connectionSettings.json", (err, data) => {
  2. if (err){
  3. console.log(err);
  4. } else {
  5. channelData = JSON.parse(data);
  6. options = {
  7. options: {
  8. debug: true
  9. },
  10. connection: {
  11. cluster: "aws",
  12. reconnect: true
  13. },
  14. identity: {
  15. username: channelData[1],
  16. password: channelData[2]
  17. },
  18. channels:[channelData[0]]
  19. };
  20.  
  21. client = new tmi.client(options);
  22. client.connect();
  23. }
  24. })
  25.  
  26. client.on("chat", function(channel, userstate, message, self) {
  27. mainWindow.webContents.send("message:add", userstate.username, message);
  28. console.log("message");
  29. })
  30.  
  31. function sendMessage(msg) {
  32. client.say(options.channels[0].replace("#",""), msg)
  33. }
Add Comment
Please, Sign In to add comment