├── .gitignore ├── utils ├── types.js └── sig.js ├── package.json ├── index.js ├── README.md ├── LICENSE.md └── discord.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | -------------------------------------------------------------------------------- /utils/types.js: -------------------------------------------------------------------------------- 1 | const types = (type, input) => { 2 | if (typeof input !== type) throw new Error(`[AUTO TYPER ERROR] ${input} must be a ${type}, you provided a ${typeof input}`); 3 | } 4 | 5 | module.exports = { types } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jsautomation", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "chalk": "^4.1.0", 14 | "puppeteer": "^5.2.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const dc = require('./discord'); 2 | const { sig } = require("./utils/sig"); 3 | 4 | (async () => { 5 | sig(); 6 | 7 | await dc.initialize(); 8 | // here is where you enter your email and password 9 | await dc.login('email', 'password') 10 | 11 | await dc.likeChannelProcess('server id', 'channel id', 1) // 1 = 1 minute 12 | 13 | debugger; 14 | 15 | })(); 16 | -------------------------------------------------------------------------------- /utils/sig.js: -------------------------------------------------------------------------------- 1 | const chalk = require('chalk'); 2 | const sig = () => console.log(chalk.hex('#E7A3A9')(` 3 | ███████╗███████╗██╗ ██╗ 4 | ██╔════╝██╔════╝██║ ██║ 5 | ███████╗█████╗ ██║ ██║ 6 | ╚════██║██╔══╝ ██║ ██║ 7 | ███████║███████╗███████╗███████╗ 8 | ╚══════╝╚══════╝╚══════╝╚══════╝ 9 | `)) 10 | 11 | module.exports = {sig} 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Discord Auto Typer 2 | 3 | made with js 💛 && star repo 🌟 if you like 4 | 5 | Full example of it logging it and running in background! 6 | 7 | 8 | runs in background on chromium, so you can use discord app and it won't interrupt with your typing! 9 | 10 | It logs last message it sent and at what time, also logs the time it was sent at. 11 | 12 | 13 | After Installation: 14 | 15 | ``` 16 | npm i 17 | ``` 18 | 19 | Then... 20 | ``` 21 | edit index.js to add your username and password 22 | 23 | edit discord.js 24 | edit words array to put custom words 25 | put the channel link of the server you want program typing it 26 | scroll all the way down and customize the time (inital is 3 minutes) 27 | ``` 28 | Then run it 29 | ``` 30 | node . 31 | ``` 32 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 - Sell / jayson.codes / https://github.com/sell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /discord.js: -------------------------------------------------------------------------------- 1 | const puppeteer = require('puppeteer'); 2 | const {types} = require("./utils/types"); 3 | 4 | // list all the words here, will pick them randomly, doesn't matter how many! 5 | const words = [ 6 | "hey", 7 | "hello", 8 | "test", 9 | "sell", 10 | "jay", 11 | "javascript", 12 | ] 13 | let logCount = 0; 14 | 15 | const BASE_URL = 'https://discord.com'; 16 | // change this & enter the channel url 17 | const discord = { 18 | browser: null, 19 | page: null, 20 | 21 | initialize: async () => { 22 | 23 | discord.browser = await puppeteer.launch({ 24 | headless: false, 25 | defaultViewport: null, 26 | args: [ 27 | '--start-maximized' 28 | ] 29 | }); 30 | 31 | discord.page = await discord.browser.newPage(); 32 | 33 | }, 34 | 35 | /** 36 | * username and password 37 | * @param {string} username 38 | * @param {string} password 39 | * @return {Promise} 40 | */ 41 | 42 | login: async (username, password) => { 43 | 44 | await discord.page.goto(BASE_URL, { 45 | waitUntil: 'networkidle2' 46 | }) 47 | 48 | let loginButton = await discord.page.$x('//a[contains(., "Login")]'); 49 | await discord.page.waitFor(5000) 50 | /* Click on login url button */ 51 | await loginButton[1].click(); 52 | 53 | await discord.page.waitForNavigation({ 54 | waitUntil: 'networkidle2' 55 | }) 56 | 57 | await discord.page.waitFor(100); 58 | 59 | /* username and password */ 60 | 61 | await discord.page.type('input[name="email"]', username, { 62 | delay: 100 63 | }); 64 | 65 | await discord.page.type('input[name="password"]', password, { 66 | delay: 110 67 | }); 68 | 69 | /* clicking on login button */ 70 | 71 | loginButton = await discord.page.$x('//div[contains(text(), "Login")]'); 72 | await loginButton[0].click(); 73 | 74 | await discord.page.waitFor(10000); 75 | await discord.page.waitFor('//div[contains(text(), "Friends")]') 76 | 77 | }, 78 | 79 | 80 | /** 81 | * Enter server id and channel urk 82 | * @param { string } serverID 83 | * @param { string } channelID 84 | * @param { number } delay 85 | * @return {Promise} 86 | */ 87 | 88 | likeChannelProcess: async (serverID, channelID, delay= 1) => { 89 | types('string', serverID); 90 | types('string', channelID); 91 | const CHANNELS_URL = `https://discord.com/channels/${serverID}/${channelID}` 92 | 93 | await discord.page.goto(CHANNELS_URL, { 94 | 95 | }); 96 | await discord.page.waitFor(10000); 97 | 98 | async function initalStart () { 99 | await discord.page.type('span[data-slate-object="text"]', "auto typer started.", { 100 | delay: 100 101 | }); 102 | 103 | await discord.page.keyboard.press('Enter') 104 | 105 | console.debug('Auto typer started ' + new Date() ) 106 | 107 | } 108 | 109 | await initalStart(); 110 | 111 | 112 | async function randomWord () { 113 | const random = words[Math.floor(Math.random() * words.length)] 114 | await discord.page.type('span[data-slate-object="text"]', random, { 115 | delay: 100 116 | }); 117 | 118 | await discord.page.keyboard.press('Enter') 119 | 120 | logCount++ 121 | 122 | // this logs the time the message was sent at and the total message count 123 | console.debug('Message sent: ' + random + ' , at: ' + new Date() + ', Message Count: ' + logCount ) 124 | } 125 | 126 | // change the first number for minutes 127 | // 3 * 60 * 1000 = 180000ms === 3 minutes 128 | setInterval(randomWord, delay * 60 * 1000) 129 | 130 | } 131 | } 132 | 133 | module.exports = discord; 134 | --------------------------------------------------------------------------------