Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Installation Guide

Pudding edited this page Feb 9, 2015 · 11 revisions

To create your own @_dbooks bot, you'll need a browser that can load multiple tabs (or windows, at least) and some kind of text editor. My guide won't walk you through the entire process of creating a bot step by step, but it should be enough for you to figure it out! If you still need help, feel free to let me know on Twitter!

Heroku

Deployment

Deploy to Heroku

App Name

As the page states, this is completely optional. It doesn't matter what you type here, as long as it isn't already taken. I could be wrong, but I don't think anyone will be able to see this unless you show them. you can change it later.

Region

This is where Heroku will host your app. I don't know much about this, but I don't think it really makes much of a difference.

Env: DBOOKS

This is where your bot's settings will go! You might notice that this is a rather small box, and you do have quite some stuff you'll be typing into it, so you might want to use a text editor to type up all of your settings first. Most of this guide is about important %tags you'll need to (or at least want to) set, so skip down to read it, then come back to learn how to launch your bot!

Launch

Edit Dynos

Head over to your app's Heroku control panel. If you just finished creating your app, you can get there by clicking "make your first edit." Then ensure you're on your app's "Resources" tab.

Click "Edit" to edit your dynos, set your app's worker dyno to 1X:1, and then save.

Saving Dyno Settings

Your bot should start.

%tags

@_dbooks bots are configured entirely through %tags. They're space-separated words starting in % that look something like this:

%tag1:a %tag2:fancy %tag3:bot

There are two places where they can go.

  • Your DBOOKS environment variable. This is what you set when you create your bot. You can also find it later in your app's Heroku control panel. You should use this variable for %tags that you won't change often or tags that you would want to keep secret, like your Twitter and Danbooru account details.

  • Your bot's Twitter profile. Just add @_dbooks to the end of your bot's Twitter profile, and add in %tags behind it. Any changes you need will just work right away when your bot is running, so you don't need to wait for your bot to restart or anything!

There are two types of %tags you'll be putting into these settings. The first type are simply called %tags, and their format is pretty simple:

%name

These tags are true/false settings, and they pretty much work like a checkbox on a form. If you put them into your settings, it's like you're turning on that setting. If you leave it out, you're turning it off.

The other type of tags are %metatags, and they have colons in them. They take this format:

%name:value

Not all settings can be expressed with just true/false, or yes/no settings. Sometimes, you'll need to give extra information. That's where %metatags come in. Just like normal %tags, they have a name, but they also have a colon and a value that follows it.

Here's a simple example of how tags work:

%owner:stawbewwi %no_deleted %every:9m

This would set your bot's %owner setting to stawbewwi, turn on its %no_deleted setting, and set its %every setting to 9m. Note that these didn't have to be any particular order. They could have been in any order and still worked.

Twitter

First, you should make a new Twitter account for your new bot if you haven't already. It wouldn't be a very good idea to have your Twitter bot tweet from your own Twitter account, because you might end up in little tweeting wars fighting over who gets to tweet!

Next, head over to Twitter's Apps site, log in if you need to, and ensure that you're logged into your bot's Twitter account by glancing at your super cute/pretty/cool/whatever avatar in your browser window's top right.

Next, create a new app (or find an existing one). Don't worry too much about what you put into those boxes, because they're mainly for apps that are for other people to use. You're just making an app for a bot to use. For example, if you don't have a Website to type into Website, just type in http://twitter.com/.

You should end up on your new Twitter App's Details page. Head over to its "Permissions" tab. Go ahead and set it to "Read, Write, and Access direct messages," to give your app lotsa permissions. That's one of the reasons why you should have made a new account for your bot! Make sure you save your settings. Your bot can't do anything if it can only read timelines!

Twitter Permissions

Now head over to your app's "Keys and Access Tokens" tab. You should see two rows of random characters that you can use to fill out part of your Heroku deployment form now! Just copy your Consumer Key and Secret and use them to fill out %twitter_key: and %twitter_secret:, in your settings.

Scroll down a bit to "Your Access Token" and click "Create my Access Token" if you need to. Ensure that your "Access Level" says that your app can write (at least), and then copy your Access Token and Secret over to %twitter_token and %twitter_token_secret, respectively! If your access token does not have a write access level, you'll need to make sure your permissions are set correctly, and then click on "Regenerate My Access Token and Token Secret" to update your access token.

Note that you can't just edit your app's permissions. You also need to regenerate your access token afterward. If this wasn't the case, then bad guys could ask you to allow their apps to read your tweets, and then once you do so, they can secretly change their apps to be able to tweet on your behalf. You wouldn't want that!

Twitter Settings

Image Catalog

@_dbooks was made with Danbooru in mind, but it also has some limited support for Gelbooru and websites based on its APIs (like Safebooru). You can't use both at the same time (though you can switch at any time by editing your bot's profile).

  • Danbooru

    • The site @_dbooks was built for
    • More powerful search metatags
    • Enabled by default
    • Only supports a limited number of tags per search
    • API request limit
  • Gelbooru API

    • Is also safebooru's api
    • Unlimited search tags
    • Unlimited API requests (as far as I know)
    • Tweet output isn't as polished

Danbooru

If you don't want to log in and you're okay with only being able to search for two tags, you're done!

Being logged in is entirely optional, but even basic accounts have a greatly increased API request cap over non-logged in accounts! Basically, for your image tweeting bot to work, it'll have to go and look at Danbooru a lot (multiple times just to tweet one picture). Each time it looks at Danbooru, it uses up one "request." If your bot looks at Danbooru too many times in a really short timeframe, Danbooru will get embarrassed and refuse to let your bot look at it any more for a while! If you have an account, though, Danbooru will feel more familiar around your bot and be glad to let it look at it more!

After you sign up for Danbooru, just set %danbooru_login: to your login name and then head over to your profile. You'll find your "API Key" somewhere on there, and then you can set %danbooru_api_key: to match it!

Oh, and just in case you might use your account more later on, you might want to remember not to use the same login name on Danbooru as you do elsewhere, unless you're an exhibitionist!

Gelbooru

If you know a site that uses Gelbooru's api, just set %gelbooru: to its homepage (root directory, without a file name). You don't need to include http:// (but you would need to include https://). It should look like like %gelbooru:gelbooru.com or %gelbooru:safebooru.org.

Claim your bot

Set your bot's %owner: to your twitter username or id number, and your bot will send you information via DMs! You'll also be able to send messages to it via DMs to tell it to do various things, and you can include the %errors %tag (note that it doesn't use a colon or a value) to receive error notifications via DMs as well.

Tags

Finally, you set your search parameters by just including them with your %tags, without a % in front of them!

Clone this wiki locally