Auto-Responder for (inappropriate) Cheetah Comments

in #utopian-io6 years ago (edited)


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 (as well as @der-zauberfrosch and @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 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 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. 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 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 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's comment :P

Contribute

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

Sort:  

Thank you for your contribution. I feel like the template comments tend to get downvotes unless they are useful. Well, maybe @wang disagrees that... Anyway, good luck with that.

The other small thing is that you use c.body.startsWith('Dear @cheetah') to check if a comment has been posted but this surely doesn't work if you some day decide to change the comment body.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you @justyy! The code you quoted is only in the master branch. The general purpose version does not contain this.

Hey @mkt
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

hi @mkt Thanks for sharing valuable information.

Nice option and work to manage @cheetah's comment automatically ! I was wondering is it is safe to import our account keys to this script .. any suggestions or risks we need to consider ?

Your account's key should never be contained in the code itself. You can set the key as an environment variable on your machine or server. In this case this is the line that gets the key from the environment: https://github.com/mktcode/cheetah-cmon/blob/general-purpose/index.js#L5

Great ! Thanks for clarification ! I hope your work will be useful for many !

Hopefully @cheetah's creator should improve the bot !

Cheers

I hope so too but unfortunately he seems to be inactive for some weeks now... we'll see.

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 3 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 16 SBD worth and should receive 78 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70797.92
ETH 3553.00
USDT 1.00
SBD 4.76