discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Onboarding prompt option id may not always be a snowflake in audit logs

Open Jiralite opened this issue 4 weeks ago • 0 comments

Description

When adding an option to an onboarding prompt, the resulting id of the option in the changes array may be an integer in the audit logs. The integer is a timestamp of when the action took place, rather than the id of the option.

Steps to Reproduce

Through the Discord client:

  1. Open onboarding settings in a server
  2. Open questions
  3. Add a question
  4. Enter a question (contents do no matter)
  5. Add an answer (contents do not matter)
  6. Save
  7. Add an answer (contents do not matter)
  8. Save

Then, run the following replacing guild_id with the guild id:

curl 'https://discord.com/api/v10/guilds/guild_id/audit-logs?limit=2' --header 'authorization: Bot <token>'

Expected Behavior

I expect to see only snowflakes for ids as outlined in the documentation:

matches object field's type

In this case, that would be this.

Current Behavior

The id of the options in the changes field is a timestamp instead of a snowflake:

{
  "audit_log_entries": [
    {
      "id": "1247877275471314957",
      "action_type": 163,
      "user_id": "618976181026422814",
      "target_id": "1247877275471314956",
      "changes": [
        { "key": "id", "new_value": "1247877275471314956" },
        {
          "key": "title",
          "new_value": "What do you want to do in this community?"
        },
        {
          "key": "options",
          "new_value": [
            {
              "id": 1717587520169,
              "title": "Test1",
              "description": "",
              "emoji_id": null,
              "emoji_name": null,
              "emoji_animated": null,
              "emoji": { "id": null, "name": null, "animated": false },
              "role_ids": [],
              "channel_ids": ["1247864726659141675"]
            },
            {
              "id": 1717587525669,
              "title": "Test2",
              "description": "",
              "emoji_id": null,
              "emoji_name": null,
              "emoji_animated": null,
              "emoji": { "id": null, "name": null, "animated": false },
              "role_ids": [],
              "channel_ids": ["1247864726659141675"]
            }
          ]
        },
        { "key": "single_select", "new_value": false },
        { "key": "required", "new_value": false },
        { "key": "in_onboarding", "new_value": true },
        { "key": "type", "new_value": 0 }
      ]
    },
    {
      "id": "1247877275471314954",
      "action_type": 167,
      "user_id": "618976181026422814",
      "target_id": null,
      "changes": [
        {
          "key": "prompts",
          "new_value": [
            {
              "id": 1717587512453,
              "title": "What do you want to do in this community?",
              "options": [
                {
                  "id": 1717587520169,
                  "title": "Test1",
                  "description": "",
                  "emoji_id": null,
                  "emoji_name": null,
                  "emoji_animated": null,
                  "emoji": { "id": null, "name": null, "animated": false },
                  "role_ids": [],
                  "channel_ids": ["1247864726659141675"]
                },
                {
                  "id": 1717587525669,
                  "title": "Test2",
                  "description": "",
                  "emoji_id": null,
                  "emoji_name": null,
                  "emoji_animated": null,
                  "emoji": { "id": null, "name": null, "animated": false },
                  "role_ids": [],
                  "channel_ids": ["1247864726659141675"]
                }
              ],
              "single_select": false,
              "required": false,
              "in_onboarding": true,
              "type": 0
            }
          ],
          "old_value": [
            {
              "id": "1247877253589762132",
              "title": "What do you want to do in this community?",
              "options": [
                {
                  "id": "1247877253589762135",
                  "title": "Test1",
                  "description": "",
                  "emoji_id": null,
                  "emoji_name": null,
                  "emoji_animated": null,
                  "emoji": { "id": null, "name": null, "animated": false },
                  "role_ids": [],
                  "channel_ids": ["1247864726659141675"]
                }
              ],
              "single_select": false,
              "required": false,
              "in_onboarding": true,
              "type": 0
            }
          ]
        }
      ]
    }
  ],
  "users": [
    {
      "id": "618976181026422814",
      "username": "jiralite",
      "avatar": "ea3dd3dc616ab68fefd434eae6957bb7",
      "discriminator": "0",
      "public_flags": 4210944,
      "flags": 4210944,
      "banner": null,
      "accent_color": null,
      "global_name": "Jiralite",
      "avatar_decoration_data": null,
      "banner_color": null,
      "clan": null
    }
  ],
  "integrations": [],
  "webhooks": [],
  "guild_scheduled_events": [],
  "threads": [],
  "application_commands": [],
  "auto_moderation_rules": []
}

In this payload for example, audit_log_entries[0].changes[2].new_value[0].id is a timestamp—not an id.

Screenshots/Videos

No response

Client and System Information

curl 8.6.0 (x86_64-apple-darwin23.0) libcurl/8.6.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.61.0

Jiralite avatar Jun 05 '24 11:06 Jiralite