Skip to content

Commit

Permalink
Merge pull request #1 from relitrix/dev
Browse files Browse the repository at this point in the history
1.0.1
  • Loading branch information
relitrix authored Mar 29, 2024
2 parents 514f03e + ae2dd09 commit 69bb872
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 5 additions & 3 deletions docker-compose-production.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trackcombot",
"version": "1.0.0",
"version": "1.0.1",
"main": "src/index.js",
"author": "relitrix",
"license": "UNLICENSED",
Expand Down
3 changes: 0 additions & 3 deletions src/commands/admin/pair.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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() } } })
Expand Down
7 changes: 5 additions & 2 deletions src/jobs/commentsWave.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 69bb872

Please sign in to comment.