diff --git a/Dockerfile b/Dockerfile index 3a21b02..10a9be9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM node:20-alpine LABEL author="relitrix" +LABEL org.opencontainers.image.source="https://github.com/relitrix/trackcombot" RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app diff --git a/docker-compose-production.yml b/docker-compose-production.yml index 7db4867..5659ae0 100644 --- a/docker-compose-production.yml +++ b/docker-compose-production.yml @@ -1,9 +1,7 @@ version: '3.8' services: trackcombot: - build: - context: . - container_name: trackcombot + image: ghcr.io/relitrix/trackcombot:latest restart: always env_file: - .env.production @@ -20,6 +18,10 @@ services: volumes: - 'trackcombot-mongo_db:/data/db' - 'trackcombot-mongo_configdb:/data/configdb' + watchtower: + image: containrrr/watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock volumes: trackcombot-mongo_db: name: 'trackcombot-mongo_db' diff --git a/package-lock.json b/package-lock.json index a6fb184..e249ecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "trackcombot", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "trackcombot", - "version": "1.0.0", + "version": "1.0.1", "license": "UNLICENSED", "dependencies": { "@googleapis/youtube": "^14.0.0", diff --git a/package.json b/package.json index b8bac59..d4bb148 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "trackcombot", - "version": "1.0.0", + "version": "1.0.1", "main": "src/index.js", "author": "relitrix", "license": "UNLICENSED", diff --git a/src/commands/admin/pair.js b/src/commands/admin/pair.js index f71e289..fc375c6 100644 --- a/src/commands/admin/pair.js +++ b/src/commands/admin/pair.js @@ -29,7 +29,6 @@ module.exports = { await interaction.deferReply({ ephemeral: true }) const resolve = await youtube.resolveURL(options.getString('youtube')) - console.log(resolve) if (resolve.metadata?.page_type !== 'WEB_PAGE_TYPE_CHANNEL') return interaction.editReply({ content: "### ⚠️ Something wrong with YouTube link. It should be like this: `https://www.youtube.com/@MrBeast`" }) const { count } = await GuildSchema.aggregate([ @@ -40,10 +39,8 @@ module.exports = { } } ]).then(result => result[0]) - console.log(count) if (count >= limits.channels) return interaction.editReply({ content: `### ⚠️ You have reached limit of ${limits.channels} channel(s) for Discord server.` }) const pairInfo = await GuildSchema.findOne({ Guild: interaction.guild.id, Pairs: { $elemMatch: { youtubeChannel: resolve.payload.browseId } } }, { "Pairs.$": 1 }) - console.log(pairInfo) if (pairInfo) return interaction.editReply({ content: `### ⚠️ This YouTube channel already paired with <#${pairInfo.Pairs[0].discordChannel}>` }) const result = await GuildSchema.updateOne({ Guild: interaction.guild.id }, { $push: { Pairs: { discordChannel: options.getChannel('discord').id, youtubeChannel: resolve.payload.browseId, date: new Date() } } }) diff --git a/src/jobs/commentsWave.js b/src/jobs/commentsWave.js index 866cc3d..de8bd88 100644 --- a/src/jobs/commentsWave.js +++ b/src/jobs/commentsWave.js @@ -6,11 +6,14 @@ module.exports = async () => { const chunkArray = require('../utils/chunkArray') async function makeEmbeds(newComms) { + const videobasicInfos = new Map() const promises = newComms.map(async comm => { let basicInfo = null try { - if (comm.vidId) - basicInfo = await process.youtube.getBasicInfo(comm.vidId) + if (comm.vidId) { + basicInfo = videobasicInfos.get(comm.vidId) ?? await process.youtube.getBasicInfo(comm.vidId) + videobasicInfos.set(comm.vidId, basicInfo) + } } catch (e) { console.log("Failed to get basicInfo") console.error(e)