Closed TimMcCool closed 4 weeks ago
Generally, I'll try to increase consistencies in how scratchattach's classes work in v2.0.
I'll also make it so if you (for example)
1) run session.connect_user to get a User object and then
2) run user.followers() method to get the user's followers as list
any methods requiring authentication will also work on the objects returned in step 2). Your session will be connected to all objects you get from an object where your session is connected, so you can flawlessly follow all users returned from user.followers, user.following etc. without having to run session.connect_user on them (the same will also apply to projects, studios etc.)
Oh! I like this so this whats you been doing this entire time!
You should add support for Multiple clients to run and if one goes down it can be redirected to an other client and you can also make it like a url that it requests things from one server or node like what I was planning to do with ScratchAttach Nexor
Are you using the profile comment api to get username by userid?
Am Mi., 25. Sept. 2024 um 19:13 Uhr schrieb mas6y6 @.***
:
You should add support for Multiple clients to run and if one goes down it can be redirected to an other client and you can also make it like a url that it requests things from one server or node like what I was planning to do with ScratchAttach Nexor
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2374680341, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZUW54RVIY44WYXPPK3ZYLVMDAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZUGY4DAMZUGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Are you using the profile comment api to get username by userid? Am Mi., 25. Sept. 2024 um 19:13 Uhr schrieb mas6y6 @. … : You should add support for Multiple clients to run and if one goes down it can be redirected to an other client and you can also make it like a url that it requests things from one server or node like what I was planning to do with ScratchAttach Nexor — Reply to this email directly, view it on GitHub <#242 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZUW54RVIY44WYXPPK3ZYLVMDAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZUGY4DAMZUGE . You are receiving this because you are subscribed to this thread.Message ID: @.>
Yes. I'm planning to first check if the ID can be found in a DB run by PhilHub, and then use the profile comment API. (I'll put a warning saying that the API creates a message and shouldn't be used in large-scale)
You can just delete the comment to delete the message
Tim @.***> schrieb am Mi., 25. Sept. 2024, 21:02:
Are you using the profile comment api to get username by userid? Am Mi.,
- Sept. 2024 um 19:13 Uhr schrieb mas6y6 @. … <#m596885099696569768> : You should add support for Multiple clients to run and if one goes down it can be redirected to an other client and you can also make it like a url that it requests things from one server or node like what I was planning to do with ScratchAttach Nexor — Reply to this email directly, view it on GitHub <#242 (comment) https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2374680341>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZUW54RVIY44WYXPPK3ZYLVMDAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZUGY4DAMZUGE . You are receiving this because you are subscribed to this thread.Message ID: @.>
Yes. (I'll put a warning saying that the API creates a message and shouldn't be used in large-scale)
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2374928960, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZWEARA357VF54MU4OLZYMCCVAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZUHEZDQOJWGA . You are receiving this because you commented.Message ID: @.***>
The rate limit for posting comments isn't active when the new comment is deleted, this makes it possible to use the method for getting a user by id without having to implement a cooldown
So it's even better
Tim @.***> schrieb am Mi., 25. Sept. 2024, 23:17:
The rate limit for posting comments isn't active when the new comment is deleted, this makes it possible to use the method for getting a user by id without having to implement a cooldown
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2375278176, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZTYZ7UEC3VZFTYTS73ZYMSAHAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVGI3TQMJXGY . You are receiving this because you commented.Message ID: @.***>
I do beg your pardon; Does Session.create_project create a project? If so, is this not a bot-performed social action?
Maybe .push or .send would be better than .ping
An option for using proxies will be part of v2.0
I saw a couple of bugs in the code, I'll make a fix pull request soon.
the info in this post was wrong
Don't you mean parent_id?
Tim @.***> schrieb am Sa., 28. Sept. 2024, 15:08:
It appears that when replying to a project / studio comment, the commentee_id field has to be set or else the comment won't be loaded by the UI (it still can be accessed through the API tho)
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2380634634, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZSNSB3G2KJTTTEUBEDZY2S3LAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBQGYZTINRTGQ . You are receiving this because you commented.Message ID: @.***>
Don't you mean parent_id? Tim @.> schrieb am Sa., 28. Sept. 2024, 15:08: … It appears that when replying to a project / studio comment, the commentee_id field has to be set or else the comment won't be loaded by the UI (it still can be accessed through the API tho) — Reply to this email directly, view it on GitHub <#242 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZSNSB3G2KJTTTEUBEDZY2S3LAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBQGYZTINRTGQ . You are receiving this because you commented.Message ID: @.>
I meant commentee_id. I thought the empty commentee_id was the reason my comments replying to a reply were not displayed, but the actual reason was that Scratch only loads comments replying to a top-level comment.
I just discovered that when commenting in the replies of a project / studio comment, Scratch will always use the comment_id of the top-level comment as parent_id - even when replying to a reply.
Scratch never uses the comment_id of reply as parent_id, and comments where the parent_id leads to a reply won't be loaded because Scratch only loads the first "layer" of replies.
i genuinely cant wait for this version
other.project_json_capabilities.ProjectBody (a class parsing and saving project json) is now fully working (I tested it with big projects like my among us remake), but there's still room for improvement (methods like sprite.add_var
etc. could be added) and there may still be bugs. Feel free to contribute features / bug fixes
I know one thing to do is to connect multiple sockets, then you can bypass the cloud limit:
import scratchattach
import random
import time
class SubSession:
def __init__(self):
self.session = scratchattach.Session("nuhu", username="banddans")
self.conn = self.session.connect_cloud("1234")
def set_the_variable(self):
self.conn.set_var("CLOUD", random.randint(0, 100))
sessions = []
for i in range(3):
sessions.append(SubSession())
i = 0
while True:
sessions[i%3].set_the_variable()
time.sleep(1/30)
i += 1
I know one thing to do is to connect multiple sockets, then you can bypass the cloud limit:
I found out that you can set multiple cloud variables simultaneously (in one websocket message - cloud.set_vars(var_value_dict)
will be added in v2.0), this probably makes it unnecessary to use multiple connections
Wasn't the limit 2 variables at a time?
Tim @.***> schrieb am Do., 3. Okt. 2024, 23:28:
I know one thing to do is to connect multiple sockets, then you can bypass the cloud limit:
import scratchattachimport randomimport time class SubSession: def init(self): self.session = scratchattach.Session("nuhu", username="banddans") self.conn = self.session.connect_cloud("1234")
def set_the_variable(self): self.conn.set_var("CLOUD", random.randint(0, 100))
sessions = []for i in range(3): sessions.append(SubSession()) i = 0while True: sessions[i%3].set_the_variable() time.sleep(1/30) i += 1
I found out that you can set multiple cloud variables simultaneously (in one websocket message - cloud.set_vars(var_value_dict) will be added in v2.0), this probably makes it unnecessary to use multiple connections
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2392370162, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZTIKXFGABGV65EQVZDZZWZIZAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJSGM3TAMJWGI . You are receiving this because you commented.Message ID: @.***>
I know one thing to do is to connect multiple sockets, then you can bypass the cloud limit:
I found out that you can set multiple cloud variables simultaneously (in one websocket message -
cloud.set_vars(var_value_dict)
will be added in v2.0), this probably makes it unnecessary to use multiple connections
Can you do that from scratch too somehow or is it just a strange bug?
Actually there's no limit for how many cloud variables can be set simultaneously, but you should wait 06667 * n seconds between cloud variable sets (when setting n cloud variables simultaneously) to avoid getting ratelimited. I found this out experimentally.
If you wait shorter, you'll be able to set cloud variables much faster for a few seconds (I was able to perform 32 cloud variable sets in a second), but then you'll be ratelimited for another few seconds, and while you're ratelimited your cloud variable sets are ignored by the server.
You can't do it from Scratch
I just did some more tests and it looks like when setting cloud variables while waiting less than 0.1 * n between sets, it only works for about 2 - 3 minutes, and then you'll still be ratelimited for a few seconds.
I'll make scratchattach automatically increase the wait time after a while to prevent this.
Maybe also add type annotations
I feel like using threading.Event would be more appropriate than threading.Condition
True. I'll use threading.Event instead
scratchattach 2.0 will be released on Friday (10/11/24)
That date has already passed
Tim @.***> schrieb am So., 6. Okt. 2024, 06:44:
scratchattach 2.0 will be released on Friday (10/06/24)
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2395292083, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATCKMZWLATYE7ZO5LPXJ75TZ2C53PAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGI4TEMBYGM . You are receiving this because you commented.Message ID: @.***>
scratchattach 2.0 is complete now. I decided to cancel asyncio cloud requests because I didn't have time for implementing them (and now that threading.Event has been implemented, they're already much less resource intensive). I'll maybe add them later.
If you want to contribute to the library by implementing these yourself, you're free to do so by submitting a pull request to the v2 branch (I suggest creating a new CloudRequestsAsync class that inherits from CloudRequests and overrides methods where it is needed to implement asyncio. Doesn't have to be bug-free).
Tomorrow I'll update the docs and release v2.0
Update???
sorry, my university semester started and now i have very little time to work on this. I'll try to finish the docs this weekend
Good luck with university!
On Thu, Oct 17, 2024 at 2:27 AM Tim @.***> wrote:
sorry, my university semester started and now i have very little time to work on this. I'll try to finish the docs this weekend
— Reply to this email directly, view it on GitHub https://github.com/TimMcCool/scratchattach/issues/242#issuecomment-2418633746, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJAV6RFZEC5UV46Q74GJS53Z35KFLAVCNFSM6AAAAABO2X47SKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJYGYZTGNZUGY . You are receiving this because you commented.Message ID: @.***>
scratchattach 2.0.0 is released now! Use pip install -U scratchattach
to update.
Good luck with university! …
Thanks!
What are you studying?
What are you studying?
computer science
New / updated features in 2.0 (will be released in early October 2024)
These are only ideas for now. I don't know yet how many of these I'll actually implement. If you want to help by submitting a pull request, please choose the v2 branch as base.
New classes related to the Scratch Community:
New cloud classes:
New common methods:
Project JSON editing capabilities:
New features for cloud requests:
- add asyncio cloud requestscanceledOther stuff: