48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import puppeteer from "puppeteer-extra";
|
|
import StealthPlugin from "puppeteer-extra-plugin-stealth";
|
|
import { Client as DiscordClient } from "discord.js-selfbot-v13";
|
|
import fs from "fs";
|
|
|
|
puppeteer.use(StealthPlugin());
|
|
|
|
const DISCORD_TOKEN = process.env.USER_TOKEN;
|
|
|
|
(async () => {
|
|
const browser = await puppeteer.launch({
|
|
executablePath: "/usr/bin/discord", // <-- Add this executable path
|
|
headless: false,
|
|
args: [
|
|
"--no-sandbox",
|
|
"--disable-setuid-sandbox",
|
|
"--disable-dev-shm-usage",
|
|
"--start-maximized",
|
|
],
|
|
defaultViewport: null,
|
|
});
|
|
|
|
const [page] = await browser.pages();
|
|
console.log("Puppeteer has attached to Discord's browser.");
|
|
|
|
const client = new DiscordClient({ checkUpdate: false });
|
|
client.login(DISCORD_TOKEN);
|
|
|
|
client.once("ready", () => {
|
|
console.log(`Selfbot ready as ${client.user.tag} (${client.user.id})`);
|
|
});
|
|
|
|
client.on("messageCreate", (msg) => {
|
|
if (msg.author.id === client.user.id) return;
|
|
console.log(`[#${msg.channel.name}] ${msg.author.tag}: ${msg.content}`);
|
|
takeScreenshot();
|
|
});
|
|
|
|
async function takeScreenshot() {
|
|
await page.screenshot({ path: "/tmp/output/last.png" });
|
|
console.log("Took a screenshot, saved to /tmp/output/last.png");
|
|
}
|
|
|
|
process.on("SIGTERM", async () => {
|
|
await browser.close();
|
|
process.exit(0);
|
|
});
|
|
})();
|