Skip to content
/usr/share edited this page Jun 27, 2019 · 12 revisions

snowbot is a simple IRC bot, written entirely in C, that allows performing some simple operations. Its source code is available under the terms of the MIT license.

Functions

Upon launch, the bot connects to an IRC server (with a password, if necessary) and joins a list of specified channels. When in a channel, it will react to both public and private commands.

The bot also listens for URLs in messages. If the URL is longer than 40 characters, it will shorten the URL using the v.gd service and respond with a shorter URL.

Commands

  • .startp: Enables paste mode. All further private messages will be interpreted as lines of text to be added to a paste file. To finish typing a paste file, send a message consisting of a single dot "." . The resulting text will be uploaded to pastebin.org, and the link returned in response.

  • .owm: Retrieves current weather from openweathermap.org and responds with a message detailing the data. Location can be set as:

    • a ZIP / postal code (@12345), optionally combined with a country code (@101000 RU)
    • a city name (Moscow), optionally combined with a country code (Moscow RU)
    • a combination of latitude and longitude, separated with a space (55.75 37.61), where negative values are used for west and south
    • or an OpenWeatherMap city ID (#524901).

City names containing a space have to be either quoted ("Los Angeles") or escaped (St.\ Petersburg).

  • .owf: Retrieves a short-term (3 hour step) forecast from openweathermap.org. By default, data for the nearest 48 hours is shown. The "hr" field shows the hours in the location's timezone, the "°C" / "°F" field shows the temperature, the "wd" field shows the wind speed (in meters per second, with colors if it is too high) and the "sp" field shows special statuses (rain, snow, thunder), with small and capital letters indicating the severity.

  • .owl: Retrieves a long-term (1 day step) forecast from openweathermap.org. By default, data for the nearest 7 days is shown. The "d#" field shows the date, the "°C" / "°F" field shows the temperature (yellow = day, blue = night), the "wd" field shows the wind speed and "sp" shows special statuses.

  • .owm_s: Uses openweathermap.org to look up cities by name, returns their city ID numbers, names, rough coordinates and basic weather conditions. Useful for determining which city ID to use. (To avoid flooding the channel, results are always sent as private messages.)

  • .w_c, .w_f: Changes the temperature units returned by .owm, .owf and .owl commands to Celsius and Fahrenheit, respectively. The default setting is Celsius.

  • .xr: Either retrieves exchange rates for a number of currencies compared to the U.S. dollar (.xr EUR,RUB,BTC = rates for euro, ruble and bitcoin) or converts an amount from one currency to another (.xr 400 RUB USD = how much U.S. dollars is 400 Russian rubles?).

  • .cv: Converts between different measurements. Common metric and US customary units are included (for example, .cv 1 mi km). Has a special case for heights in feet/inches (e.g. .cv 5'11 cm).

  • .su: Shortens URLs seen in channels. Either use no parameters to receive the last URL seen, or input a piece of the URL to search through the last 20 URLs seen. Uses the http://v.gd public shortening service.

  • .sug: Adds a "derail suggestion". Whenever a single user is sending too many consecutive messages, this bot may insert a random suggestion in attempt to derail the conversation towards a different topic. The bot stores up to 32 suggestions, each up to 140 bytes long, and each suggestion is deleted after one use.

  • .save, .load: These commands save your user settings (as determined by nickname) into a file and load it back. These settings are also saved automatically when you disconnect from the server and loaded whenever requested, but it's always better to save manually in case the bot crashes (in which case no automatic saving will be performed).

  • .set: This command allows you to modify your user settings on an invididual basis. You can either change the value of a setting (.set name value), get the current value of a setting (.set name) or get a list of all the settings currently available (.set).

Settings

  • wmode: Show temperatures in Celsius (0) or Fahrenheit (1).

  • cityid: Default city ID for .owm and .owf commands. If set, you will be to get weather data without specifying that city. To get the city ID for your city, ask .owm for your city and note the number in parentheses. Don't enter the hash (#) sign when entering the number here.

  • color_scheme: Choose out of several different color scheme for the weather-related commands:

    • 0: a bright color scheme, best suited for dark backgrounds.
    • 1: a dark color scheme, best suited for bright backgrounds.
    • 2: a monochrome color scheme, should work the same on both.
Clone this wiki locally