Home > Mobile >  Faster and cleaner way to update Discord Message Embed with a MessageComponentInteraction collector
Faster and cleaner way to update Discord Message Embed with a MessageComponentInteraction collector

Time:05-02

I'm trying to make a horse race command for my discord bot (TypeScript). The code itself works fine, but I have to update an embed which contains the race and the participants. The thing is that for it to properly update, I have to set its description every time that collector.on("collect") fires. I want to ask if there's a better, more efficient and cleaner way to update it. Thank you!
code:

    const bet = interaction.options.get("bet").value;

    class Horse {
      name: string;
      owner: User;
      speed: number;
      position: Array<string>;
      constructor(name: string) {
        this.name = name;
        this.owner = null;
        this.speed = 0;
        this.position = ["           
  • Related