logicplace / TumbleWeed-Discord

Discord bot to share tumblr searches automatically
2 stars 3 forks source link

TumbleWeed

NOTE (2019-03-19): This bot is trash and is causing me problems. I'm not going to put it back up until I remake it better, which may be never. Feel free to self-host, though.

It's a Discord bot that tells you the latest from social media!

Have it follow certain people or whatever and share the link in a channel of your choice.

It currently supports Tumblr and Twitter.

How to use this bot

When it joins your server for the first time it will create two new roles: TumbleWeed Admin and TumbleWeed Content Provider. You may rename these if you want.

The bot will check for updates every 10 minutes and saves its data every hour (also when you close it).

Unrestricted commands

Admin commands

Content Provider commands

Tumblr

Tumblr following is done by scanning specific blogs for new posts. If tags are supplied, it will filter those posts by the given tags.

In the commands, BlogName is the blog's username (the part in the URL). And Tags refers to a tagset system such that each tag set is separated by spaces and each tag within a tagset is separated by commas. Negations are indicated by a ! preceeding the #. # is optional.

Thus #hi,#there,!#jerk #puppies follows two tagsets and thus two types of posts for this blog. All posts that contain both the tags #hi and #there and do not contain #jerk will be relayed, also all the posts with the tag #puppies will be relayed (regardless of it containing #hi, #there, or #jerk tags). In that way you can think of commas as "and" operations and spaces as "or" operations.

If a tag itself contains a space, you may use double quotes to quote the entire tagset.

Twitter

Twitter follows given searches instead of blogs. You are limited on the complexity of these searches by the API, however the bot will not tell you.

You can find the search syntax here.

Sometimes, despite using "from:" syntax, it seems to return some wrong statuses. This was particularly true when I used "filter:images". Thus, I have implemented a software workaround for filter:images to make it work. There's nothing special you need to know about it, though (you may type filter:images as normal). But, if it's sharing wrong statuses, it may be the API.

Since searches are complex, I didn't provide a URL version of unfollow for it. However, you may use tw!twitter list to see a list of searches active in this channel with numerical indexes provided, then you may unfollow by using those.

Invite to your server

You can use this link to invite it.

NOTE (2019-03-19): This bot is trash and is causing me problems. I'm not going to put it back up until I remake it better, which may be never. Feel free to self-host, though.

It will try to create custom roles for permissions. If denied, then it will go off of user permissions:

However, if you want a custom avatar or want to avoid rate limiting (on the social media sites) you'll need to run your own.

How to run your own

  1. Clone the repo.
  2. Make the memory directory. (TODO: Automate this)
  3. Install the dependencies.
  4. Copy the settings.
  5. Add your OAuth info and Discord Bot token to your settings file.
  6. Run the bot.

As a shell script:

git clone -b release https://github.com/logicplace/TumbleWeed-Discord
mkdir memory
npm install
cp settings-example.json settings.json
vim settings.json
node tumbleweed.js

Get Tumblr OAuth keys

You may go here to register a new application.

You can put anything for the Default callback URL. TumbleWeed's is http://tumbleweed.logicplace.com/tumblr/auth

I suggest something ugly for the name.

Afterwards, the new application will appear in your list. Put its "OAuth Consumer Key" in tumblr.oauth.consumer_key and click "show secret key" to reveal the "Secret Key" and put it in tumblr.oauth.consumer_secret

Get Twitter OAuth keys

You may go here to create a new application.

You can put anything for the website. TumbleWeed's is http://tumbleweed.logicplace.com

I suggest something ugly for the name.

Afterwards, go to the Keys and Access Tokens tab of the new application. Put the "Consumer Key (API Key)" in twitter.oauth.consumer_key and the "Consumer Secret (API Secret)" into twitter.oauth.consumer_secret

Create a Discord bot

You may go here to create a new app.

You must add a redirect URI but you can put anything for it. TumbleWeed's is http://tumbleweed.logicplace.com/discord/auth

Put your custom avatar as the App Icon.

Afterwards, select to add a bot to this. Reveal its token to put in the settings under discord.token