Skip to content

BytewaveMLP/Randibooru.js

Repository files navigation

Randibooru.js

Discord Bots Discord chat

A Node.js port of Randibooru

Randibooru is a simple bot which allows users to fetch images from the Derpibooru MLP:FIM image board.

Randibooru.js is my first experiment in Node.js. My goal is to attempt to port Randibooru, my old Python-based Discord bot, to discord.js on Node.

Table of Contents

Install

Prerequisites

  • Node.js (tested on v8.2.1)

Installation

$ npm install # Install all dependencies
$ cp config.example.json config.json # Create a local config
$ $EDITOR config.json # Add your config options here
### NOTE: We assume your derpiAPIKey points to an account with the Everything filter set. If not, the bot will still work, but replies may be incorrect in terms of the amount of images matching a given query.
$ node . # Run the bot

If you don't want to set up Randibooru yourself, feel free to invite the public version of Randibooru to a server of your choice.

Discord Bots

Usage

Information about the bot can be found by using the help and info commands. All commands should be prefixed with !rb or a mention to the bot. A brief summary of some of the features may be found below.

Users

While the name implies randomness, Randi has evolved beyond simple random image fetching. Currently, Randibooru supports 4 Derpibooru image-fetching commands:

Commands

  • first: Fetches the first image uploaded to Derpibooru matching the given query
  • latest: Fetches the most recent image uploaded to Derpibooru matching the query
  • random: Fetches a random image matching the given query
  • top: Fetches the highest-rated image matching the given query

All queries are passed directly to Derpibooru, and use their search syntax. Replies are sent as a rich embed, which requires link previews to be enabled both in the server settings and on your client.

Commands may be run in servers, or in a DM. In servers, NSFW images will only be sent to channels marked NSFW, and in DMs the NSFW filter is always used.

There's also a deletthis command, for when the most recent image was just that bad.

For users, this is all you need to know. However...

Moderators/Server Owners

Randibooru is configuarable! If you don't like the way she operates, you're free to mess with her settings to your heart's content.

Filters

Filters are a way to limit the tags users can find images matching. These are another Derpibooru feature which have been directly implemented into the bot. To change the default filters, use the filter command.

The structure for the filter command is: filter <key> [<type>], where key is the numeric ID for the filter (a list of default filters can be obtained here), which can be found after /filters/ in the URL bar, and type is either SFW or NSFW to denote which filter you want to set.

The SFW filter will be used in most channels. By default, this is set to Derpibooru's Default filter, which is suitable for most servers. It hides "non-art" content, and anything that would be considered explicit.

The NSFW filter will be used in NSFW-marked channels. By default, this is set to Derpibooru's Everything filter, which may be a little extreme for some servers. It is recommended that you choose a more suitable filter for this by default, or optionally create your own if none of the defaults are to your needs.

Filters may only be set by the users with the Manage Channels permission.

Blocking

You can block problematic users by using the block command. This prevents the bot from acknowledging any Derpibooru image requests, and can be useful for people that spam obscene images. This was mostly useful before filters were implemented, but may still prove useful if someone is overusing the bot.

To unblock a user, use the unblock command.

Blocks may only be put in place by users with the Manage Messages permission.

Embed resolution

You can set the resolution Randibooru uses for image embeds using the res command. Acceptable values are full, high, med/medium, and low.

  • full: full resolution, no resizing
  • high: ~1500x maximum
  • med/medium: ~750x maximum (default)
  • low: ~300x maximum

Maintainers

Contribute

Issues, suggestions, or concerns? Submit a GitHub issue!

Want to add a feature? We accept PRs!

License

Copyright (c) Eliot Partridge, 2016-18. Licensed under the MPL v2.0.