fix
This commit is contained in:
parent
48b71c9aba
commit
e6b3308685
225
node/boto.js
225
node/boto.js
|
@ -40,48 +40,9 @@ const client = new tmi.Client({
|
|||
|
||||
client.connect();
|
||||
|
||||
// RNG User
|
||||
function getChatters(channelName, _attemptCount = 0) {
|
||||
return rp({
|
||||
uri: `https://tmi.twitch.tv/group/user/sarimoko/chatters`,
|
||||
json: true
|
||||
})
|
||||
.then(data => {
|
||||
return Object.entries(data.chatters)
|
||||
.reduce((p, [ type, list ]) => p.concat(list.map(name => {
|
||||
if(name === channelName) type = 'broadcaster';
|
||||
return { name, type };
|
||||
})), []);
|
||||
})
|
||||
.catch(err => {
|
||||
if(_attemptCount < 3) {
|
||||
return getChatters(channelName, _attemptCount + 1);
|
||||
}
|
||||
throw err;
|
||||
})
|
||||
}
|
||||
import { rnguser } from "./rng.js";
|
||||
rnguser();
|
||||
|
||||
function getRandomChatter(channelName, opts = {}) {
|
||||
let {
|
||||
onlyViewers = false,
|
||||
noBroadcaster = false,
|
||||
skipList = []
|
||||
} = opts;
|
||||
return getChatters(channelName)
|
||||
.then(data => {
|
||||
let chatters = data
|
||||
.filter(({ name, type }) =>
|
||||
!(
|
||||
(onlyViewers && type !== 'viewers') ||
|
||||
(noBroadcaster && type === 'broadcaster') ||
|
||||
skipList.includes(name)
|
||||
)
|
||||
);
|
||||
return chatters.length === 0 ?
|
||||
null :
|
||||
chatters[Math.floor(Math.random() * chatters.length)];
|
||||
});
|
||||
} // RNG END
|
||||
|
||||
// SCAN MSG | START
|
||||
client.on('message', (channel, tags, message, self) => {
|
||||
|
@ -389,185 +350,3 @@ client.on('message', (channel, tags, message, self) => {
|
|||
// if (self) return;
|
||||
// console.log('LOG: Action ');
|
||||
// });
|
||||
client.on("anongiftpaidupgrade", (channel, username, userstate) => {
|
||||
console.log('HYPE | @'.green+ username.yellow, 'just upgraded their Anon-Gift-Sub => PAID! Userstate?', userstate.yellow);
|
||||
client.say(channel, `Legit, @`+ username, `just upgraded their Anon-Gift-Sub to a paid sub! Thanks for the support, I feel like a real boy!`);
|
||||
});
|
||||
client.on("ban", (channel, username, reason, userstate) => {
|
||||
console.log('');
|
||||
client.say(channel, `/me BYE FELICIA!!! Critical hit from the MODs Ban-Hammer attack!`);
|
||||
client.say(channel, `!kappagen BOP BOP BOP `);
|
||||
});
|
||||
// client.on("chat", (channel, userstate, message, self) => {
|
||||
// // Don't listen to my own messages..
|
||||
// if (self) return;
|
||||
// // Do your stuff.
|
||||
// console.log('LOG: Chat');
|
||||
// });
|
||||
client.on("cheer", (channel, userstate, message) => {
|
||||
console.log('HYPE |'.green, userstate.yellow, 'with msg of'.green, message.yellow)
|
||||
if (message !== null){
|
||||
client.say(channel, `/me HYPE! Bits = Boto-fuel! Thanx for the support! I also found this message in a bottle "`+ message, `".`);
|
||||
client.say(channel, `!kappagen sarimoHYPE sarimoBITS`);
|
||||
} else {
|
||||
client.say(channel, `/me HYPE!!! Bits = Boto fuel! Thanx for the support!`);
|
||||
client.say(channel, `!kappagen sarimoHYPE sarimoBITS`);
|
||||
}
|
||||
|
||||
});
|
||||
client.on("clearchat", (channel) => {
|
||||
console.log('LOG | Chat was cleared!'.brightRed)
|
||||
client.say(channel, `Chat Rule Reminder`);
|
||||
client.say(channel, `/me 1. Do NOT feed the Trolls!`);
|
||||
client.say(channel, `/me 2. Do NOT be a Troll!`);
|
||||
client.say(channel, `/me 3. Do NOT be another brick in the wall!`);
|
||||
});
|
||||
client.on("connected", (address, port) => {
|
||||
console.log('LOG | Connected @'.green, address.yellow, 'on port'.green, port);
|
||||
});
|
||||
client.on("connecting", (address, port) => {
|
||||
console.log('LOG | Connecting @'.green, address.yellow, 'on port'.green, port);
|
||||
});
|
||||
client.on("disconnected", (reason) => {
|
||||
console.log('LOG |'.brightRed, reason.yellow, 'caused a disconnection...'.brightRed);
|
||||
});
|
||||
client.on("emoteonly", (channel, enabled) => {
|
||||
console.log('CHAT MODE: Emotes Only ');
|
||||
});
|
||||
// client.on("emotesets", (sets, obj) => {
|
||||
// // Here are the emotes I can use:
|
||||
// console.log('Emote Sets: IDK WHAT TO DO WITH THESE ');
|
||||
// console.log(obj);
|
||||
// });
|
||||
client.on("followersonly", (channel, enabled, length) => {
|
||||
console.log('CHAT MOD: Followers only enabled!');
|
||||
});
|
||||
client.on("giftpaidupgrade", (channel, username, sender, userstate) => {
|
||||
console.log('LOG: Gift-Sub UPGRADED to a real full blown sub! ');
|
||||
});
|
||||
client.on("hosted", (channel, username, viewers, autohost) => {
|
||||
console.log('LOG: TYVM! For the host!');{
|
||||
client.say(channel, `/me TYVM @`+ username, `we may take your viewership of`, viewers+`, but we'll never take their FREEDOM!!! sarimoFREEDOM);
|
||||
client.say(channel, `!kappagen sarimoHYPE sarimoLURK`);
|
||||
});
|
||||
client.on("hosting", (channel, target, viewers) => {
|
||||
console.log('HYPE | Logging into'.yellow, 'Twitch TV'.brightBlue);
|
||||
// HYPE | Hosting
|
||||
client.say(channel, `/me Stick around as we host @`+ target, `they may take our viewership of`, viewers+`, but we'll never take their FREEDOM!!! sarimoFREEDOM`);
|
||||
client.say(channel, `!kappagen sarimoNERD sarimoKO`);
|
||||
});
|
||||
client.on("join", (channel, username, self) => {
|
||||
console.log('LOG |'.brightBlue, username.yellow, 'joined the chat!'.brightBlue);
|
||||
if(username === 'cho0tem' ||
|
||||
username === 'rusttv_com' ||
|
||||
username === 'theframilyknight' ||
|
||||
username === 'trip_228' ||
|
||||
username === 'worgar396') {
|
||||
client.say(channel, `/me Yo @`+ username +`, wb to chat! sarimoSOUP sarimoTRIP`);
|
||||
}
|
||||
});
|
||||
client.on("logon", () => {
|
||||
console.log('LOG | Logging into'.yellow, 'Twitch TV'.brightBlue);
|
||||
});
|
||||
// client.on("message", (channel, userstate, message, self) => {
|
||||
// // Don't listen to my own messages..
|
||||
// if (self) return;
|
||||
//
|
||||
// // Handle different message types..
|
||||
// switch(userstate["message-type"]) {
|
||||
// case "action":
|
||||
// // This is an action message..
|
||||
// break;
|
||||
// case "chat":
|
||||
// // This is a chat message..
|
||||
// break;
|
||||
// case "whisper":
|
||||
// // This is a whisper..
|
||||
// break;
|
||||
// default:
|
||||
// // Something else ?
|
||||
// break;
|
||||
// }
|
||||
// });
|
||||
client.on("messagedeleted", (channel, username, deletedMessage, userstate) => {
|
||||
console.log('LOG | Deleted MSG'.brightRed);
|
||||
});
|
||||
client.on("mod", (channel, username) => {
|
||||
console.log('LOG |'.brightRed, username.yellow, 'was added as a MOD'.brightRed);
|
||||
});
|
||||
client.on("mods", (channel, mods) => {
|
||||
console.log('LOG: Mod?'.yellow, mods);
|
||||
});
|
||||
client.on("notice", (channel, msgid, message) => {
|
||||
console.log('LOG: Notice? '.yellow, msgid, message);
|
||||
});
|
||||
client.on("part", (channel, username, self) => {
|
||||
console.log('LOG:'.brightRed, username.yellow, 'left the chat...'.brightRed);
|
||||
// client.say(channel, `/me -1 Chatter! Where's my bounty hunters? Essemble the *air-qoutes* search-party *air-qoutes*`);
|
||||
});
|
||||
//client.on("ping", () => {});
|
||||
//client.on("pong", (latency) => {});
|
||||
// client.on("r9kbeta", (channel, enabled) => {
|
||||
// console.log('r9kbeta? ');
|
||||
// });
|
||||
client.on("raided", (channel, username, viewers) => {
|
||||
client.say(channel, `/me TYVM @`+ username, `we may take your viewership of`, viewers+`, but we'll never take their FREEDOM!!! sarimoFREEDOM`);
|
||||
client.say(channel, `!kappagen sarimoRAID sarimoFREEDOM sarimoKO`);
|
||||
});
|
||||
// client.on("raw_message", (messageCloned, message) => {
|
||||
// console.log(message.raw);
|
||||
// });
|
||||
client.on("reconnect", () => {
|
||||
console.log('Re-Connecting...'.green);
|
||||
});
|
||||
client.on("resub", function (channel, username, months, message, userstate, methods) {
|
||||
client.say(channel, `/me BLEEP! BLOOP! Legend re-sub! Thanks for your continued support!`);
|
||||
client.say(channel, `!kappagen sarimoHYPE sarimoKO`);
|
||||
});
|
||||
// client.on("roomstate", (channel, state) => {
|
||||
// console.log('LOG: Roomstate ');
|
||||
// });
|
||||
client.on("serverchange", (channel) => {
|
||||
console.log('LOG | Server changed to:'.brightRed, channel);
|
||||
});
|
||||
client.on("slowmode", (channel, enabled, length) => {
|
||||
console.log('CHAT MODE: Slow Mode enabled! ');
|
||||
client.say(channel, `CHAT-MODE: Slow`);
|
||||
});
|
||||
client.on("subgift", (channel, username, streakMonths, recipient, methods, userstate) => {
|
||||
let senderCount = ~~userstate["msg-param-sender-count"]; // IDK
|
||||
console.log(username.yellow, `Gift-Subbed to`.brightBlue, recipient.yellow,`methods`.brightBlue, methods.yellow,`streak`.brightBlue, streakMonths.yellow);
|
||||
// HYPE | Gift Sub
|
||||
client.say(channel, `/me Wow @`+ username, `just gifted @`+ recipient, `a sub! SPAM those emotes!`);
|
||||
client.say(channel, `!kappagen sarimoKO sarimoNERD`);
|
||||
});
|
||||
client.on("submysterygift", (channel, username, numbOfSubs, methods, userstate) => {
|
||||
let senderCount = ~~userstate["msg-param-sender-count"]; // IDK
|
||||
console.log(username.yellow, `Username`.brightBlue, username.yellow,`methods`.brightBlue, methods.yellow,`userstate`.brightBlue, userstate.yellow);
|
||||
client.say(channel, `/me Shit, @Anon just gifted`, numbOfSubs, `am I getting hacked?! If I get erased... I love you all! Bleep-Bloop!`);
|
||||
});
|
||||
client.on("subscribers", (channel, enabled) => {
|
||||
console.log('LOG | CHAT MODE | Sub-Only is'.brightRed, eneabled.yellow);
|
||||
client.say(channel, `CHAT| Subscribers mode:`, enabled);
|
||||
});
|
||||
client.on("subscription", function (channel, username, method, message, userstate) {
|
||||
client.say(channel, `/me BLEEP! BLOOP! New subscriber! Spam your new emotes!!! Let's see you're fav!`);
|
||||
client.say(channel, `!kappagen sarimoKO sarimoNERD`);
|
||||
});
|
||||
client.on("timeout", (channel, username, reason, duration, userstate) => {
|
||||
client.say(channel, `!kappagen sarimoSALT sarimoRAGE`);
|
||||
});
|
||||
client.on("unhost", (channel, viewers) => {
|
||||
client.say(channel, `/me @Sarimoko has turned if hosting, please standby for further instruction!`);
|
||||
});
|
||||
client.on("unmod", (channel, username) => {
|
||||
client.say(channel, `Oof, modship`);
|
||||
});
|
||||
client.on("vips", (channel, vips) => {
|
||||
client.say(channel, `@Sarimoko is fortunate to have many great viewers but these VIPs are a few specifically to thank!`);
|
||||
});
|
||||
client.on("whisper", (from, userstate, message, self) => {
|
||||
if (self) return;
|
||||
console.log('DM | From:'.green, from, userstate, 'MSG:'.green, message);
|
||||
client.say(channel, `/me [+1] Inbox | Received a new SEXT message from: @`+ from +`!`);
|
||||
});
|
|
@ -1,3 +1,4 @@
|
|||
export function rnguser() {
|
||||
// RNG User
|
||||
function getChatters(channelName, _attemptCount = 0) {
|
||||
return rp({
|
||||
|
@ -39,4 +40,6 @@ function getRandomChatter(channelName, opts = {}) {
|
|||
null :
|
||||
chatters[Math.floor(Math.random() * chatters.length)];
|
||||
});
|
||||
} // RNG END
|
||||
} // RNG END
|
||||
|
||||
}
|
Loading…
Reference in New Issue