Closed bruno-miguelito closed 6 years ago
I am looking at https://developer.clashofclans.com/#/documentation and I don't see this option... please tell me more....
You can parse the memberlist and find the member with role equals to "leader" :)
My intention with this repo is be a simple layer over existing API. Since there is no way to request this kind of filtering, it must be done after the request, e.g.
const promiseLeader = client
.clanMembersByTag('#ABC123')
.then(response => response.items)
.then(clanMembers => clanMembers.find(m => m.role === 'leader'));
(untested)
100% agree with you ! This is what I was thinking when I said parse the memberlist.
I should have mentioned it in my message.
For me it did not work, return [object Promise]. But it was something of the sort that was asking if he had how to do it
For me it did not work, return [object Promise]. But it was something of the sort that was asking if he had how to do it
returning a promise is not a bug, but an intended feature.
client
.clanMembersByTag('#UPC2UQ')
.then(response => response.memberList)
.then(clanMembers => clanMembers.find(m => m.role === 'leader'))
.then(leader => console.log(leader));
^ tested, works
All right.... I am going to close this issue as the code I posted works for me. I am trying to keep this library simple and focus just on requests and not data transformation.
How can I filter the Clan Leader? You could have the option: clan.leader