I play the game RuneScape and I also use the chat service Discord. Sometimes when I have a conversation with someone on RuneScape, I get interrupted so I have to stop playing, but I still want to have the conversation and ensure that I don't miss anything. This program allows one to continue RuneScape conversations through Discord.
What it does
It syncs the RuneScape and Discord chat so that whatever goes into RuneScape, comes out of Discord, and whatever goes into Discord, comes out of RuneScape. It does this because it is both a RuneScape bot and a Discord bot at the same time, so it can monitor both chats.
How I built it
I used the node.js package Puppeteer to simulate a user going on the RuneScape website and chatting with people. For the Discord features, I used discord.js to monitor a Discord server's chat.
Challenges I ran into
RuneScape doesn't officially support this, so I had to simulate the RuneScape webpage with Puppeteer, sign into RuneScape and parse the HTML data that holds the messages.
Accomplishments that I'm proud of
I'm glad that I was able to make the bot notice when a new message was sent in the RuneScape chat while ignoring old messages.
What I learned
I learned how to simulate webpages with Puppeteer, and hopefully this allows me to make cool bots like this in the future.
What's next for RuneScape-Discord Chat Sync
I hope to make the code more efficient so that it doesn't have to constantly read the HTML data and look for a new message. Ideally, it would be more event based so that when a new message comes into the RuneScape chat, it could handle it from the event instead of looking for messages.