Skip to content

Commit

Permalink
Merge pull request #340 from saiteja-madha/v5.3.0
Browse files Browse the repository at this point in the history
V5.3.0
  • Loading branch information
Sai Teja Madha committed Apr 18, 2023
2 parents 4853f25 + 2c2e191 commit dd09fba
Show file tree
Hide file tree
Showing 15 changed files with 758 additions and 588 deletions.
8 changes: 6 additions & 2 deletions dashboard/routes/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ router.get("/login", async function (req, res) {
});

router.get("/callback", async (req, res) => {
if (!req.query.code) return res.redirect(req.client.config.DASHBOARD.failureURL);
if (!req.query.code) {
req.client.logger.debug({ query: req.query, body: req.body });
req.client.logger.error("Failed to login to dashboard! Check /logs folder for more details");
return res.redirect(req.client.config.DASHBOARD.failureURL);
}
if (req.query.state && req.query.state.startsWith("invite")) {
if (req.query.code) {
const guildID = req.query.state.substr("invite".length, req.query.state.length);
Expand All @@ -51,7 +55,7 @@ router.get("/callback", async (req, res) => {
// If the code isn't valid
if (tokens.error || !tokens.access_token) {
req.client.logger.debug(tokens);
req.client.logger.error("Failed to login to dashboard");
req.client.logger.error("Failed to login to dashboard! Check /logs folder for more details");
return res.redirect(`/api/login&state=${req.query.state}`);
}
const userData = {
Expand Down
12 changes: 6 additions & 6 deletions dashboard/routes/guild-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ router.post("/:serverID/basic", CheckAuth, async (req, res) => {

// AUTOMOD CONFIGURATION
if (Object.prototype.hasOwnProperty.call(data, "automodUpdate")) {
if (data.max_strikes != settings.automod.strikes) {
if (data.max_strikes && data.max_strikes !== settings.automod.strikes) {
settings.automod.strikes = data.max_strikes;
}

if (data.automod_action !== settings.automod.action) {
if (data.automod_action && data.automod_action !== settings.automod.action) {
settings.automod.action = data.automod_action;
}

Expand Down Expand Up @@ -247,8 +247,8 @@ router.post("/:serverID/greeting", CheckAuth, async (req, res) => {
}

data.channel = guild.channels.cache.find((ch) => "#" + ch.name === data.channel)?.id;
if (data.channel !== settings.welcome.channel_id) {
settings.welcome.channel_id = data.channel;
if (data.channel !== settings.welcome.channel) {
settings.welcome.channel = data.channel;
}

if (!settings.welcome.enabled) settings.welcome.enabled = true;
Expand Down Expand Up @@ -290,8 +290,8 @@ router.post("/:serverID/greeting", CheckAuth, async (req, res) => {
}

data.channel = guild.channels.cache.find((ch) => "#" + ch.name === data.channel)?.id;
if (data.channel !== settings.farewell.channel_id) {
settings.farewell.channel_id = data.channel;
if (data.channel !== settings.farewell.channel) {
settings.farewell.channel = data.channel;
}

if (!settings.farewell.enabled) settings.farewell.enabled = true;
Expand Down
20 changes: 16 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
container_name: discord-js-bot
restart: unless-stopped
networks:
- lavalink-net
- discord-js-net
volumes:
- ./config.js:/usr/src/app/config.js:ro
- ./logs:/usr/src/app/logs:rw
Expand All @@ -17,10 +17,22 @@ services:
hostname: lavalink
restart: unless-stopped
networks:
- lavalink-net
- discord-js-net
volumes:
- ./application.yml:/opt/Lavalink/application.yml:ro

mongodb:
image: mongo:latest
container_name: discord-js-mongodb
restart: unless-stopped
networks:
- discord-js-net
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=supersecretpassword
volumes:
- ./data:/data/db:rw

networks:
lavalink-net:
name: lavalink-net
discord-js-net:
name: discord-js-net
Loading

0 comments on commit dd09fba

Please sign in to comment.