Auto-Responder for (inappropriate) Cheetah Comments

mkt(66)
Published in
#utopian-io
Words
385
Reading
2 min
Listen
Play
8y

image.png

Repository

https://github.com/mktcode/cheetah-cmon

This post is more fun than a serious development contribution but hey... maybe someone is in a similar situation and wants to use it.

The situation is the following: the-magic-frog@the-magic-frog (as well as der-zauberfrosch@der-zauberfrosch and grenouille@grenouille) publishes a post everyday, containing a story that evolves with every post. So the posts are more or less identical, except that everyday a new short part is added. That's simply how the project it works. You can also read the story on the website.

I won't explain the whole project here now. To learn more about it go to the-magic-frog.com.

The reason for this contribution is that cheetah@cheetah often times comments on posts that are not at all plagiarism, which starts to become a little bit annoying now, in my case.

So at a certain point of progress cheetah@cheetah considers each post to be copied from the website or an earlier post.

Examples:

image.png

image.png

I commented multiple times and asked to whitelist those accounts. Unfortunately there hasn't been any reaction so far. So I automated this task with this little auto-responder.

image.png

The Code

At first the code was specific for The Magic Frog project. This is now the master branch.
https://github.com/mktcode/cheetah-cmon/blob/master/index.js

It handles all the frog accounts in one script but I thought that maybe someone else can need this little helper too, so I opened a new branch with a general purpose version.
https://github.com/mktcode/cheetah-cmon/blob/general-purpose/index.js

The script looks for the latest post of a given account and then looks for a comment from cheetah@cheetah. If there is one and the given account has not yet replied to that comment, the script does that, based an a template that you must provide.

How to use

Node.js must be installed an then do the following:

git clone https://github.com/mktcode/cheetah-cmon.git
cd cheetah-cmon
git checkout general-purpose
npm i
export POSTING_KEY=...
export ACCOUNT=...

ACCOUNT is of course the account that the bot should watch and look for a cheetah@cheetah comment to reply to.

POSTING_KEY is the posting key of that account, so the bot can post the reply.

Now create a comment.md in the root directory of the project. In this file you put your comment, that you want to be automatically published whenever cheetah@cheetah comments on your latest post.

comment.md:

Dear @cheetah,

please consider whitelisting my account...

Cronjob

The cronjob can look like this:

# run every hour
0 * * * * . /home/<user>/cheetah-cmon.conf; /usr/local/bin/node /home/<user>/cheetah-cmon/index.js >> /home/<user>/cheetah-cmon/cheetah-cmon.log

/home/<user>/cheetah-cmon.conf:

export POSTING_KEY=...
export ACCOUNT=...

Roadmap

  • Automatically down- or upvote cheetah@cheetah's comment :P

Contribute

Simply submit a PR but please only on the general-purpose branch. ;)

Auto-Responder for (inappropriate) Cheetah Comments | Ecency