Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const tmi = require("tmi.js");
- var readline = require('readline');
- var rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout,
- terminal: false
- });
- rl.on('line', function(line){
- console.log(line);
- })
- const options = {
- options: {
- debug: false // true
- },
- connection: {
- //cluster: 'aws',
- reconnect: true,
- secure: true
- },
- identity: {
- username: "klay4_bot",
- password: "oauth:sggooe8seugazuqjlp363vbu81h0mz"
- },
- channels: [ "klay4_" ]
- };
- const client = new tmi.client(options);
- // Invocazione funzioni
- client.on('join', benvenuto);
- client.on('chat', text_to_speach);
- client.on('chat', info);
- // Il bot si connette a Twitch
- client.connect();
- function benvenuto (channel, username, message, self) {
- if (self) return;
- client.color("Red");
- if (username !== "klay4_bot") {
- client.action('klay4_', "Benvenuto " + username);
- }
- }
- function text_to_speach (channel, userstate, message, self) {
- if (userstate.mod == true) {
- console.log("[MOD] " + userstate["display-name"] + " ha detto " + message);
- }
- else
- {
- console.log(userstate["display-name"] + " ha detto " + message);
- }
- }
- function info (channel, userstate, message, self) {
- if (self) return;
- if (message === "!steam") {
- client.action('klay4_', "https://steamcommunity.com/id/Klay4_/");
- }
- else if (message === "!twitch") {
- client.action('klay4_', "https://www.twitch.tv/klay4_");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement