Skip to content

Commit 5deaa4a

Browse files
committed
Sort contacts returned by list command
1 parent 4b10d88 commit 5deaa4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/discordHandler.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ const commands = {
169169
async list(_message, params) {
170170
let contacts = utils.whatsapp.contacts();
171171
if (params) { contacts = contacts.filter((name) => name.toLowerCase().includes(params.join(' '))); }
172+
contacts = contacts.sort((a, b) => a.localeCompare(b)).join('\n');
172173
const message = utils.discord.partitionText(
173174
contacts.length
174-
? `${contacts.join('\n')}\n\nNot the whole list? You can refresh your contacts by typing \`resync\``
175+
? `${contacts}\n\nNot the whole list? You can refresh your contacts by typing \`resync\``
175176
: 'No results were found.',
176177
);
177178
while (message.length !== 0) {

0 commit comments

Comments
 (0)