forked from coomdev/sango
This branch is 16 commits behind coomdev/sango:中出し
Sango
A 4chan library to post on the site automatically.
Example
Create a thread
import { createReadStream } from "fs";
import { FChan } from "./fchan";
try {
const chan = new FChan();
const boards = await chan.boards; // get board list
const s4sboard = boards['s4s']; // you can iterate over this
const newthread = await s4sboard.createThread({
com: 'ebsolute abin :^)',
filename: 'meme.jpg',
pwd: 'pwd',
file: createReadStream('./meme.jpg')
});
console.log(`Created new thread >>${newthread[1]}`);
} catch (e) {
console.error(e);
}
Reply to a thread
import { FChan } from "./fchan";
try {
const chan = new FChan();
const boards = await chan.boards; // get board list
const s4sboard = boards['s4s']; // you can iterate over this
// note: this will fetch a listing of all threads on the board, if you don't want that, you can directly instanciate a Thread instance
const s4sthreads = await s4sboard.threads; // get all the threads on the board
const s4sthread = s4sthreads['10368829']; // this is iterable again
const repl = await thre.createReply({
com: ">>10369047\nthat's right from her pov",
pwd: 'pwd',
name: '',
email: 'sage',
});
console.log(`Created reply >>${repl[1]} in thread >>${repl[0]}`);
} catch (e) {
console.log(e);
}
Notes
Making a full blown spammer/flooder is left as an exercise to the reader.
Description
Languages
TypeScript
100%