Description

CureWhite is an IRC bot made by CureGecko named after Yukishiro Honoka (CureGecko's favorite character) from the Pretty Cure Series. The main function of CureWhite is discribing links sent in an IRC Channel, but many other functions exist which is described below.

How to read documentation.

Anything in brackets like {} means it's a parameter provided by you. The inside of the brackets is the name of the parameter.
Anything in brackets like [] means it's an optional parameter. If it has brackets like {} inside then it's any word you wish to provide, without means the word in the [] is required. Sometimes I'll separate the different options with a |.

Inviting CureWhite into a channel.

To invite CureWhite into a channel, simply use the invite command in IRC. Go into the channel you wish to invite CureWhite into and run "/invite YukishiroHonoka" (without quotes).

Servers CureWhite is on.

irc.rizon.net

If you want CureWhite on another server contact CureGecko and he will see about adding it.

Skipping messages

If you want to exclude your message, this will help you.

Usage

!skip {message} or !s {message}

User specific settings

There are settings for you specifically in CureWhite. You can do many things an operator can in a channel, however operator's option to disable a function cannot be overrided and the settings are cross channel settings and not channel specific.

Usage

/msg CureWhite settings

CureWhite can describe links from the following online sites.

Waifu2x

If you want to make an anime image 2x in size or if you wish to clean an image up. You can use the Waifu2x command via !waifu/!waifu2x/!embiggen/!zoom.

Usage

!waifu -scale [0-1] -noise [0-2] image
If there are no options specified and you just pass an image, the default is to scale and de-noise.
This is a slow process, about 10-20 seconds to run.

Memos

CureWhite has the ability to store messages for someone and replay them when they when they re-join the channel.

Usage

!memo {Nickname} [p] {Message}
Nickname can be a wildcard or regex.
p = public.
!note also works as !memo

When you have a memo and you join, CureWhite will send you a message saying you have new memos or if it was public, you will see it in the channel. When you want to read, simply send "read" to CureWhite and she will read you 5 messages at a time. To remove all memos from your queue, send removeall to CureWhite.

If you have people you wish to block memos from, add them to the Ignore User Memos list on the settings or simply send CureWhite the message "ignore {NickRegex}". You can unignore by simply sending "unignore {NickRegex}".

You can block all memos for you by going into settings and disabling memos.

Seen

Seen allows you to check when the last time CureWhite has seen someone.

Usage

!seen {Nickname}

Correction

If you make a typo mistake, CureWhite can help you correct it using regex. The correction function allows you to replace anything found by regex with something else.

Usage

s/{Mistake}/{Correction}[/|/g]

Mistake is a regex which can contain capturing statements.
Correction can contain a $ followed by a number to represent an item captured.
The regex is ICU's flavor which a guide can be found at http://userguide.icu-project.org/strings/regexp.

SauceNAO

If you ever wondered where a image was originated, simply run this command.

Usage

!sauce {URL}
!source also works well, but most people will want to do sauce.

Random Image

CureWhite has a database of many Booru sites which can be accessed using the Random Image function. This function will search the database for tags and present a random result.

Booru Sites

The sites which are indexed are as followed.
More sites can be added by contacting CureGecko. If you area a booru site and will like to help me get started with a data dump, please do contact me.

Usage

!rand [s|q|e] {tags}
The options s|q|e filters to a specific rating of safe, questionable, or explicit.
Tags are by default prefixed with a + meaning that each word is required in a post for it to be found.
If you wish not to have a + in-front, and have it be an optional word, you can add the keyword OR which will force it to not prefix with anything.
Prefixing with a - will exclude any posts containing that word.
Putting multiple words in quotes will include any posts which contains those words in that specific sequence.
Searching for two words with a _ as spaces will automatically put quotes.
To search for every image that is questionable or safe, but not explicit. Add the tag -e. Same works for safe or explicit but not questionable etc...
Many functions also exist within queries, see below for info on some.
Function Notes
width: You can query in many ways baised on width. For example width:<=1920 width:<1920 width:>=1920 width:>1920 width:1920,lte width:1920,gt
height: Same as width:, but with the height
aspect: Filter based on aspect. Examples aspect:4:3 aspect:16/9,ct aspect:1.7777777777778,0.001
date: Filters by the upload date. Examples date:1/1/15 date:1/1/15-1/2/15 date:today_at_5_AM
hash: Filter by the hash. md5: also exists for the same thing.
rating: Filter by the rating of the content.
created: Filter to an exact unix time stamp.
tag: This is for if you want a specific tag and not possibly a tag that contains the tag within it. Example. ore_no_imouto_ga_konna_ni_kawaii_wake_ga_nai contains many words that doesn't especially have to do with it. If you want to specifically search for imouto, you can use tag:imouto
url: This contains basically the components to build the URL to an image. You can use this function to filter for a specific file type or a specific booru site. Examples url:webm url:gif url:danbooru url:gelbooru

Imgur Upload

This option makes the bot listen for links to images on the sites below and upload them to imgur as an archive.
It does not upload images for non-registared users and by default only uploads images that channels operators post. In-order to remove restrictions of class, you must talk with CureGecko.

Features for Operators

Operators has the ability to access special features by messaging CureWhite the following command.
/msg CureWhite settings #{Channel}
These features includes the ability to disable features, have CureWhite leave the channel, and add more features.

Javascript Bangs

Javascript Bangs allows you to add triggers to run scripts.

Bangs are matched based on regex. The default match is against the first word of a message with the following regex "(?i)^BANG$". If you wish to match the full message, you can do so with a "?" in-front of the bang string. The "?" removes any considitions which is done by default and matches the whole message.

Arguments

Arguments passed by the user running the bang are available via the arguments function as an array. The first object in this array is always the nick of the user which invoked the bang.

Avilable Functions

All functions that are custom are available via the main object.

main.originNick() - Returns the nick of the origin.
main.channel() - Returns the channel name.
main.channelMembers() - Returns an array of the members in the channel which the bang was invoked.
main.message() - Returns the message used to call the function.
main.messageArray() - Returns the message used to call the function as an array.
main.channelMessages() - Returns the last 5 messages in a channel.
main.channelMessages({count}) - Returns the last messages in a channel.
main.httpRequest({URL}) - Allows you to call a URL using the GET method.
main.httpRequestWithPost({url}, {post}) - Allows you to call a URL using the POST method. The post parameter is a dictionary of post variables.
main.httpRequestWithOptions({url}, {options}) - Allows you to call a URL with additional options. The options argument is a keyed array (dictionary, hash) which accepts the following keys:
postData - A keyed array of variables to post.
body - A string with data to send via the HTTP Body.
method - A string of the HTTP Method to use: GET, POST, HEAD...
headers - A keyed array with HTTP Headers.
followCount - How many redirects the loader should follow. -1 = infinite follow, 0-1 = stop at first redirect, 2+ = additional redirects.

Response will be a keyed array with the following keys:
data - The data from the response in string form.
response - The information from the response - length, mime, url, headers, and status.
error - Error information if an error occurred.

main.booruRand({query}) - Gets a random image from the booru search engine. Returns null if nothing found, or dictionary with created, hash, rating, tags, and url as keys.
main.filterTags({tags}) - Pass a string of tags and the tags will be filtered to remove useless tags.
main.filterTagsWithLimit({tags}, {limit}) - Filters with limit.
main.quote({object}) - Use this to quote options when storing to a database to prevent SQL Injection.
main.query({theQuery}) - Allows you to query the database for this channel creating your own tables, storing data, and other things. The database is SQLite3 and accepts FTS.
main.log({object}) - Log certain veriables for easy development.
main.getLog() - Pull the log in it's current form.
main.action({text}) - Put text in action form. Must be on a line without any other text.
main.notice({text}) - Put text in notice form. Must be on a line without any other text.
main.setValueForKey({value}, {key}) - Store a value which is not persistant (clears when bot is rebooted) for the channel.
main.valueForKey({key}) - Get value stored for key.
main.parseJSON({JSON}) - Get an object (string,array,dictionary) from a string of JSON.
main.JSONValue({object}) - Get a string in JSON format.

Limitations

There is a message size limit of 430 bytes. You can force a new message by splitting with a \n

Example Script (!translate)

var query = ""; var slang = "auto"; var tlang = "en"; var args = main.messageArray(); for (var i=0; i<args.length; i++) { if (args[i]=="-h") { return "-t : Target Language (en). -s : Source Language (auto)."; } if (args[i].substring(0,1)=="-" && (i+1)<args.length) { if (args[i]=="-s") { slang = args[i+1]; i++; continue; } else if (args[i]=="-t") { tlang = args[i+1]; i++; continue; } } if (query!=="") query += " "; query += args[i]; } main.log("q: "+query); main.log("sl: "+slang); main.log("tl: "+tlang); var response = main.httpRequestWithOptions("https://translate.google.com/translate_a/t?client=ia&inputm=0&q="+encodeURIComponent(query)+"&hl=en&ie=UTF-8&oe=UTF-8&sl="+encodeURIComponent(slang)+"&tl="+encodeURIComponent(tlang), {"headers": [{"User-Agent": "iOSTranslate/3.3.10888 8.3 tablet iPad5,3"}]}); main.log(JSON.stringify(response)); var object = JSON.parse(response.data); var sentences = object['sentences']; var translation = ""; for (var i=0; i<sentences.length; i++) { translation += " "+sentences[i]['trans']; } return translation;

Example Script (!g)

var query = main.message(); var response = main.httpRequestWithOptions("https://searx.me/?format=json&engines=google,duckduckgo&q="+encodeURIComponent(query), {"headers": [{"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:42.0) Gecko/20100101 Firefox/42.0"}]}); var object = main.parseJSON(response.data); var result = object['results'][0]; var description = result['content']; if (result['content'].length>=100) { description = result['content'].substr(0,100)+"\n"+result['content'].substr(100,100); } return "Title: "+result['title']+" - "+result['pretty_url']+"\nDescription: "+description;

Example Script (!aikatsu)

var query = main.message(); var response; if (query==="") { response = main.booruRand("s aikatsu"); } else { response = main.booruRand("s aikatsu "+query); } if (typeof response === "undefined") { return "No post found."; } var rating = "Safe"; if (response['rating']=="q") { rating = "Questionable"; } else if (response['rating']=="e") { rating = "Explicit"; } return "("+rating+") "+response['url'];