Pastebin

Use this to serve content directly from Pastebin. Useful for extending command responses.

URL

https://api.thefyrewire.com/twitch/pastebin/:id

Required Parameters

Name Type Description
id string The ID (or key) of the paste, which follows the generated paste link (e.g. https://pastebin.com/XXXXXXX). When specified alone, returns a random line from the paste. Blank lines are excluded.

Optional Query String Parameters

Name Type Description
return integer Number of lines to select and return. Specify all to return all lines (up to 100). If index is specified, it will be used as an offset, returning ordered lines. Maximum: 100. Default: 1.
separator string If specified and return is greater than 1, multiple lines are delimited by this. To use special characters such as & and +, use URL encoded characters (%26 and %2B respectively). By default, lines will be comma-separated.
select string Selects a line according to this direction. Valid values are asc/ascending or desc/descending. Default: ascending.
index integer The line number to return, based on the select direction (default: ascending). This starts from 1, so by default, an index of 1 returns the first line and when select is descending then it returns the last line.
filter string A comma-separated list of filter tags to use when selecting lines. Tags are not case-sensitive. If no lines are matched, selection will fallback to any untagged lines. By default, when specifying a tag, only lines with that tag are selected, but additionally adding untagged as a filter will force select untagged lines. See Return Filtered Lines for more information.
comments boolean Specifies whether the paste contains any comments or not, which are defined using # or //. If true, any comment lines will be ignored during selection. Default: false.
channel string The channel where the command is being used. Can be used to parse any channel variables in the paste.
user string The user calling the command. Can be used to parse any user variables in the paste.
randuser string A random user in the chat. Can be used to parse any random user variables in the paste.
randnum string A random number. Can be used to parse any random number variables in the paste.
target string A targeted user or word. Can be used to parse any target variables in the paste.
args string A comma-separated list of custom arguments. Can be used to parse any custom argument variables in the paste.

Usage & Examples

Below are some real examples of commands using real pastes.

Return Random Line From Paste

When only :id is specified, a random line is returned from the paste (excluding blank lines).

Example: Cards Against Humanity

Return a random black card (question) and a white card (answer).

Random black card

$(customapi.https://api.thefyrewire.com/twitch/pastebin/z8HGB50q)

Random white card

$(customapi.https://api.thefyrewire.com/twitch/pastebin/7zuVGunC)

Random black card

$(urlfetch https://api.thefyrewire.com/twitch/pastebin/z8HGB50q)

Random white card

$(urlfetch https://api.thefyrewire.com/twitch/pastebin/7zuVGunC)

Random black card

$readapi(https://api.thefyrewire.com/twitch/pastebin/z8HGB50q)

Random white card

$readapi(https://api.thefyrewire.com/twitch/pastebin/7zuVGunC)

Example responses

thefyrewire drew a black card... Who stole the cookies from the cookie jar?
thefyrewire drew a white card... Deez nuts.
1
2

Return Multiple Random Lines

Set a separator to glue the different lines together. If none is specified, the lines will be comma-separated. Special characters such as & and + should be URL encoded.

Example: Apex Legends Weapons Challenge

Return three random weapons the streamer must find and use (whichever two they find first, they must keep for the rest of the match). This could be a special redemption command or response.

$(customapi.https://api.thefyrewire.com/twitch/pastebin/88PmMG0B?return=3)
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/88PmMG0B?return=3)
$readapi(https://api.thefyrewire.com/twitch/pastebin/88PmMG0B?return=3)

Example responses

You may only use... Alternator (SMG), Spitfire (LMG), Triple Take (Sniper Rifle)
You may only use... Hemlok (AR), R-99 (SMG), R-301 Carbine (AR)
You may only use... Longbow (Sniper Rifle), P2020 (Pistol), Mastiff (Shotgun)
1
2
3

Example: Randomised Response Structures

Timer responses can be freshened up by randomising the structure of their contents and then separating by emotes.

Example paste

Twitter: https://twitter.com/username
YouTube: https://youtube.com/username
Instagram: https://instagram.com/username
Snapchat: username
Steam: username
Discord: https://discord.gg/channel
1
2
3
4
5
6
$(customapi.https://api.thefyrewire.com/twitch/pastebin/fGCBUU4z?return=6&separator=PogChamp)
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/fGCBUU4z?return=6&separator=PogChamp)
$readapi(https://api.thefyrewire.com/twitch/pastebin/fGCBUU4z?return=6&separator=PogChamp)

Example responses

Steam: username PogChamp Instagram: https://instagram.com/username PogChamp Discord: https://discord.gg/channel PogChamp Twitter: https://twitter.tv/username PogChamp YouTube: https://youtube.com/username PogChamp Snapchat: username
YouTube: https://youtube.com/username PogChamp Snapchat: username PogChamp Steam: username PogChamp Discord: https://discord.gg/channel PogChamp Instagram: https://instagram.com/username PogChamp Twitter: https://twitter.tv/username
1
2

Return Line By Index

Useful where you want to return lines in an ordered fashion. This returns one line at a time and cannot be combined with the return parameter (which will be overridden). The selected line is defined by the index parameter.

The direction specified by select indicates which end of the paste to start counting from. Therefore, when set to ascending, an index of 1 will return the first line, 2 returns the second and so forth. However, when set to descending, an index of 1 returns the last line, and 2 returns the second to last line.

When the end of the paste is reached, selection will cycle back through to the beginning.

REMEMBER!

index must be specified or else the command will fallback to selecting lines randomly.

Example paste

This is a response...
This is a response for later...
This is another response for after that...
1
2
3

Instead of hardcoding the index, you can combine it with a counter to cycle through a list of responses in an ordered fashion, instead of randomly. Each time the command is called or the timer is triggered, the count increments and returns the next line.

$(customapi.https://api.thefyrewire.com/twitch/pastebin/kJfx7hd4?index=$(count countername))
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/kJfx7hd4?index=$(count))
$readapi(https://api.thefyrewire.com/twitch/pastebin/kJfx7hd4?index=$count)

TIP

You can reset or offset the current line selection by using your bot's 'edit count' command.

  • StreamElements: !editcounter countername 0
  • Nightbot: !commands edit !countername 0
  • Streamlabs Chatbot: !command count !countername 0

Return Filtered Lines

Additional filtering can provide even further customised responses. To use filters, set a 'filter tag' at the start of the line, using the format: :[tag], where tag is the text you may reference later (case-insensitive). Multiple lines can be tagged and the same tag can be used multiple times. A line can be tagged multiple times with different tags using a comma-separated format: :[tag1, tag2, tag3]

Example paste

:[flying] I am a bird.
:[flying] I am a parrot.
:[flying] I am an eagle.
:[ground] I am a grizzly bear.
:[ground] I am a tiger.
:[water] I am a whale.
1
2
3
4
5
6

In the URL, set filter to be a comma-separated list of tags; the lines of which you would like to select from. For example:

$(customapi.https://api.thefyrewire.com/twitch/pastebin/gZN77mcs?filter=ground)
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/gZN77mcs?filter=ground)
$readapi(https://api.thefyrewire.com/twitch/pastebin/gZN77mcs?filter=ground)

This will randomly select a line tagged with :[ground].

Example responses

I am a tiger.
I am a grizzly bear.
1
2
$(customapi.https://api.thefyrewire.com/twitch/pastebin/gZN77mcs?filter=flying,water)
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/gZN77mcs?filter=flying,water)
$readapi(https://api.thefyrewire.com/twitch/pastebin/gZN77mcs?filter=flying,water)

This will randomly select a line tagged with either :[flying] or :[water].

Example responses

I am an eagle.
I am a whale.
1
2

If no lines are matched then the selection will fallback to any untagged lines. You can therefore provide a list of default responses without the tag.

Example paste

:[flying] I am a bird.
:[ground] I am a tiger.
:[water] I am a whale.
I don't have a tag...
I'm an alien.
1
2
3
4
5
$(customapi.https://api.thefyrewire.com/twitch/pastebin/cQX8wjvQ?filter=magical)
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/cQX8wjvQ?filter=magical)
$readapi(https://api.thefyrewire.com/twitch/pastebin/cQX8wjvQ?filter=magical)

In the example paste above, none of the lines match :[magical] and therefore one of the last two lines will be returned.

Example response

I don't have a tag...
1

You may also specify untagged as a tag, which will additionally select any untagged lines. For example, in the example paste above, specifying filter=ground,untagged will result in these possible responses:

I am a tiger.           <--- matches 'ground'
I don't have a tag...   <--- matches 'untagged'
I'm an alien.           <--- matches 'untagged'
1
2
3

TIP

You can combine filter tags with other parameters such as return (to get more than one filtered line) and select (to either get a specific filtered line or walk through them).

When specifying the untagged keyword as a filter, all untagged lines will retain their initial order in the paste.

KEEP IN MIND

If no lines are matched and no untagged lines are provided, there will be no response.

Parse Paste With Variables

Attach variables to the URL to parse them in your paste's content. This can be helpful for returning variable, customised responses. Currently, five main parameters are supported, but you may pass custom arguments using args. Additionally, you can access the filter variables in your paste. Both take the orders in which they appear in the URL.

Name Supported Paste Variables
channel $(channel), ${channel}, $channel, $mychannel
user $(user), ${user}, $user, $username, ${sender}, $(sender)
randuser $(random.chatter), ${random.chatter}, $randuser, $randusername
randnum $(random.number), ${random.number}, ${random.#}, $(random.#), $randnum
target $(1), ${1}, $(touser), $target, $targetname, $tousername
args $(args.#), ${args.#}, $args.#, $arg#
filter $(filters.#), ${filters.#}, $filters.#, $filter#

Example paste

$(user) gave everyone cookies! Sadly $(random.chatter) didn't get one...
$(user) gave $(random.chatter) $(random.#) cookies! <3
$(user) and $(random.chatter) went head to head! After the dust settled... $(user) emerged victorious!
$(user) and $(random.chatter) went head to head! After the dust settled... $(random.chatter) emerged victorious!
1
2
3
4

TIP

To keep the custom API command clean, only specify the variables your paste needs. For example, in the paste above, none of the responses use the channel variable and therefore does not need to be specified as a parameter in the URL.

However, keep in mind that if a variable is used in a response somewhere even only once, it needs to be given in the URL, on the off chance it is selected.

$(customapi.https://api.thefyrewire.com/twitch/pastebin/qrhs2wST?user=$(user)&randuser=$(random.chatter)&randnum=$(random.#))
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/qrhs2wST?user=$(user)&randuser=$(urlfetch http://2g.be/twitch/randomviewer.php?channel=$(channel))&randnum=$(urlfetch http://2g.be/twitch/randomnumber.php?defstart=1&defend=100&start=1&end=100))
$readapi(https://api.thefyrewire.com/twitch/pastebin/qrhs2wST?user=$user&randuser=$randusername&randnum=$randnum)

Example responses

thefyrewire and thefyre_bot went head to head! After the dust settled... thefyre_bot emerged victorious!
thefyrewire gave everyone cookies! Sadly ForgettableInternetGuy000 didn't get one...
thefyrewire and thefyre_bot went head to head! After the dust settled... thefyrewire emerged victorious!
thefyrewire gave StreamElements 10 cookies! <3
1
2
3
4

KEEP IN MIND

It wouldn't be recommended to mix responses using the target variable with those that don't, as it would require the user to pass a query every time they used the command, on the off chance that a response with a target variable is selected.

For example, a paste such as this:

$(user) gave $(1) a giant hug!      <--- requires a target
$(user) found a plate of cookies!   <--- no target needed
1
2

would require the user to always type !<command> <target> in case the first line is selected. If they didn't, it could return the unparsed line. (Additionally, some bots don't even send the command if a query isn't given).

The best solution is to create a separate paste with only target variable responses. This way you would know for certain a target is always needed for each line.

Using Comments

Comments can be ideal for leaving notes inside the paste or quickly removing a line from being selected while leaving it intact. Either # or // can be used to denote a comment line.

By default comments is set to false and needed to be specified in the URL.

Example paste

// This is my hello paste. I keep all my hellos here.
// Neither of these two lines will be selected.

Hello!
Henlo!
Howdy!
// Hey  <--- wasn't feeling this one, removed for now
1
2
3
4
5
6
7
$(customapi.https://api.thefyrewire.com/twitch/pastebin/e5XLEsLc?comments=true)
$(urlfetch https://api.thefyrewire.com/twitch/pastebin/e5XLEsLc?comments=true)
$readapi(https://api.thefyrewire.com/twitch/pastebin/e5XLEsLc?comments=true)

Example responses

Howdy!
Hello!
Henlo!
1
2
3

Paste Library

Check out the Paste Library for pastes you can get started with!

Last Updated: 11/21/2020, 7:56:23 PM