Send Scratch API requests with ease.
ScratchGonnect is a Scratch API wrapper written in Go and allows you to easily and quickly interface with the Scratch API. It allows you to post comments, change project data and much more.
Run this command in your terminal in order to use this package
go get github.com/kejjtoli/ScratchGonnect@latest
Creating a new session (lets you use features that require logging in)
// Log into a scratch session
session := scratchgonnect.NewSession("username", "pass")
Posting a comment under a project
// Get a project by id
project := scratchgonnect.GetProject("535962801")
// Post comment with given content, parent_id, commentee_id
project.PostComment(*session, "Comment Content", "", "")
Following a user and getting his followers
// Get a user by username
user := scratchgonnect.GetUser("kajtolmation")
// Follow user
user.Follow(*session)
// Get array of user objects
followers := user.GetFollowers()
Connecting to Turbowarp cloud
// Connect to turbowarp websocket
cloud := scratchgonnect.ConnectTurbowarpCloud("username", "1121839236")
Setting a cloud variable
// Sets the value of a cloud variable
cloud.SetVariable("t1", 314)
Listening to cloud variable changes
// Listens to all set variable messages
cloud.Listen(cloud_listener)
// Prints out name and new value of changed variable
func cloud_listener(connection *scratchgonnect.CloudSocket, variable_name string, value int) {
fmt.Println(variable_name, value)
}
More examples in examples/example.go file
ScratchGonnect is licensed under the GPL-3.0 license and is free to use and open-source.