Skip to content

Creating and Reading Pastes

Ankoki edited this page Mar 25, 2021 · 1 revision

Creating a paste is very very simple!

First of all, you will need your PastebinAPI developer key! You can get that from this website, you must be logged in! I recommend you put this in an option as if you ask people for help you may share your developer key by accident!
We are going to use a basic command as an example, each line has a comment to explain what's happening!

options:
    devKey: "mySuperSecretLongAsfDevKey"

command /paste:
    trigger:
        create a new paste with the id "%player%'s paste"                                  #creates a new paste with that id
        set {_paste} to the paste with the id "%player%'s paste"                           #makes it easier to write the other syntax
        set {_paste} to expire in 1 hour                                                   #by default, pastes will never expire, so you can specify here
        set the title of {_paste} to "%player%'s Pastebin!"                                #sets the title of the paste
        set the text of {_paste} to "Hello! This is a test pastebin made with SkJade!"     #sets the text of the paste
        make {_paste} be public                                                            #by default they are public, however they can be unlisted or private
        build {_paste} with the dev key {@devKey}                                          #your developer key is individual to you
        wait 1 tick                                                                        #we wait a tick to make sure the pastebin is created, and that the last built paste is set!
        send the link of the last built paste                                              #sends the pastebin link of the paste that you just built

It's very simple yuhyuh i don't know how to properly explain stuff but hopefully that made at least a little bit of sense!

Reading pastes is even simpler!

options:
    devKey: "mySuperSecretLongAsfDevKey"

command /read:
	trigger:
		send the paste response from "bpgexBcS" with the dev key {@devKey}

The key is the last letters on a pastebin link. for example, bpgexBcS comes from pastebin.com/bpgexBcS

You may have some issues with creating a pastebin, such as this:

[18:37:20 INFO]: There was an error building your paste! Server returned HTTP response code: 422 for URL: https://pastebin.com/api/api_post.php

There are a few reasons which could have happened, and here are the ones i know of so far:

  • You can only create a maximum of 10 pastes per day, per IP.
  • You are trying to read a private paste. Support for reading these may be added in the future, however not forseeable.
  • Your API Key is most likely wrong, make sure it is right!