[mega-thread] Automator - A forum bot that responds to domain removal requests (and soon more)

Now I’ve also sent an email (or ticket) to Glitch.

1 Like

Awesome! Hope they get back soon! I think we’ve got a few minutes before they close :joy:

How did you get the dark theme on HappyFox? :thinking:

Dark Reader extension :wink:

3 Likes

Maybe :joy:

But honestly, this is probably something Glitch has to discuss internally whether or not to allow a single forum member to run an unofficial bot and not letting anyone else do the same. I will understand if Glitch denies my request.

2 Likes

Makes sense.

I’m so enjoying this thread, and that would be really cool feature. More than 100 posts = [megathread] {title}!

4 Likes

And there’s so many test threads, might have to clean up a bit.

4 Likes

DB Much? Kinda confused why you got a file for every topic,

The files doesn’t contain any data, it is empty, the file is simply just there to indicate that the topic has been dealt with, or basically telling the program not to interact with that topic ever again.

Here’s the code that uses these files:

api.fs = {};
if (!Fs.existsSync("/topics_")) Fs.mkdirSync("/topics_", {recursive: true});
api.fs.add = id => Fs.writeFileSync("/topics_/" + id, "");
api.fs.has = id => Fs.existsSync("/topics_/" + id);
	const do_a_loop = async () => {
		const topics = (await api.getLatestTopics()).filter(topic => !api.fs.has(topic.id));
		
		for (let i = 0; i < topics.length; i++)
		{
			const t = topics[i];
			const postID = (await api.getTopic(t.id)).post_stream.stream[0];
			const post = await api.getPost(postID);
			t.content = post.raw;
			t.username = post.username;
			
			if (topicContainsDomain(t) && !api.fs.has(t.id))
			{
				try
				{
					await sendDomainMessage(browser, page, t);
					api.fs.add(t.id);
				} catch (error)
				{
					console.log("Failed to deliver domain removal message to %s on topic %s", t.username, t.title);
					console.log(error);
					console.log();
				}
			} else
			{
				api.fs.add(t.id);
			}
		}
	};

@ihack2712 I dont understand why you have 2 threads for @automator

This is the old overpopulated thread, I could probably delete it. I made a second thread which will sorta be a Wiki for Automator, better explaining what it does. This thread was rather meant for discussion regarding how things should be done :wink:

2 Likes