/ src / preconditions / waitTwenty.ts
waitTwenty.ts
 1  import { Precondition } from 'amethystjs';
 2  
 3  export default new Precondition('waitTwentySeconds').setButtonRun(({ button, message }) => {
 4      const diff = Date.now() - message.createdTimestamp;
 5      if (diff < 20000) {
 6          const list = '🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜🕝🕞🕟🕠🕡🕢🕣🕤🕥🕦🕧';
 7          const emoji = list[Math.floor(Math.random() * list.length)];
 8  
 9          return {
10              ok: false,
11              type: 'button',
12              message: 'Wait twenty seconds',
13              metadata: {
14                  message: button.client.langs.getText(button, 'preconditions', 'waitTwenty', { emoji })
15              },
16              button
17          };
18      }
19      return {
20          ok: true,
21          type: 'button',
22          button
23      };
24  });