use env var

This commit is contained in:
Joonas 2023-01-31 18:20:38 +02:00
parent 8bb96f9bd1
commit 371e1eb1d6
1 changed files with 4 additions and 16 deletions

View File

@ -3,25 +3,14 @@ import {
ChatClient,
SlowModeRateLimiter,
} from "dank-twitch-irc";
import fetch from "node-fetch";
let client = new ChatClient({
username: process.env.TWITCH_NAME,
username: process.env.TWITCH_USERNAME,
password: process.env.TWITCH_PASSWORD,
rateLimits: "verifiedBot",
maxChannelCountPerConnection: 100,
connectionRateLimits: {
parallelConnections: 20,
releaseTime: 300,
},
connection: {
type: "websocket",
secure: true,
},
ignoreUnhandledPromiseRejections: true,
});
client.use(new SlowModeRateLimiter(client));
@ -35,13 +24,12 @@ client.on("close", async (error) => {
});
client.on("PRIVMSG", async (msg) => {
if (msg.senderUsername === "juuuuuuuuuunas") return;
if (msg.senderUsername === process.env.TWITCH_USERNAME) return;
const splitted = msg.messageText.split(" ");
if (splitted[1] === "") {
splitted.splice(1, 1);
}
console.log(splitted);
if (splitted[0] === "%") {
switch (splitted[1]) {
@ -148,4 +136,4 @@ client.on("PRIVMSG", async (msg) => {
});
client.connect();
client.join("juuuuuuuuuunas");
client.join(process.env.TWITCH_USERNAME);