question

Frank DiCola avatar image
Frank DiCola asked

Can the CloudScript Server get and set Group Objects?

Hello! I just tried to do this in CloudScript and my code failed:

var groupObjectData = server.GetObjects({
        "Entity": { "Id": args.guildID, "Type": "group" }
    });

The error says...

"StackTrace": "TypeError: server.GetObjects is not a function

So I looked in the API, and I can't find a Server function that is able to, for example, Get some Group's object data, allowing me to modify it, and then Set that Group's object data. I don't really want the client to handle this, but I guess I can if I really have to?

(This feature is for my volunteer app. It's when a Group claims a shift at a soup kitchen, for example. I want to add the shift into the Group's Object data within a list of upcoming shifts so other people in the Group know about this volunteer shift that's coming up.)

If I have to do this on the client side, I will. I already know that GetObjects works. But if that's the case, my next question is: how come the server can't do this? Is the function just called something else? I thought the server had super permission to do whatever it wants?

NOTE: For the purposes of answering this question, please assume I am not ready to make the switch to Azure functions as I have not looked into that yet and I need this feature sooner rather than later. I'm a solo dev and I want to get core stuff into my business before devoting all this time to refactoring, so the Azure switch is going to take me a while.

CloudScriptentities
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

You can use entity.GetObjects to implement this feature as the Object is part of specific Entity.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Frank DiCola avatar image Frank DiCola commented ·

Thanks so much Gosen!!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.