Skip to content

Commit c7f41d3

Browse files
authored
Merge pull request #43 from carlos3g/master
[REFACTOR][FIX] updates !commands & throws an error when a private chat is passed to getAdmsList
2 parents 8813093 + 5adf115 commit c7f41d3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/commands/commands.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ Lista todos os comandos disponíveis.
1010

1111
availableCommands: `
1212
Os seguintes comandos estão disponiveis:
13-
- !bot
13+
- !about
1414
- !coin
1515
- !commands
1616
- !cron
17-
- !doc
1817
- !links
1918
- !lyric
2019
- !report

src/utils/chattools.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ async function getMembersList(chat) {
2929
* @returns {string[]} - Serialized phone numbers of all administrators.
3030
*/
3131
async function getAdmsList(chat) {
32+
if (!chat.isGroup) {
33+
throw new Error(`This chat isn't a group.`);
34+
}
35+
3236
const members = await chat.participants;
3337
const admsIdList = members.filter((id) => id.isAdmin);
3438
const admsSerialList = getSerialList(admsIdList);

0 commit comments

Comments
 (0)