diff --git a/src/commands/user/UserCommand.js b/src/commands/user/UserCommand.js index 90418967e..49bb90037 100644 --- a/src/commands/user/UserCommand.js +++ b/src/commands/user/UserCommand.js @@ -181,7 +181,8 @@ export default class UserCommand extends Command { const options = await database.queryAll( 'SELECT value, COUNT(*) AS count FROM (' + - `SELECT ${database.escapeId(column)} AS value FROM moderations WHERE moderator = ? AND guildid = ? AND action = ? LIMIT 500` + + `SELECT ${database.escapeId(column)} AS value FROM moderations ` + + 'WHERE moderator = ? AND guildid = ? AND action = ? ORDER BY created DESC LIMIT 500' + ') AS results WHERE value LIKE CONCAT(\'%\', ?, \'%\') AND LENGTH(value) <= ? ' + 'GROUP BY value ORDER BY count DESC LIMIT 5;', interaction.user.id, interaction.guild.id, this.getName(), focussed.value, AUTOCOMPLETE_NAME_LIMIT);