From 0a6b571e9a49cdf7039a6bd2723f1de492ec6afe Mon Sep 17 00:00:00 2001 From: Drew Short Date: Thu, 9 Jan 2020 21:57:04 -0600 Subject: [PATCH] Adding Szurubooru module scaffold --- bot/module/szurubooru/client.js | 3 ++ bot/module/szurubooru/index.js | 49 +++++++++++++++++++++++++++++ data/szurubooru-config.json.example | 9 ++++++ 3 files changed, 61 insertions(+) create mode 100644 bot/module/szurubooru/client.js create mode 100644 bot/module/szurubooru/index.js create mode 100644 data/szurubooru-config.json.example diff --git a/bot/module/szurubooru/client.js b/bot/module/szurubooru/client.js new file mode 100644 index 0000000..7e07f74 --- /dev/null +++ b/bot/module/szurubooru/client.js @@ -0,0 +1,3 @@ +/** + * Szurubooru api client + */ \ No newline at end of file diff --git a/bot/module/szurubooru/index.js b/bot/module/szurubooru/index.js new file mode 100644 index 0000000..f11c067 --- /dev/null +++ b/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 [...]' 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 []' show a random post that needs additional tags +'!szurubooru post ' retrieve a post and publish the image to the room +'!szurubooru random [...]' display a random image from szurubooru that matches tags if preset +'!szurubooru random update' update the random counts +'!szurubooru recent [ (1)]' display a recent random image within the last +'!szurubooru related' display related posts to the last displayed post +'!szurubooru tag [...]' add tags to the last displayed post +'!szurubooru tag clone ' clone tags from to the last displayed post +'!szurubooru tag remove [...]' remove tags from the last displayed post +'!szurubooru tags' list of all tags by popularity +'!szurubooru tags [...]' list tags similar to each +'!szurubooru upload ' 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(); \ No newline at end of file diff --git a/data/szurubooru-config.json.example b/data/szurubooru-config.json.example new file mode 100644 index 0000000..bf4fd9c --- /dev/null +++ b/data/szurubooru-config.json.example @@ -0,0 +1,9 @@ +{ + "url": "", + "username": "", + "token": "", + "random_image_cache": {}, + "upload_rooms": { + "" + } +} \ No newline at end of file