This repository was archived by the owner on Jul 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
109 lines (90 loc) · 3.81 KB
/
bot.js
File metadata and controls
109 lines (90 loc) · 3.81 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
`use strict`;
const { ChatClient, AlternateMessageModifier } = require(`@kararty/dank-twitch-irc`);
const config = require(`./config`);
const client = new ChatClient(config.opts);
const talkedRecently = new Set();
const pajladaID = `11148817`;
let pajbotAnnounce = false;
client.use(new AlternateMessageModifier(client));
client.on(`ready`, () => console.log(`Successfully connected to chat`));
client.on(`close`, (error) => {
if (error !== null) {
console.error(`Client closed due to error`, error);
}
});
client.on(`PRIVMSG`, (msg) => {
console.log(`[#${msg.channelName}] ${msg.displayName}: ${msg.messageText}`);
// Ignore all messages from itself
if (msg.senderUserID === config.botID) {
return;
};
const prefixExists = msg.messageText.startsWith(config.prefix); // Check if prefix exists at start of message
const stripPrefix = msg.messageText.substring(1); // Strip the prefix from the message
const msgText = msg.messageText.toLowerCase(); // Convert message to lowercase
let cooldown = config.defaultCooldown;
if (talkedRecently.has(msg.senderUserID) && !(msg.senderUserID === config.ownerID)) {
return;
} else {
// Commands without prefixes
// 82008718 = pajbot
if (msg.senderUserID === `82008718` && msgText === `pajas 🚨 alert` && msg.channelID === pajladaID) {
client.me(msg.channelName, `PAJAS 🚨 CUNTS`);
};
if (msg.senderUserID === `82008718` && msgText.startsWith(`/announce`)) {
pajbotAnnounce = true;
setTimeout(function () {
pajbotAnnounce = false;
}, 5*1000);
};
// 170141236 = SonnenBrot
if (msg.senderUserID === `170141236` && msgText.startsWith(`/announce`)) {
if (pajbotAnnounce) {
let announceMessages = [`gopherDeadlock`, `/announce ℱ FeelsOkayMan`];
let announceResponse = announceMessages[Math.floor(Math.random()*announceMessages.length)];
client.say(msg.channelName, `${announceResponse}`)
};
};
// 477589350 = slchbot
if (msg.senderUserID === `477589350` && msgText === `pepegasit nevermind`) {
client.say(msg.channelName, `alazymDank Slapp slchbot`)
};
if (msg.senderUserID === `477589350` && msgText === `pepea pajbot`) {
client.say(msg.channelName, `monkaS it's coming`)
};
if (msgText.includes(`feelsokaybot`) && msg.channelID === pajladaID) {
client.say(msg.channelName, `pajaBing`);
};
if (msgText.split(" ")[0] === `test` && (msg.channelID === pajladaID || msg.channelID === config.ownerID)) {
client.say(msg.channelName, `KKarrot test complete KKarrot`)
};
// Commands with prefixes
if (prefixExists) {
const noPrefix = stripPrefix.toLowerCase(); // Take the stripped message and convert to lowercase
const command = noPrefix.split(/\s+/)[0]; // Take the command name
const noCommand = noPrefix.split(/\s+/).slice(1); // Remove the command
if (command === `ping`) {
client.reply(msg.channelName, msg.messageID, `alazymDank 🏓 alazymHop 🏓 MrDestructoid`);
};
if (command === `echo` && msg.senderUserID === config.ownerID) {
client.say(msg.channelName, stripPrefix.replace(/^echo/gi,``));
};
if (command == `pong`) {
client.reply(msg.channelName, msg.messageID, `No pong 😡`)
};
if (command == `st` || command == `smartraveller`) {
client.reply(msg.channelName, msg.messageID, `https://www.smartraveller.gov.au/destinations/${noCommand.join('-')}`)
};
};
// User is now in 5 second bot timeout
talkedRecently.add(msg.senderUserID);
setTimeout(() => {
// Removes the user from the set after 5 seconds
talkedRecently.delete(msg.senderUserID);
}, cooldown);
};
});
client.on(`connect`, () => {
client.say(config.startupChannel, `Walking!`)
});
client.connect();
client.joinAll(config.channels);