Hello everyone! Today i wan't provide you mine notableplayers api.
Did you event saw 9kmmrbot and want's the same functionality in your NightBot? Now it possible!
Check this out http://aibt.ga!
First your step it's add your twitch channel to mine api service, just to GET request to ``http://aibt.ga/addchannel?channel=twitchchannelname&token=token``
Where token, it's your secret token, what will be used for further api requests.
You can open this url in your browser, or use any fetch client
If your channel was added to DB, then you will see successfull response
{"response": "success","channel": "added twitch channel","id": "id of added twitch channel","token": "token for api request of this channel"}
The second step it's add some dota account to your channel.
You can do it via this snippet for command response:
Create command with name !addacc, and response:
$(eval try { const api = `$(urlfetch json http://aibt.ga/api/addacc?channel=twitch channel name&token=you token&id=$(querystring))`; const response = JSON.parse(api); api['description'];} catch (e) { 'Possible this account id isn't correct, or already exists in db' })
After this just use !addacc 75438820 (for example)
Some more snippet from me:
Command name: !notableplayers
Response:
$(eval try { const api = `$(urlfetch json http://aibt.ga/api/notableplayers?channel=twitch channel name&token=you token)`; const response = JSON.parse(api); let players = response['players'].map(o => o.nickname + '(' + o.hero + ')').join(', '); `${response['gamemode']} ${response['mmr']}~mmr, Notable Players: ${players}`;} catch (e) { 'Game not found' })
And it will give you: