-
Notifications
You must be signed in to change notification settings - Fork 66
Templating in actions
Rico edited this page Feb 2, 2020
·
4 revisions
You can use a template string into which the paste variables will then be inserted. Simply provide a template
string to the actions which support templating. The following variables will be substituted with the corresponding value of the paste.
Variable | Description | Example Value |
---|---|---|
${title} |
Title of a paste | Once we all know when we goto function |
${body} |
Content of a paste | This is the content |
${key} |
Unique identifier of a paste | 0CeaNm8Y |
${size} |
Size of a paste in bytes | 890 |
${user} |
Uploader of a paste | admin |
${date} |
Date of uploading as unix timestamp | 1442911802 |
${expire} |
Expiration date of a paste | 1442998159 |
${syntax} |
Syntax of a paste | java |
${scrape_url} |
Scraping URL provided by pastebin | https://scrape.pastebin.com/api_scrape_item.php?i=0CeaNm8Y |
${full_url} |
Normal (public) URL of the paste | https://pastebin.com/0CeaNm8Y |
${analyzer_name} |
Name of the analyzer, which matched a paste | WordAnalyzer (Spotify) |
Note: You can utilize **kwargs
and pass any variable/content to the templating engine. For example: TemplatingEngine.fill_template(paste, analyzer_name, template_string, any_var="Custom content")
- with this call you can replace all occurrences of ${any_var}
in the template string with Custom content
.
Example template: A new paste uploaded by ${user} has been matched by ${analyzer_name}
Example output: A new paste uploaded by admin has been matched by WordAnalyzer (Spotify)