Skip to content

Custom SIML Adapters

Łukasz Domeradzki edited this page Mar 17, 2022 · 45 revisions

Custom SIML Adapters

This page describes custom SIML adapters available for use in ArchiBot AI. A default delimiter for arguments in all available adapters is any whitespace character, such as a space, tab, or newline. In some specific adapters the default delimiter was limited to smaller subset of characters in order to allow wider choice of characters supplied as arguments. Extra out-of-bound arguments will be concatenated with last eligible argument, allowing you to use full range of whitespace characters in it.


ArchiChatRandomUserNickname

It accepts a ChatID and returns a random user from the chat. It's expected to be used with ChatID user-provided variable or with a hardcoded one (like steam-412 for Touhou Giveaways).

Usage example:

<Response>
	<ArchiChatRandomUserNickname>steam-412</ArchiChatRandomUserNickname>
</Response>

Result:

Archi


ArchiChatUserID

It accepts a ChatID and a query based on user's nickname. Returns ID of the user on the chat that was considered best match according to Levenshtein distance, or null if no match was found.

Usage example:

<Response>
	<ArchiChatUserID>steam-412 Arch</ArchiChatUserID>
</Response>

Result:

steam-76561198006963719


ArchiDate

It accepts a Location as input, for example a city or a country. It returns the current local date in that location.

Usage example 1:

<Response>
	<ArchiDate>Poland</ArchiDate>
</Response>

Result:

20/06/2017

Usage example 2:

<Response>
	<ArchiDate>Rome</ArchiDate>
</Response>

Result:

20/06/2017


ArchiDateTime

It accepts a Location as input, for example a city or a country. It returns the interpreted input and the current local date and time in that location.

Usage example 1:

<Response>
	<ArchiDateTime>Poland</ArchiDateTime>
</Response>

Result:

Poland | 20/06/2017 14:20:53

Usage example 2:

<Response>
	<ArchiDateTime>Rome</ArchiDateTime>
</Response>

Result:

Italy | 20/06/2017 14:20:53


ArchiMantisSubmitIssue

It accepts EPriority, ESeverity, summary (string) and description (string), all separated from each other with fixed tab (\t) character. This allows summary to include spaces or other whitespace characters (as description would use out-of-bound concatenation anyway).

After passing correct arguments, creates new issue on our tracker in ArchiBot project, AI category. Returns null on failure and IssueID (ushort) on success, which could be used for redirection (e.g. https://mantis.justarchi.net/view.php?id=29)

Usage example:

<Response>
	<ArchiMantisSubmitIssue>Default	Feature	Games picker idea	I think adding game picker could be nice, bot would return random Steam game for user</ArchiMantisSubmitIssue>
</Response>

Result:

29

EPriority is defined as:

internal enum EPriority : byte {
	Default,
	None = 10,
	Low = 20,
	Normal = 30,
	High = 40,
	Urgent = 50,
	Immediate = 60
}

ESeverity is defined as:

internal enum ESeverity : byte {
	Default,
	Feature = 10,
	Trivial = 20,
	Text = 30,
	Tweak = 40,
	Minor = 50,
	Major = 60,
	Crash = 70,
	Block = 80
}

ArchiPatreonCampaignPledge

It accepts a campaign ID and returns the amount of money currently pledged to it by its patrons, together with currency, as well as the campaign's type (monthly or per-creation).

To find the campaign ID you can check the project main page's source and look for it, for example by searching for "pledge_url"

campaign ID location

Usage example:

<Response>
	<ArchiPatreonCampaignPledge>316025</ArchiPatreonCampaignPledge>
</Response>

Result:

57 USD per month


ArchiRedditRandomPost

It accepts a subreddit name and returns the random post out of it, in form of title, newline and body.

Usage example:

<Response>
	<ArchiRedditRandomPost>copypasta</ArchiRedditRandomPost>
</Response>

Result:

Navy Seal

What the f*** did you just say(...)


ArchiSteamGroupRandomUserNickname

It accepts a Steam group ID and returns a random user from the group. Group refresh is done automatically if needed.

Usage example:

<Response>
	<ArchiSteamGroupRandomUserNickname>103582791437445144</ArchiSteamGroupRandomUserNickname>
</Response>

Result:

Archi


ArchiSteamRandomEmoticon

It returns a random emoticon from a list. Used with no argument the list used is the entire list of ArchiBot's available emoticons, otherwise it will pick a random emoticon from the list provided (ArchiBot will ignore emotes that it doesn't own).

Usage example 1:

<Response><ArchiSteamRandomEmoticon /></Response>

Result:

:Neko:

Usage example 2:

<Response>
	<ArchiSteamRandomEmoticon>:dice1: :dice2: :dice3:</ArchiSteamRandomEmoticon>
</Response>

Result:

:dice2:


ArchiSynBotLateTasksClear

It removes any pending <Late> task that were created by the current user. It requires no argument and returns no output.

Usage example:

<Response>I'll clear the late tasks for you!<ArchiSynBotLateTasksClear /></Response>

Result:

I'll clear the late tasks for you!


ArchiSynBotUserGet

It accepts user's ID and variable name and returns the value of said variable for that user, or null in case of failure. Remember that Users are initialized when they first interact with the bot, so using an uninitialized user's ID will always result in the adapter returning null.

The delimiter between the 2 arguments can be any whitespace, although a non-breaking space &nbsp; is advised if working with tags in xml.

Usage example:

<Response>
	<ArchiSynBotUserGet>steam-76561198006963719 Name</ArchiSynBotUserGet>
</Response>

Result:

Łukasz


ArchiTime

It accepts a Location as input, for example a city or a country. It returns the current local time in that location.

Usage example 1:

<Response>
	<ArchiTime>Poland</ArchiTime>
</Response>

Result:

14:20:53

Usage example 2:

<Response>
	<ArchiTime>Rome</ArchiTime>
</Response>

Result:

14:20:53


ArchiTranslate

It accepts any input and translates it into English after trying to detect the input's language, or null in case of failure.

Usage example:

<Response>
	<ArchiTranslate>Ogórek</ArchiTranslate>
</Response>

Result:

Cucumber


ArchiTranslateFrom

It accepts a source 2-letter ISO 639-1 formatted language code followed by whitespace and any message. It returns a translation of the message from the source language specified to English, or null in case of failure.

Usage example:

<Response>
	<ArchiTranslateFrom>pl Ogórek</ArchiTranslateFrom>
</Response>

Result:

Cucumber


ArchiTranslateFromTo

It accepts a source and a target 2-letter ISO 639-1 formatted language code separated and followed by whitespace and any message. It returns a translation of the message from the source language to the target language specified, or null in case of failure.

Usage example:

<Response>
	<ArchiTranslateFromTo>pl fr Ogórek</ArchiTranslateFromTo>
</Response>

Result:

Concombre


ArchiTranslateTo

It accepts a target 2-letter ISO 639-1 formatted language code followed by whitespace and any message. After trying to detect the input's language it returns a translation of it in the target language specified, or null in case of failure.

Usage example:

<Response>
	<ArchiTranslateTo>fr Ogórek</ArchiTranslateTo>
</Response>

Result:

Concombre


ArchiWeather

It accepts either, optional CountryCode and the City, or latitude and longitude as the input and returns information about the weather. In order to avoid ambiguous results, ISO 3166 country code should be included when asking by a city (optional, 2 letters).

Usage examples:

<Response>
	<!-- This is ambiguous, there is a Warsaw city at least in the PL and US -->
	<ArchiWeather>Warsaw</ArchiWeather>
</Response>

Result:

Warsaw, PL | -7°C/19°F
Conditions: Clear (clear sky)
Clouds: 0%, Wind: ↓ 9 kph/6 mph
Pressure: 1027 hPa, Relative humidity: 85%
Sunrise: 15 hours ago, Sunset: 7 hours ago
(Calculated 30 minutes ago)
<Response>
	<!-- What if we wanted Warsaw in the US? -->
	<ArchiWeather>US Warsaw</ArchiWeather>
</Response>

Result:

Warsaw, US | 5°C/41°F
Conditions: Clear (clear sky)
Clouds: 1%, Wind: ← 9 kph/6 mph
Pressure: 1024 hPa, Relative humidity: 79%
Sunrise: 8 hours ago, Sunset: in 30 minutes
(Calculated 25 minutes ago)
<Response>
	<!-- Or we can use lat/lon and be sure about the response -->
	<ArchiWeather>54.69 18.67</ArchiWeather>
</Response>

Result:

Jastarnia, PL | -2°C/28°F
Conditions: Clouds (overcast clouds)
Clouds: 90%, Wind: → 11 kph/7 mph
Pressure: 1027 hPa, Relative humidity: 79%
Sunrise: 14 hours ago, Sunset: 7 hours ago
(Calculated 32 minutes ago)