Skip to content

Instantly share code, notes, and snippets.

@artulloss
Last active January 13, 2022 02:18
Show Gist options
  • Save artulloss/1db91a0dd78628c85f9a5233c675d375 to your computer and use it in GitHub Desktop.
Save artulloss/1db91a0dd78628c85f9a5233c675d375 to your computer and use it in GitHub Desktop.
Spam Jokes in discord server chat for grinding unbelievaboat money. This shouldn't be detectable / it's not a self bot. Requires selenium.
const {Builder, By, Key, until, Origin} = require('selenium-webdriver');
const JokeAPI = require('sv443-joke-api');
const url = "https://discord.com/channels/708291410612322345/708293571236593725"; // Page to load
const channelTitle = "💬・chat" // Do document.title on the page in browser
const random = (length = 8) => {
return Math.random().toString(16).substr(2, length);
};
(async function example() {
let driver = await new Builder().forBrowser('chrome').build();
await driver.manage().window().setRect({ width: 850, height: 500 })
try {
await driver.get(url);
// Sign in via QR code here
await driver.wait(until.titleIs(channelTitle), 30000, 'Timed out after 30 seconds', 1000);
console.log("Logged in successfully...");
async function after(message = null) {
let nextTime = null;
try {
const messageBox = await driver.findElement(By.xpath("/html/body/div[1]/div[2]/div/div[2]/div/div/div/div[2]/div[3]/div[2]/main/form/div/div/div/div[1]/div/div[3]/div[2]/div"));
// let message = random(~~(Math.random * 10) + 5); // To spam random crap instead of jokes
if(message === null && ~~(Math.random() * 25) === 5) {
message = "^dep all";
}
if(message === null) {
let response = await JokeAPI.getJokes();
response = await response.json();
if(response.type === "single") {
message = response.joke;
} else if(response.type === "twopart") {
message = response.setup;
nextTime = response.delivery;
}
}
message = message.replace(/(?:\r\n|\r|\n)/g, ' ');
await messageBox.sendKeys(message);
await messageBox.sendKeys(Key.ENTER);
} catch(e) {
console.log(e);
await driver.sleep((Math.random() * 1000 * 10) + 60 * 1000);
after();
return;
}
await driver.sleep((Math.random() * 3000) + 2000);
after(nextTime);
}
after();
} catch {
await driver.quit(); // Quit gracefully
}
})();
{
"name": "idle-unbelievaboat-money",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"selenium-webdriver": "^4.1.0",
"sv443-joke-api": "^0.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment