Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const tmi = require('tmi.js');
- const https = require('https');
- var client = new tmi.client({
- connection: {
- cluster: 'aws',
- reconnect: true
- },
- identity: {
- username: 'fyllebot',
- password: 'oauth:p46cdt86ufuxuto2crss9qj9bggvg2'
- },
- channels: ['salpsan90']
- });
- client.connect();
- client.on('chat', (channel, user, message, self) => {
- if (message === '!rank') {
- https.get('https://euw1.api.riotgames.com/lol/league/v3/positions/by-summoner/19496157?api_key=RGAPI-149ef877-9f97-4c98-ab26-bb738cea5bb9', (res) => {
- res.setEncoding('utf8');
- let body = '';
- res.on('data', data => {
- body += data;
- });
- res.on('end', () => {
- body = JSON.parse(body);
- const flex = body.find(ch => ch.queueType === 'RANKED_FLEX_SR'),
- solo = body.find(ch => ch.queueType === 'RANKED_SOLO_5x5');
- client.action('salpsan90', 'Solo rank:' + solo.tier + ' ' + solo.rank + '(' + solo.leaguePoints + 'lp) , flex rank: ' + flex.tier + ' ' + flex.rank + '(' + flex.leaguePoints + 'lp)');
- });
- });
- } else {
- console.log(message);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement