anipalur / anipalur/gce-a-levels-bot

Log command and button usage before they are executed

Abierto
#11 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug good first issue
Lenguaje dominante
JavaScript
Estrellas
1
Forks
1
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Discord Username

Not specified.

### Bug Description

When a command or button is used, a log message is only posted to the console *after* its [`execute()` function](https://github.com/anipalur/gce-a-levels-bot/blob/0dcbee9af737350b7f70bcff5dc07de1969a571c/src/events/interaction-create.js#L145 "View an example of an execute() function.") is called. This is a problem if, for example, a user uses a button that prompts for confirmation. A [log message](https://github.com/anipalur/gce-a-levels-bot/blob/0dcbee9af737350b7f70bcff5dc07de1969a571c/src/events/interaction-create.js#L148 "View an example of a log message.") is only posted after the collector on the confirmation message ends, which can be up to 15 minutes later.

For reference:

https://github.com/anipalur/gce-a-levels-bot/blob/0dcbee9af737350b7f70bcff5dc07de1969a571c/src/events/interaction-create.js#L145-L148

### Steps to Reproduce

1. Use a command or button, e.g. a button that prompts for confirmation.
2. Terminate the command or button early, e.g. by cancelling the confirmation.
3. Take note of when the log message is posted.

### Expected Behaviour

The log message to be posted immediately after a command or button is used.

### Relevant Log Output

```shell
Log Message Posted After: 8.717s
anipalur used the close-suggestion button in #Test.
```

### Relevant Screenshots

None.

### Additional Information

Add this to [`interaction-create.js`](https://github.com/anipalur/gce-a-levels-bot/blob/0dcbee9af737350b7f70bcff5dc07de1969a571c/src/events/interaction-create.js#L148 "View when a button's execute() function is called."):

```js
console.time('Log Message Posted After');

await button.execute(interaction, client, user);

console.timeEnd('Log Message Posted After');
```

### Code of Conduct

- [X] I agree to abide by the Code of Conduct.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.