Browse Source

Adding Szurubooru module scaffold

develop
Drew Short 5 years ago
parent
commit
0a6b571e9a
  1. 3
      bot/module/szurubooru/client.js
  2. 49
      bot/module/szurubooru/index.js
  3. 9
      data/szurubooru-config.json.example

3
bot/module/szurubooru/client.js

@ -0,0 +1,3 @@
/**
* Szurubooru api client
*/

49
bot/module/szurubooru/index.js

@ -0,0 +1,49 @@
/**
* Module for interacting with a Szurubooru instance
*/
let { AbstractModule } = require('../abstract');
let { logger } = require('../../logging');
class SzurubooruModule extends AbstractModule {
constructor() {
super(
"Szurubooru",
"Interact with a Szurubooru instance",
"szurubooru"
);
this.helpAndUsage = `Usage:
'!szurubooru <tag> [<tag>...]' display a random post that matches tags
'!szurubooru config' prints config information for the room
'!szurubooru config upload' toggles uploading images from room messages
'!szurubooru iqdb' get an IQDB link for the last displayed post
'!szurubooru need [<max tag count (5)>]' show a random post that needs additional tags
'!szurubooru post <post_id>' retrieve a post and publish the image to the room
'!szurubooru random [<tag>...]' display a random image from szurubooru that matches tags if preset
'!szurubooru random update' update the random counts
'!szurubooru recent [<days> (1)]' display a recent random image within the last <days>
'!szurubooru related' display related posts to the last displayed post
'!szurubooru tag <tag> [<tag>...]' add tags to the last displayed post
'!szurubooru tag clone <post_id>' clone tags from <post_id> to the last displayed post
'!szurubooru tag remove <tag> [<tag>...]' remove tags from the last displayed post
'!szurubooru tags' list of all tags by popularity
'!szurubooru tags <tag_stub> [<tag_stub>...]' list tags similar to each <tag_stub>
'!szurubooru upload <url>' upload a remote file to szurubooru`;
this.needConfig = true;
this.defaultCommand = 'help';
}
getConfigSensitiveFields() {
return ["token"];
}
/* Commands
* All methods starting with cmd_ will be parsed at initialization to expose those methods as commdands to the user
*/
cmd_random(event, ...args) {
}
}
exports.module = new SzurubooruModule();

9
data/szurubooru-config.json.example

@ -0,0 +1,9 @@
{
"url": "<api endpoint>",
"username": "<connecting username>",
"token": "<connection api token>",
"random_image_cache": {},
"upload_rooms": {
"<authorized room to upload from>"
}
}
Loading…
Cancel
Save