# Utility Commands¶

This module contains generally useful, atomic commands that aren’t otherwise categorized into a dedicated module.

These commands might be safe for use by anyone, or locked behind in-Discord permissions.

## NSFW Images Detection Tools¶

GiselleBot implements an (experimental) NSFW images detection system using TensorFlow.js as its base.

The detection system is based on Infinite Red’s NSFW JS library and GantMan’s Inception v3 Keras Model for NSFW detection to classify any image as a composition of 5 categories:

• Drawings: Safe for work drawings (including anime).

• Hentai: Hentai and pornographic drawings.

• Neutral: Safe for work neutral images.

• Porn: Pornographic images, sexual acts.

• Sexy: Sexually explicit images, not pornography.

The module was furtherly converted into a back-end module and customized with a caching system to enhance its performance.

This interesting article by Infinite Red explains the reasons behind the creation of the original NSFW JS client-side module.

Warning

This module, by no means, is supposed to reliably recognize all NSFW images. Its main purpose is quickly classifying provided images and supporting humans in better moderating a server.

The module itself will not store or expose any sexually explicit images. The output will not contain a direct link to the original image, and a censored (low resolution, blurred) version of the image will be locally cached and used to refer to the original image.

Here’s an example of an output of this command, and the corresponding censored image:

For those of you with a background in image processing - yes, Lenna is actually flagged as NSFW with a confidence score of 81.9%!

### !nsfwcheck¶

#### Command Syntax¶

!nsfwcheck (image URL, or image as a message attachment)

#### Command Description¶

Submits an image against the GantMan’s Inception v3 Keras Model for NSFW detection (as explained above) and returns a detailed output about the classification.

#### Examples¶

!nsfwcheck http://www.lenna.org/lena_std.tif

### !nsfwcache¶

#### Command Syntax¶

!nsfwcache (cache ID)

#### Command Description¶

Recalls an image classification output by its cache ID (as given in the footer of the !nsfwcheck command.

#### Examples¶

!nsfwcache 5d6c4cd78e422b00137d14ce

### !nsfwthreshold¶

#### Command Syntax¶

!nsfwthreshold [new threshold, or "-"]

#### Command Description¶

While the classification scores given to an image cannot be tuned, each server can choose its own NSFW threshold (the sum of NSFW-related scores over which an image is considered NSFW).

The new threshold is an integer within the range [0, 100], inclusive of 0 (treat all images as NSFW) and 100 (only treat an image as NSFW if the model recognize it as having no-SFW components - which is highly unlikely, hence basically meaning “treat no images as NSFW”).

Running the command with - as argument will reset the server threshold to the global, default threshold of 60%.

Running the command with no arguments will show the current value for the server.

#### Examples¶

!nsfwthreshold 80
!nsfwthreshold -
!nsfwthreshold

#### Permissions Needed¶

User: Manage Server

## Other Tools¶

### !shorturl¶

#### Command Syntax¶

!shorturl (long URL)

#### Command Description¶

Converts a long URL into a short URL using the proprietary gisl.eu shortening service.

Note

URLs shortened using the gisl.eu service never expire, unless deleted by the person that created the short URL (feature not available yet). The original URLs are saved as encrypted strings within the redirection database. Any sensitive data contained in the URL (authentication keys, login info, etc.) will not be exposed in case of a breach.

#### Examples¶

!shorturl http://www.amazon.com/Kindle-Wireless-Reading-Display-Globally/dp/B003FSUDM4/ref=amb_link_353259562_2?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-10&pf_rd_r=11EYKTN682A79T370AM3&pf_rd_t=201&pf_rd_p=1270985982&pf_rd_i=B002Y27P3M

### !unitconverter¶

#### Command Syntax¶

!unitconvert (value) (unit) [destination unit]

#### Command Description¶

Converts between quantities in different units. It also supports converting currency with the most recent exchange rates.

The value and originating unit are mandatory. If the destination unit is omitted or invalid (e.g. non-existing, or a unit in a different measure, like trying to convert length to mass) then the “best” destination unit will be picked. For currencies, if the destination currency is omitted or invalid, USD will be automatically used.

#### Examples¶

!unitconvert 10 EUR USD
!uconv 1000 mm
!uconv 30 C F
!uconv 1 MB b

### !clockchannel¶

#### Command Syntax¶

!clockchannel (time zone name) [--template {custom channel name template}] [--12ht]

#### Command Description¶

Creates a channel as “clock channel”, updating its name every 10 minutes. You must specify the time zone name: if you need to search for a valid time zone name, use the !searchtz command.

Note

The initial implementation of this command used to have clocks update every minute. Discord suddenly changed the rate limit of channel updates to 2 updates every 10 minutes, but the rate limiter is not precise. The 10-minutes update is the safest update that is still useful to track time.

You can set a custom template for the channel name. You can use one (or more) of these placeholders in your custom channel name template:

• %time_zone% or %tz%: This will be replaced with the name of the chosen time zone.

• %clock%: This will be replaced with the auto-updating clock.

• %date%: This will be replaced with the current date.

Additionally, you can add the --12ht parameter if you want the clock to be shown as 12 hours time.

By default, the channel name template is %time_zone%: %clock%.

Out of the box, each server is limited to having 5 clock channels. You can unlock up to 10 different clock channels as a Premium feature (see: Premium Perks). This Premium limit was increased from 1/5 after the Discord rate limit update.

#### Permissions Needed¶

User: Manage Channels, Manage Server
Bot: Manage Channels, Connect

#### Examples¶

!clockchannel UTC
!clockchannel Europe/London --12ht
!clockchannel America/New_York --template Current Time: %clock%

### !clockchanneldelete¶

#### Command Syntax¶

!clockchanneldelete [channel id/mention/name]

#### Command Description¶

Deletes a clock channel, bypassing Discord’s implicit denial: normally, “Manage Channels” does not apply if the user doesn’t have “Connect” permissions to the channel. As long as GiselleBot has “Connect” permissions, this channel will allow users to delete the clock channel.

You can omit the channel identifier if you are connected to the clock channel when you run the command.

#### Permissions Needed¶

User: Manage Channels, Manage Server
Bot: Manage Channels, Connect

#### Examples¶

!clockchanneldelete 123456789098765432
!clockchanneldelete UTC Time: 9:10 AM

### !searchtz¶

#### Command Syntax¶

!searchtz (country code or lookup string)

#### Command Description¶

Searches for a valid time zone name.

Using a 2-letters country identifier will show the available time zones for the specified country.

Using any 3+ characters string will search for matching time zones.

#### Examples¶

!searchtz US
!searchtz New

### !membercountchannel¶

#### Command Syntax¶

!membercountchannel [--template {custom channel name template}]

#### Command Description¶

Creates a channel as “member count channel”, showing the total amount of users that are currently in the server, updating its value every hour.

You can set a custom template for the channel name. If you do so, you must use the %count% placeholder in your custom channel name template.

By default, the channel name template is Members: %count%.

You can only have 1 member count channel up at any time.

#### Permissions Needed¶

User: Manage Channels, Manage Server
Bot: Manage Channels, Connect

#### Examples¶

!membercountchannel
!membercountchannel --template Current Users: %count%

### !urban¶

#### Command Syntax¶

!urban (search string) [--more]

#### Command Description¶

Urban Dictionary text lookup. The output will be the highest ranked result. The embed title will hyperlink to the corresponding online page.

Using --more will show up to 5 results, if available.

Warning

Given the nature of the website, Urban Dictionary lookups will only be executed in channels that are marked as NSFW.

#### Examples¶

!urban guinea tee

### !lyrics¶

#### Command Syntax¶

!lyrics (song name or search keyword)

#### Command Description¶

Looks for lyrics of a song by song name or keyword.