Link Search Menu Expand Document

Templates

Templates are used to customize the messages that appear in raids and announcements. In this way, you can add some data that is not shown by default, such as the maximum CP or the types of the Pokémon, or you can also change the arrangement of the existing elements.

There are two completely independent templates: the raid template, which is changed with /raidtemplate, and the announcement template, which is changed with /announcetemplate. Also, raids can have content after the target list, which can be set with /raidfootertemplate.

By putting those commands without arguments, the current template code is displayed. To change a template, you can copy and paste that code with the desired modifications. For example:

/raidtemplate <b>{Pokemon}</b> Raid {{on <b>{weekday_day_month}</b> }}at {timewarn_icon_}<b>{raidtime}</b> in {gym_icon}{gym}<br>{{<em>Available from {opentime} to {endtime}</em><br>}}<em>Organized by </em>{organizer}{_edited_icon}{_refloated_icon}

To return to the default template, you must put a dash -, as follows:

/raidtemplate -

⚠️ Is everything very confusing? Start by putting the command /raidtemplate and look at the current raid template. Copy, paste it and make a little modification. Little by little, try new stuff.

Predefined templates

In addition to the default template, there are some additional predefined templates. To use them, you must specify their name instead of putting the complete template. For example:

/raidtemplate maxcp
/announcetemplate maxcp

The available predefined templates are:

Name Description
maxcp Like the default template, but also shows the Pokémon’s maximum CP.
pokebattler Like the default template, but with a link to Pokébattler in the Pokémon’s name.
pokebattler_maxcp The combination of the two previous templates: shows the maximum CP and a link to Pokébattler in the name of the Pokémon.

Variables

In any template you will find text between brackets {} that are variables that will later be replaced by the data of the raids and announcements. For example, {gym} is replaced by the name of the gym, with a link if the location is known.

This list indicates all the available variables. Some are already used in the default template or in one of the predefined templates, but others are not. For clarity, the brackets {} do not appear in the list.

Variable Description HTML
pokemon The Pokémon or the egg. -
pokemon_gameinfo The Pokémon (with a link to its guide on Gameinfo) or the egg. Link
pokemon_pokebattler The Pokémon (with a link to its guide in Pokebattler) or the egg. Link
pokemon_kingcasualbot The Pokémon (with a link to its guide in KingCasualBot) or the egg. Link
pokedexno The number in Pokédex, available only if the boss were selected. -
tier The level of the raid, numerically: 1, 3, 5; or mega or ex. -
expokemon_icon The EX icon only if it is an EX Raid Boss. -
shinypokemon_icon The shiny icon only if it is a raid boss that can appear shiny. -
maxcp The maximum CP at level 20. -
maxcp_boosted The maximum CP at level 25. -
types The types of the Pokémon (in icons). -
types_text The types of the Pokémon (in text). -
type1 The first type of the Pokémon -
type2 The second type of the Pokémon (if there is) -
numtypes The number of Pokémon types (1 or 2) -
weatherboosts The climates that empower the Pokémon (in icons). -
weatherboosts_text The climates that empower the Pokémon (in text). -
numweatherboosts The number of boosted climates the Pokémon has (1 or 2) -
x1weaknesses The types the Pokémon is weak to (in icons) -
x2weaknesses The types the Pokémon is doubly weak to (in icons) -
x1weaknesses_text The types the Pokémon is weak to (in text, separated by commas) -
x2weaknesses_text The types to which the Pokémon is doubly weak (in text, separated by commas) -
numx1weaknesses The number of types the Pokémon is weak to -
numx2weaknesses The number of types the Pokémon is doubly weak to -
gym The gym, with a link to the location if recognized. Link
gym_icon The location icon. -
exgym_icon The EX icon only if it is an EX gym. -
zone The area or areas of the gym. -
country The country of the trainer who created the raid. This is used to locate the raids in remote groups that allow you to create raids from all over the world and do them using invitations. -
country_flag The emoji with the flag of the country of the trainer who created the raid. -
countryregion The region of the trainer’s country that created the raid. This serves to locate raids in remote groups with a little more precision that allows you to create raids over large areas, such as an entire country or several countries. -
announcer Trainer who created the ad. Link
organizer Trainer who has organized the raid. Link
weekday_day_month Day of the week, day and month if the raid is not today. -
weekday_day Day of the week and day if the raid is not today. -
day_month Day and month if the raid is not today. -
opentime Time of the egg’s hatch. You can force a 0 in the first position if the time is a single digit by adding 0 to the beginning of the variable: 0opentime. -
lopentime Time of the egg’s hatch with a link to a local time converter. You can force a 0 in the first position if the time is a single digit by adding 0 after the leading l: l0opentime. Link
endtime Time of the raid’s boss despawns. You can force a 0 in the first position if the time is a single digit by adding 0 to the beginning of the variable: 0endtime. -
lendtime Time of the raid’s boss despawns with a link to a local time converter. You can force a 0 in the first position if the time is a single digit by adding 0 after the leading l: l0endtime. Link
raidtime Time of the raid. You can force a 0 in the first position if the time is a single digit by adding 0 to the beginning of the variable: 0raidtime. -
lraidtime Time of the raid with a link to a local time converter. You can force a 0 in the first position if the time is a single digit by adding 0 after the leading l: l0raidtime. Link
raidtime_europe/london Time of the raid in a different time zone than the one configured in the group, in this example that of Europe/London. You can put any valid IANA time zone. The time zone of your group must be configured before. You can force a 0 in the first position if the time is a single digit by adding 0 to the beginning of the variable, for example, 0raidtime_europe/london. -
lraidtime_europe/london Time of the raid in a different time zone than the one configured in the group, in this example that of Europe/London, with a link to a time converter to local time. You can put any valid IANA time zone. The time zone of your group must be configured before. You can force a 0 in the first position if the time is a single digit by adding 0 after the leading l, for example, l0raidtime_europe/london. -
timewarn Text close soon if the raid organization time is very close to closing time. -
timewarn_icon ⚠️ icon if the raid organization time is very close to the closing time. -
edited_icon 📝 icon if edited. -
edited Text edited if it is edited. -
refloated_icon Icon 🎈 if it is refloated. -
refloated Text refloated if it is refloated. -
note Text note usually added by an administrator or the raid organizer. If it is not specified in the template, it will be automatically added in the footer of the raid in case of adding a note. -
trainerscount The text with the registered trainers count and the corresponding subtotals, according to the group’s configuration. If not specified in the template, it will be automatically added just above the list of targeted trainers. -
trainerscount_all The number of total registrants (only the number). Also available are trainerscount_notremote for face-to-face trainers, trainerscount_remote for remotes (including invitees), trainerscount_invited for invited trainers; and also trainerscount_valor, trainerscount_mystic and trainerscount_instinct in case the +1 are activated by teams. -
trainerscount_pendinginvites The number of trainers that are requesting an invite and waiting for another trainer to agree to invite them. -

Format with HTML

Templates can be formatted with plain HTML, with the usual Telegram restrictions:

  • Valid tags are <i></i> (italics), <b></b> (bold), <u></u> (underlined), <s></s> (crossed out), <code></code> (fixed-width text) and <a href=""></a>(link).
  • If you want the characters <, > and & to be seen, the entities &lt;, &gt; and &amp; must be used.
  • You can put, for example, bold and underlined text at the same time, nesting the labels correctly. <u><b>Good</b></u> is correct, but <u><b>Bad</u></b> is wrong and will not work
  • Line breaks should be indicated with <br>. You can separate the elements by putting several in a row, for example <br><br>.

Remember that you are specifying code for the template, and the format that you apply directly will be ignored. That is, if you want something to be shown in bold, you must put it <b>this way</b>, but not use the bold option integrated in Telegram.

Variants of variables

To help build better messages there are versions of the variables with spaces at the beginning, with spaces at the end, in capital letters… These are the available variants:

  • {VARIABLE}: contains {variable} in uppercase.
  • {Variable}: contains {variable} forcing the first capital letter.
  • {_variable}: Contains {variable} with a leading space.
  • {variable_}: contains {variable} with a space at the end.
  • {_variable_}: contains {variable} with a space at the beginning and at the end.

Variables that put Link in the HTML column contain links. That is, {pokemon_gameinfo} will be displayed as the name of the Pokémon with a link to Gameinfo.

This type of variable can be decomposed to independently display only the text, adding _text at the end, or just the URL, adding _link at the end.

For example, the variable {pokemon_gameinfo_text} will contain the text with the name of the Pokémon and {pokemon_gameinfo_link} will contain the URL.

Conditional blocks

There are two types of conditional blocks, which allow you to show or hide parts of the models depending on the situation.

Simple Conditional Block

The simplest conditional block is written like this: ` {{text {variables} and more text}}`.

In this case, the contents enclosed in square brackets will only be shown if all variables used inside are set or true.

There are several examples of this type of block in the default template, where only a part of the text is displayed if the variable weekday_day_month is set and another part if opentime and endtime are set.

Conditional block with conditions

The other type of conditional block allows you to use complex conditions and is written like this: [condiciones]{{text {variables} and more text}}.

In this case, the content between the tabs will be displayed as soon as the conditions defined between [] are true. It doesn’t matter if the variables inside the double braces {{}} are undefined or false, the content is still displayed.

Conditions can simply be variables like opentime or isegg. They can also refuse by putting one ! in front of. For example:

[opentime]{{<em>Open between {opentime} and {endtime}</em><br>}}
[!isegg]{{🐒 Raid of <b>{pokemon_kingcasualbot} ({maxcp}/{maxcp_boosted})}}

Within the conditions, common mathematical comparators can be used: less than <, greater than >, equal to ==, different than !=, Less than or equal to <= and greater than or equal to >=. They can be used to compare variable values ​​against arbitrary values, for example:

[opentime>20:00]{{🌚 Watch out!, night raid!}}
[minutestoend<5]{{⛔️ There is very little time to make the raid, put it a little earlier!!}}
[tier==ex]{{🎟' Remember that you need a special pass to be able to do the raid, do not sign up if you do not have it!}}

The logical conjunctions can also be used: and && and or ||. In this way, several conditions can be joined to make a more complex one, for example:

[isegg && minutesfromstart<10]{{<em>🥚🚫 Several Pokémon can come out and you have set the time very close to hatching time. If you can, change the time for a little later}}
[raidispending && trainerscount_remote > 5]{{⛔️💌 <u>It is forbidden to invite anyone who is not registered!</u> }}

In case of using more than two conditions and mixing && and ||, keep in mind that they are always evaluated from left to right and this order of evaluation cannot be altered.

Variables to use in conditional blocks

All the variables described in the table above can be used as conditions. In case they have a defined value, the condition will be true. In case they do not have a defined value, the condition will be false.

In addition, there are some variables specially indicated to use as conditions, which do not print anything even if they are true:

Variable Description
isegg True if it is an egg.
ispokemon True if it is a raid boss.
isannounce True if it is an unorganized raid ad (for use with image templates).
israid True if it is an organized raid (for use with image templates).
istier5 True if it’s a level 5 boss or egg. Also available for all other levels.
hasforms True if the Pokémon has globally defined forms (one or more).
has1type True if the Pokémon has only 1 type.
has2types True if the Pokémon has 2 types.
has1weatherboost True if the Pokémon has only 1 weather boosted.
has2weatherboosts True if the Pokémon has 2 weather boosted.
ismissingform True if the Pokémon has globally defined forms (one or more) but was not chosen in the raid.
timenearopen True if the raid organization time is less than 12 minutes from the hatching time. Also available timenearend, timefaropen, timefarend and timeverynearend (like timenearend but less than 6 minutes).
pendinginvites True if there are requests for invitations pending acceptance.
maxjoined True if the maximum number of face-to-face trainers configured in the group has been reached.
maxtotal True if the maximum total number of trainers configured in the group has been reached.
maxremote True if the maximum number of remote trainers configured in the group has been reached.
maxinvited True if the maximum number of guest trainers configured in the group has been reached.
maxgametotal True if the maximum total number of trainers has been exceeded based on the limit in the game, regardless of the group configuration.
maxgameremote True if the maximum number of remote trainers has been exceeded based on the limit in the game, regardless of the group setting.
raidpending True if the raid has not yet taken place, or if it is taking place but has not been manually closed, the egg has not despawned, or a reasonable amount of time has passed since the scheduled time.
raidended True if the raid has been closed manually, or the egg has despawned, or a reasonable amount of time has passed since the scheduled time.
raidcancelled True if the raid has been canceled.
pokemon_hatchable_canbeshiny1 If the Pokémon that can hatch from the egg in position 1 can be caught shiny (they can be used from 1 to 10, to be used with the image templates).

Images Templates

Image templates allow you to add images to raids, which can be customized with information from each raid. They are disabled by default. To activate them or change them to others, use the /imagetemplate command. For example, to use the default template:

/imagetemplate default

To see the available templates or download the current template, use /imagetemplate without parameters. To stop using image templates, use the - parameter, that is:

/imagetemplate -

Image templates can also be customized. They are SVG files with a size between 600x300 pixels and 600x400 pixels. Inside, they contain text and image elements that are interpreted and replaced by the bot with the actual data from the raid or announce. Inkscape is recommended for editing (requires a Linux, Windows, or Mac computer).

To start using a custom template, send the SVG file of the template to the group, putting /imagetemplate in the description.

You can start a template from scratch, but the easiest thing is to start by taking an existing template and modifying it. With the command /imagetemplate you can download the current image template and make modifications and then use it as a custom template.

If you open a template, the linked images will show an error as the referenced file does not exist (see the section on images below). To avoid this, you can download this image pack and unzip it in the same directory where you have the template, which will facilitate editing by getting a better idea of ​​how the images look while editing.

To interpret the elements of the template, the properties id, class and some properties that start with data-, specific for each case, are used. In order to view and edit these properties you need to activate the Inkscape XML editor. Enable it in the Edit »XML Viewer… menu.

Replacements in text elements

Text elements can be interpreted, as if they were normal text templates. You cannot use conditionals of any kind. For a text element to be interpreted, it must have a class called parsetext.

Note that HTML cannot be used in images, so variables that contain links will display the HTML code. For example, the variable {gym}. To prevent the HTML from being displayed, you can use the text-only variant, ie {gym_text}.

Conditionals

Entire elements can be shown and hidden using conditionals. For an element’s conditionals to be interpreted, it must have a class called parseconditions.

Conditions must be set as the value of an attribute called data-conditions. All the conditions described in the text templates section can be used, such as isegg && minutestoend <10.

Images

In an SVG file you can embed images or link external images. If you drag an image file into Inkscape, you must tell it which of the two you want to do. If you want to include your own image (for example, a background image, or the group logo), you will want to embed it. On the contrary, if you want the image to be replaced by one of those available in the bot, you must link it.

The bot can substitute linked images to show Pokémon, Pokémon types, and more. To specify which image you want to replace, you must specify the correct identifier in the id attribute, according to the following table:

Id Descripción Relación
pokemon_img Image of the Pokémon or the egg with a more realistic scaling (according to the sprites of the game) 1:1
spokemon_img Image of the Pokémon or egg with a less realistic but more balanced alternate scaling, fully centered 1:1
dspokemon_img Image of the Pokémon or egg with a less realistic but more balanced alternate scaling, centered vertically below 1:1
pokemon_img_shiny Image of the Pokémon or the egg with a more realistic scaling (according to the sprites of the game) in its shiny variant 1:1
spokemon_img_shiny Image of the Pokémon or the egg with a less realistic but more balanced alternative scaling, fully focused, in its shiny variant 1:1
dspokemon_img_shiny Image of the Pokémon or the egg with a less realistic but more balanced alternative scaling, centered vertically below, in its shiny variant 1:1
pokemon_type1 Icon of the first type of the Pokémon 1:1
pokemon_type2 Icon of the second type of the Pokémon (if there is) 1:1
pokemon_weatherboost1 Boosted weather icon for the first type of Pokémon 1:1
pokemon_weatherboost2 Boosted weather icon for the second type of Pokémon (if there is) 1:1
pokemon_weatherboostw1 Boosted weather icon for the first type of Pokémon (in white) 1:1
pokemon_weatherboostw2 Boosted weather icon for the second type of Pokémon (if there is, in white) 1:1
pokemon_x1weakness1 Icon of the type to which the Pokémon is weak at position 1 (can be used from 1 onwards, up to 7) 1:1
pokemon_x2weakness1 Icon of the type to which the Pokémon is doubly weak at position 1 (a 1 or a 2 can be used) 1:1
pokemon_hatchable1 Image of the Pokémon that can hatch from the egg in position 1 (they can be used from 1 to 10) 1:1
spokemon_hatchable1 Image of the Pokémon that can hatch from the egg in position 1 (they can be used from 1 to 10) with a less realistic but more balanced alternative scaling, fully centered 1:1
dspokemon_hatchable1 Image of the Pokémon that can hatch from the egg in position 1 (they can be used from 1 to 10) with a less realistic but more balanced alternative scaling, centered vertically below 1:1
country_img Country flag of the raid location, similar to the country_flag in text templates. 4:3
gym_img Image of the gym (it is necessary to upload them, read the section of gym images) 1:1

If a linked image is defined with one of these id and the image does not exist, it is automatically hidden. For example, if the Pokémon only has one type but images that refer to the second type are used. Linked images that do not have any of these ids will be ignored and will show errors in the template.

Text position and size

Text elements can be repositioned vertically or resized based on the length of your text, to help accommodate text in templates. Accommodating variable-length text is tricky, and using these techniques it is difficult to achieve perfect results when using variable-width fonts, but with a little trial and error you can get good results.

To change the font size based on the length of the text, the element must have a class called resizetext. You can specify the length from which to resize by putting the length as the value of an attribute called data-resizetext-length and the desired size in data-resizetext-size. The size must be specified in units and will be applied in the CSS font-size property. For exemple:

class: resizetext
data-resizetext-length: 30
data-resizetext-size: 8px

To change the vertical position of the text based on its length, the element must have a class called movetext. You can specify the length from which the text is to be repositioned by putting the length as the value of an attribute called data-movetext-length and the desired size in data-movetext-distance. The distance must be specified without units and will be applied as the y attribute of the element. For exemple:

class: movetext
data-movetext-length: 25
data-movetext-distance: -5

Gym images

For the gym images to work, the group needs to have a spreadsheet defined and the gyms are loaded. Once that is done, you have to get the images and send them through the group within a ZIP file by putting the /gymimages command in the comment.

The images must be in JPEG format and be named as the name of the gym (first column) in the spreadsheet is set, with the extension .jpg or .jpeg at the end. Also, each image cannot exceed 300kB in size and the ZIP file cannot exceed 5MB. The ZIP file must not contain subdirectories: the images must all be in the main directory. A maximum of 300 files are processed, so if you have more gyms in your group, you will have to limit yourself to 300 of them.

Images received are only accepted if there is a gym pre-loaded with that name. Once accepted, they are resized and cut to a centered 250x250 pixel square, regardless of the original image format.

If you want to upload more images later, you have to resend them all since, each time a new ZIP file is received, all the previous ones are deleted first.

Limitations

Unlike text templates, image templates are not refreshed every time the message is updated, they are only updated when basic data of the raid changes, such as: the Pokémon, time, gym, etc. That is why variables and conditionals that refer to the number of registered trainers should not be used in the image template, since the image will not be updated properly.

The fonts that can be used are all included in this collection of Google Fonts. If you use unsupported fonts, they will look incorrect. To fix this, you can convert those texts to paths. This cannot be done if you want variables to be interpreted within the text, since when converting them to paths they stop behaving like texts.

Element ids cannot be repeated, so when using the id attribute to specify the image type, you cannot put the same linked image twice in the same template. To fix this, you can add underline _ at the end and the bot will understand it the same. That is, pokemon_img_ and pokemon_img__ work the same as pokemon_img.

Images messages take longer to generate, and depending on the server load this can spell trouble. You should try to use templates as simple as possible and, if you embed images, compress them to a suitable size first. Templates larger than 400 items or 2MB in size are automatically rejected.

Images messages on Telegram have a maximum of 1024 characters, while normal messages have a maximum of 4096 characters. With not very excessive text templates and a maximum of 20 points per raid there should be no problem, but if you don’t limit the targets in your group or put large texts in the templates, you could reach that limit and the raid would stop working. You can copy and paste the text of a raid with many points in a tool like charactercountonline.com to see the number of characters that you usually use. Keep in mind that if you put information in the image, you usually don’t want to have it duplicated in text as well, so you can remove duplicate information from text templates to save characters.

Test the templates

To facilitate template development, the SVG files of the templates can be submitted along with the description /testimagetemplate for private testing (not in a group). The bot will render the template in several different situations so you can check how it looks and correct errors.


Servers can be paid monthly thanks to the generous donations from this people and others. Even small donations help keep the server costs, so please cosider making a donation in Patreon: Tina Arroyo, Pokémon Go Tarragona, nunesrd, RAMeow, Jordi2908, CosladaGO, Incursiones Tenerife Norte, PoGo Areeiro, JosePQ24, Gcg93ZoNe, Rodrigomerakoi, TFalkenLop, RaidsAveiro, Raids PoGo Expo, PikaEle18, iF0RG0T, DarkNacKeN, chbcn, Craudiaum, Go Vallecas, Eleita, CidHigh, Pilfer, M4WD5L3Y, itsnursejessi, Hoppuz, RedKz4, Lucky383838, WaiKii