The website of GW2Bot, created by Maselkov. Visit gw2bot.info to see the live website.
This website is built using Nuxt.js and takes advantage of an embedded Express.js API.
It showcases some features of the bot, lists the available commands, and hosts a couple of FAQs.
It also has Discord authentication for viewing encounter logs that are uploaded via the bot.
# Install dependencies
npm install
# Run locally for development
npm run dev
# Build for production
npm run build
# Start production server
npm run start
You must replace YOUR_BOT_ID
in the file ./nuxt.config.js
with your Discord bot's Client ID for authentication.
// ./nuxt.config.js
export default {
auth: {
strategies: {
discord: {
client_id: 'YOUR_BOT_ID'
}
}
}
}
You must configure the OAuth2 redirect URIs for your bot to allow Discord authentication. Go to your Discord Developer Portal and select your bot. Go to OAuth2 General settings and enter the following URIs:
Development: http://localhost:3000/login
Production: https://gw2bot.info/login
In development, make sure your local mongodb service is running when you try to view the logs page. The website connects to the same database used by GW2Bot.
If your connection to the database times out, you may need to edit your mongod configuration file to enable IPV6 connection to localhost:
# path/to/mongod.cfg
net:
port: 27017
bindIp: localhost,127.0.0.1
ipv6: true
The website will set a details
field for each database entry in the gw2.encounters
collection of the toothy
database when a user visits the /logs
page to view their encounter logs. The details
object contains extra data about each encounter and is fetched from dps.report
on the client-side, then sent to the server via POST request. The data is validated before being saved to the database.
In the event that you need to reset the details field of every encounter in the database, use the updateMany method via mongosh:
# Connect to the database via mongosh
mongosh "mongodb://localhost:27017"
# Switch to the toothy database
use toothy
# Delete the "details" field of every encounter in the database
db.getCollection("gw2.encounters").updateMany({}, { $unset: { details: true }})
Feel free to create an issue or pull request for any improvement you would like to add.
For pull requests, please explain the issue, your solution/improvement, and make sure ESLint is happy.