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

Lol :joy: :joy: (the quick brown fox jumps over the lazy dog to reach the 20 character limit)

Hi there @ihack2712!
Maybe you should set up Puppeteer to read posts too and more interaction so the bot can get Regular on the forum and can rename, etc. Would love for it to be a moderator so that it can look official/like it’s a bot.

That would be very difficult, which is why I’m hoping Glitch will give me an API key with permissions to do some stuff like a regular can, that way it can look more official and more welcoming.

If I get and API key it will be A LOT easier to continue developing the bot, and I will actually take the time to write clean code with pipelines and so on, so everything can be open-source and look beautiful.

1 Like

@EddiesTech or @ihack2712 one of you guys need to change the title to Mega thread

Just sent an email to @glitch_support so they will hopefully give us permission :slight_smile:
Email body: https://pastebin.com/hSRQ6jDZ
Eddie

1 Like

Ouh oh!! What about making the bot automatically adding [mega-thread]

4 Likes

Cool! I will send an email as well explaining a couple of things and ask about some sort of collaboration on this.

1 Like

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