├── .gitignore ├── Dockerfile ├── docker-compose.yml ├── config.example.js ├── package.json ├── lurker.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directories 2 | node_modules/ 3 | 4 | # Private configuration 5 | config.js 6 | 7 | # Other 8 | .directory 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine 2 | 3 | WORKDIR /usr/src/app 4 | COPY package*.json ./ 5 | RUN npm ci 6 | COPY . . 7 | 8 | CMD ["node", "lurker.js"] -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | 3 | services: 4 | lurker: 5 | build: 6 | context: "." 7 | restart: unless-stopped 8 | volumes: 9 | - "./config.js:/usr/src/app/config.js:ro" 10 | -------------------------------------------------------------------------------- /config.example.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | username: "", 3 | token: "", 4 | channels: [ 5 | "", 6 | "", 7 | "" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "twitch-lurker-bot", 3 | "version": "1.0.2", 4 | "description": "A simple Twitch.tv chat lurker bot", 5 | "author": "bartosjiri ", 6 | "license": "ISC", 7 | "main": "lurker.js", 8 | "scripts": { 9 | "start": "node lurker.js" 10 | }, 11 | "keywords": [ 12 | "twitch", 13 | "twitch.tv", 14 | "stream", 15 | "broadcast", 16 | "channel", 17 | "chat", 18 | "lurker", 19 | "bot", 20 | "tmi" 21 | ], 22 | "dependencies": { 23 | "dateformat": "^4.4.1", 24 | "tmi.js": "1.5.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lurker.js: -------------------------------------------------------------------------------- 1 | const tmi = require("tmi.js"); 2 | const dateFormat = require("dateformat"); 3 | const config = require("./config"); 4 | 5 | const {username, token, channels} = config 6 | 7 | if (!username) { 8 | console.error("[ERROR] You need to provide a username!"); 9 | return; 10 | } 11 | 12 | if (!token) { 13 | console.error("[ERROR] You need to provide a client token!"); 14 | return; 15 | } 16 | 17 | if (!channels || channels.length < 1) { 18 | console.error("[ERROR] You need to provide at least one channel!"); 19 | return; 20 | } 21 | 22 | const user = username.toLowerCase(); 23 | 24 | const tmiOptions = { 25 | connection: { 26 | reconnect: true, 27 | secure: true 28 | }, 29 | identity: { 30 | username: user, 31 | password: token 32 | }, 33 | channels: channels 34 | } 35 | 36 | const getCurrentTime = () => { 37 | const d = new Date(); 38 | return `[${dateFormat(d, "yyyy-mm-dd HH:MM:ss")}]`; 39 | } 40 | 41 | const client = new tmi.client(tmiOptions); 42 | client.connect(); 43 | 44 | client.on("logon", () => { 45 | console.log(`${getCurrentTime()} Connecting to the Twitch server as user "${user}"...`); 46 | }); 47 | 48 | client.on("join", (channel, username) => { 49 | if (username == user) { 50 | console.log(`${getCurrentTime()} Joined channel "${channel.substring(1)}".`); 51 | } 52 | }); 53 | 54 | client.on("subgift", (channel, username, _, recipient) => { 55 | if (recipient.toLowerCase() == user) { 56 | console.log(`${getCurrentTime()} Received a subscription gift from user "${username}" in channel "${channel.substring(1)}"!`); 57 | } 58 | }); 59 | 60 | client.on("reconnect", () => { 61 | console.log(`${getCurrentTime()} Trying to reconnect to the Twitch server...`); 62 | }); 63 | 64 | client.on("part", (channel, username) => { 65 | if (username == user) { 66 | console.log(`${getCurrentTime()} Disconnected from channel "${channel.substring(1)}".`); 67 | } 68 | }); 69 | 70 | client.on("disconnected", (reason) => { 71 | console.log(`${getCurrentTime()} Disconnected from the Twitch server. Reason: "${reason}".`); 72 | }); 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Twitch Lurker Bot 2 | 3 | A simple script to join multiple Twitch.tv channel chats under a user account. 4 | 5 | ## Description 6 | 7 | ### What to use it for 8 | 9 | The primary purpose of this script is to increase your account activity in channels' chat-related actions while not actually watching the stream at the given moment, for example: 10 | 11 | - Increase your chances of receiving a community sub gift 12 | - Gain points in various watchtime-related point systems 13 | - And more... 14 | 15 | ### What to keep in mind 16 | 17 | Even though the script allows you to join a large number of channels, please, consider using it only for channels you would spend your time in nonetheless. Running the script presents you an advantage compared to other regular users, so use it only for channels you actively support and watch. Always be sure to follow Twitch.tv's [Terms of Service](https://www.twitch.tv/p/legal/terms-of-service/). 18 | 19 | ### How it works 20 | 21 | The script is based on [tmi.js](https://github.com/tmijs/tmi.js), a Node.js package for the Twitch Messaging Interface. Once you provide an authorization token to your account and a list of channels, the script joins chat rooms for these channels with your account. It does not connect to the actual stream and therefore it does not count towards the viewer count - usage of this script is not viewer botting. 22 | 23 | ## Instructions 24 | 25 | ### Usage with Docker/Docker Compose 26 | 27 | 1. Install Docker and Docker Compose: 28 | 29 | [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/) 30 | 31 | 2. Clone or download the Twich Lurker Bot script to your desired location: 32 | 33 | ``` 34 | git clone git@github.com:bartosjiri/twitch-lurker-bot.git 35 | ``` 36 | 37 | 3. Obtain the authentication token for your Twitch.tv account: 38 | 39 | [https://twitchapps.com/tmi/](https://twitchapps.com/tmi/) 40 | 41 | 4. Copy the `config.example.js` file as `config.js` and provide your account username, authentication token and list of channels to join. For example: 42 | ``` 43 | module.exports = { 44 | username: "TheBiggestFan123", 45 | token: "oauth:m81v8urm9qwj6ceo0vapfmn8mepj64", 46 | channels: [ 47 | "FamousStreamer", 48 | "PlayerOne", 49 | "FunnyGuy" 50 | ] 51 | }; 52 | ``` 53 | 5. Start up the service: 54 | ``` 55 | docker-compose up --build -d 56 | ``` 57 | 6. See the service logs: 58 | ``` 59 | docker-compose logs -f 60 | ``` 61 | 62 | ### Usage with Node.js 63 | 64 | 1. Download and install Node.js on your machine: 65 | 66 | [https://nodejs.org/en/download/](https://nodejs.org/en/download/) 67 | 68 | 2. Clone or download the Twich Lurker Bot script to your desired location: 69 | 70 | ``` 71 | git clone git@github.com:bartosjiri/twitch-lurker-bot.git 72 | ``` 73 | 74 | 3. Install the script dependencies: 75 | 76 | ``` 77 | npm install 78 | ``` 79 | 80 | 4. Obtain the authentication token for your Twitch.tv account: 81 | 82 | [https://twitchapps.com/tmi/](https://twitchapps.com/tmi/) 83 | 84 | 5. Copy the `config.example.js` file as `config.js` and provide your account username, authentication token and list of channels to join. For example: 85 | 86 | ``` 87 | module.exports = { 88 | username: "TheBiggestFan123", 89 | token: "oauth:m81v8urm9qwj6ceo0vapfmn8mepj64", 90 | channels: [ 91 | "FamousStreamer", 92 | "PlayerOne", 93 | "FunnyGuy" 94 | ] 95 | }; 96 | ``` 97 | 98 | 6. To start the script, navigate to the location of `lurker.js` file and run: 99 | 100 | ``` 101 | node lurker.js 102 | ``` 103 | 104 | _Tip: If you don't want to keep your terminal window open while running the script, you can try running the script in a [detached process](https://www.google.com/search?q=how+to+detach+a+process)._ 105 | 106 | ## Disclaimer 107 | 108 | Use the script at your own risk, the repository owners and/or contributors are not responsible for any actions taken as a result of installing, setting up or running this script. Never share your authentication token with other people or store it at publicly available locations. Always be sure to follow Twitch.tv's [Terms of Service](https://www.twitch.tv/p/legal/terms-of-service/). 109 | --------------------------------------------------------------------------------