#how to allow commands only for admin?
8 messages · Page 1 of 1 (latest)
i use that, but not work
whats your requirement
My advice for you is to read the documentation and explore the example.js. Your code has some misconceptions
I want the ,tagall command to only be used by admins
I've done that, but my understanding is still lacking
You can get all of the participants using
const chat = await msg.getChat() // add "as GroupChat" if you're using typescript
const participants = chat.participants
Then filter the list of the participants to get the admins
const admins = participants.filter(p=>p.isAdmin)
You can get the map the admins to become a simple ["[email protected]"] list with
const adminMapped = admins.map(a=>a.id.user)
// it should return ["[email protected]", "[email protected]"] etc.