-
Notifications
You must be signed in to change notification settings - Fork 51
Migrating to v2
TheCommCraft edited this page Jul 6, 2025
·
11 revisions
Scratchattach v2 is not backwards compatible. But upgrading is worth it, because it comes with many new features.
This page lists the main non-backwards-compatible changes to make it easier for you to upgrade. If you're running into unexpected errors, check the documentation to find out how the specific feature works in scratchattach v2.
- Generally,
scratchattachis now imported as / referenced assa(no longer asscratch3) in the docs. -
session = scratch3.Session("session_id")was changed tosession = sa.login_by_id("session_id") -
events = scratch3.CloudEvents("project_id")was changed toevents = sa.get_cloud("project_id").events() -
client = scratch3.CloudRequests(conn)was changed toclient = session.connect_cloud("project_id").requests() -
value = scratch3.get_var("project_id", "variable")was changed to
cloud = sa.get_cloud("project_id") # This function is ran once
value = cloud.get_var("variable") # This function can safely be called in a loop without spamming an APIThe same applies to getting TurboWarp cloud variables.
- All comments are now represented by
sa.Commentobjects - All activites and messages are now represented by
sa.Activityobjects - Projects and studios are now always represented by
sa.Projectandsa.Studioobjects, never as dicts - project.get_comment was changed to project.comment_by_id
- Generally, many functions that used to start with ".get_" had the "get_" removed from their names.
- If an attribute refers to a username, it is now always ".username" and not ".user"
-
CloudConnectionandTwCloudConnectiondon't exist anymore. Instead, there are nowCloudandTwCloudobjects that not only handle setting cloud variables, but also have built in functions for getting variables very frequently without spamming the API (new CloudRecorder infrastracture). -
TwCloudEventsandWsCloudEventswere merged intoCloudEvents. The formerly calledCloudEventsare nowCloudLogEvents -
TwCloudRequestsandCloudRequestswere merged intoCloudRequests - All events are now always ran in threads by default. You can disable this using
@events.event(thread=False) - Cloud Request Events don't use the
idattribute anymore. Instead, they use therequest_idattribute.