Discord4Fabric

Discord4Fabric

683 Downloads

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

gadget78 opened this issue · 6 comments

commented

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 ...

commented

You're welcome, apologies for the very late reply

commented

Also having this issue, any luck?

commented

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"
}
commented
commented

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"
]
commented