'Autocode - user storage

I have such a problem. I have a command / role where the menu comes out and there admin can choose a certain role for the user who created the command. But the problem is that when someone creates the command second and I want to cast the role to the first user who used the command, then it gives the role to the last user, see photo. Does anyone please know how to solve this problem? Thank youenter image description here

Prefix code:

const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});

const uzivatel = context.params.event.author.id;


await lib.utils.kv.set({
  key: `uzivatel`,
  value: `${context.params.event.author.id}`
});

console.log();

await lib.discord.channels['@0.2.0'].messages.create({
  "channel_id": `${context.params.event.channel_id}`,
  "content": "",
  "tts": false,
  "components": [
    {
      "type": 1,
      "components": [
        {
          "style": 1,
          "label": `Nahodit roli`,
          "custom_id": `poslat`,
          "disabled": false,
          "emoji": {
            "id": null,
            "name": `📧`
          },
          "type": 2
        }
      ]
    }
  ],
  "embeds": [
    {
      "type": "rich",
      "title": "",
      "description": `Zkouška aby vše fungovalo jak ma`,
      "color": 0x00FFFF
    }
  ]
});

Buttons code:

const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});

let uzivatel = await lib.utils.kv.get({
  key: `uzivatel`
});


console.log()
await lib.discord.channels['@0.2.0'].messages.create({
  "channel_id": `${context.params.event.channel_id}`,
  "content":  `Uspesne si nahodil roli: <@${uzivatel}>`,
  "tts": false
});
console.log();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source