This is a discord bot to facilitate access to league of legends information.
Features:
- Access time spent on League of Legends using information on wol.gg
- Access runes for each champion using information scraped from op.gg
Commands:
- -ping Pings to check if bot is working
- -timespent "Summoner Name" Checks amount of time spent on league of legends
- -runes "Champion Name" Returns an image of the runes specific to the selected champion
Installation:
-
Clone file and run npm install -y npm install puppeteer npm install discord.js
-
Open https://discord.com/developers/applications , create a new application and copy token
-
Paste token at bottom of main.js
-
Add the bot to your server
-
In the terminal, run node . , if it does not work, run node main.js
-
Congratulations, the bot should be active!
How I made it:
- Created main.js to interact with the discord api and handle messages and commands given in the channel.
- Created scrapenames.js to scrape the name of each champion and used the fs library to write them into the champNames.txt file.
- Created scrapeRunes.js to scrape the div element on op.gg/champions containing the runes and used puppeteer's screenshot feature to save the image to a folder on my computer.
- Uploaded all the images scraped by using scrapeRunes on each element in champNames.txt onto a github repository to store the images
- Used the discord api's MessageEmbed feature to send the image of the runes using a link to the champion's respective image in the repository.