Discord4Fabric icon indicating copy to clipboard operation
Discord4Fabric copied to clipboard

[Bug]?? grant_role seems to always throw an error ?

Open gadget78 opened this issue 2 years ago • 6 comments

as title.. the grant_role action always seems to throw fault, showing a Invalid grant_role value format (should be object) in log .. ?

which i can see you have coded that error in for a reason .. ?

        if (!(value instanceof JsonObject jsonObject)) {
            Discord4Fabric.LOGGER.error("Invalid grant_role value format (should be object)");
            return;
        }

what would be something to look for to fix this issue ?

this mod is Soo versatile ...

gadget78 avatar Dec 01 '22 19:12 gadget78

Also having this issue, any luck?

Jayspek avatar Jan 09 '23 12:01 Jayspek

Totally forgot about this, can you send me your grant_role value in your custom events config? From the error, it seems that you've put something in the value other than an object; it's supposed to be in this format:

"value": {
    "user": "user id to grant to role to",
    "role": "role id"
}

Reimnop avatar Jan 09 '23 13:01 Reimnop

Sure! { "id": "grant_role", "value": "1061971471485902979" }

On Mon, Jan 9, 2023, 5:00 a.m. Reimnop @.***> wrote:

Totally forgot about this, can you send me your grant_role value in your custom events config?

— Reply to this email directly, view it on GitHub https://github.com/Reimnop/Discord4Fabric/issues/63#issuecomment-1375588943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZXFO636I7W6NWCF2BWS5JDWRQDWVANCNFSM6AAAAAASREVAB4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Jayspek avatar Jan 09 '23 13:01 Jayspek

That is definitely the incorrect way to do it; the correct way would be like this:

{
    "id":"grant_role",
    "value": {
        "user":"%linked_account:id%",
        "role":"1061971471485902979"
    }
}

Don't forget to also add the linked_account constraint by doing this:

"requires": [
    "linked_account"
]

Reimnop avatar Jan 09 '23 13:01 Reimnop

Oohhh, I see. Thanks for clarifying, my bad.

On Mon, Jan 9, 2023, 5:15 a.m. Reimnop @.***> wrote:

That is definitely the incorrect way to do it; the correct way would be like this:

{ "id":"grant_role", "value": { "user":"%linked_account:id%, "role":"1061971471485902979" } }

Don't forget to also add the linked_account constraint by doing this:

"requires": [ "linked_account" ]```

— Reply to this email directly, view it on GitHub https://github.com/Reimnop/Discord4Fabric/issues/63#issuecomment-1375610927, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZXFO65ED6TABMBYO2SOFL3WRQFQBANCNFSM6AAAAAASREVAB4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Jayspek avatar Jan 09 '23 13:01 Jayspek

You're welcome, apologies for the very late reply

Reimnop avatar Jan 09 '23 14:01 Reimnop