question

userzaqo avatar image
userzaqo asked

How to use playfab properties

Bonjour j'ai un petit problème, je me suis documenter sur le Ban event et je veux utiliser la methode POST (https://docs.microsoft.com/en-us/gaming/playfab/api-references/events/player-banned) afin de pouvoir avoir les notifications sur mon Discord mais mon code ne fonctionne pas, je suis pas très experimenter mais je voulais savoir pourquoi ça ne marche pas.

handlers.newUserBan = function(args, banId){


    var contentBody = {
  "content": null,
  "embeds": [
    {
      "description": `Click [**here**](https://developer.playfab.com/en-US/c/D0817/players/${currentPlayerId}/bans) if you want to unban this player or view his personal profile`,
      "color": 16711680,
      "fields": [
        {
          "name": "Username :",
          "value": "DisplayName
        },
        {
          "name": "PlayerID :",
          "value": currentPlayerId
        },
        {
          "name": "Ban Reason :",
          "value": BanReason
        },
        {
          "name": "Ban Expiration :",
          "value": BanExpiration
        },
        {
          "name": "BanId",
          "value": BanId
        }
      ],
      "author": {
        "name": "ᴘʟᴀʏᴇʀ ʙᴀɴɴᴇᴅ"
      },
      "thumbnail": {
        "url": "https://i.ibb.co/8z3MrYC/www.png"
      }
    }
  ]
}

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.

userzaqo avatar image userzaqo commented ·

btw ("DisplayName) its just missclick when i paste it and the banID

0 Likes 0 ·

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

This is an English forum, we only provide support in English. The answer is based on Microsoft Translator. If there are any misunderstanding, please feel free to let us know.

According to your description, I think your workflow is correct. When a player has been banned, an event call player-banned will be triggered. Then you can create a Rule to trigger a CloudScript to send the message to yourself.

Here is the thing. I think the Discord you mentioned is a chat application. The code you provide looks like PlayFab CloudScript, but I can’t find any requests to the Discord. You should implement a method to send the message to Discord or other service.

10 |1200

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

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.