Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » ScratchGonnect: A Scratch API wrapper for Go
- kajtolmation
-
100+ posts
ScratchGonnect: A Scratch API wrapper for Go
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.
Documentation - Source Code
> What can it do?
> How to install?
Get ScratchGonnect by running this command in your terminal:
You may need to initialize go.mod first if you haven't done that:
> Example use
Creating a new session (lets you use features that require logging in)
Posting a comment under a project
Following a user and getting a list of followers
Connect to Turowarp cloud (lets you interface with Turbowarp cloud variables)
Set a variable and listen to any value changes
More examples
> Future ideas & support
I'm open to answering any questions about ScratchGonnect under this thread. Any feature requests are more than welcome as well!
Sadly due to recent cloud variable instability I was unable to properly add cloud support to this package but it's certainly high on my priority list for future things to add.
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.
Documentation - Source Code
> What can it do?
- Easily log into new sessions and access user specific data
- Simplified access to the Scratch API (ability to easily add projects to a studio, post comments and more)
- Interface with Turbowarp cloud variables (lets you set variables and listen to variable changes)
> How to install?
Get ScratchGonnect by running this command in your terminal:
go get github.com/kejjtoli/ScratchGonnect@latest
You may need to initialize go.mod first if you haven't done that:
go mod init packagename
> Example use
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 a list of followers
// Get a user by username user := scratchgonnect.GetUser("kajtolmation") // Follow user user.Follow(*session) // Get array of user objects followers := user.GetFollowers()
Connect to Turowarp cloud (lets you interface with Turbowarp cloud variables)
// Connect to turbowarp websocket cloud := scratchgonnect.ConnectTurbowarpCloud("username", "1121839236")
Set a variable and listen to any value changes
// Sets the value of a cloud variable cloud.SetVariable("t1", 314) // 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) }
> Future ideas & support
I'm open to answering any questions about ScratchGonnect under this thread. Any feature requests are more than welcome as well!
Sadly due to recent cloud variable instability I was unable to properly add cloud support to this package but it's certainly high on my priority list for future things to add.
Last edited by kajtolmation (Jan. 19, 2025 13:58:16)
- Redstone1080
-
1000+ posts
ScratchGonnect: A Scratch API wrapper for Go
FINALLY something other than Python. Props to you!
- BartoloPL
-
39 posts
ScratchGonnect: A Scratch API wrapper for Go
This is AMAZING. :D @kajtolmation is a master.
- susak-pospolity
-
2 posts
ScratchGonnect: A Scratch API wrapper for Go
You are a genius @kajtolmation !!!
- Discussion Forums
- » Advanced Topics
-
» ScratchGonnect: A Scratch API wrapper for Go