Compare commits

...

11 Commits

Author SHA1 Message Date
161c8c1e80 fix zoznam 2026-09-23 20:43:26 +02:00
8c0d10f28e fix zoznam 2026-09-23 20:34:02 +02:00
44d8bd582b fix zoznam 2026-09-23 20:32:50 +02:00
29144c8af4 fix zoznam 2026-09-23 19:48:42 +02:00
a7168aeddb fix zoznam 2026-09-23 19:47:32 +02:00
8abe3ede90 fix zoznam 2026-09-23 19:44:04 +02:00
2237aae4f8 fix db 2026-09-23 19:39:36 +02:00
cbf1fec04d docker compose 2026-09-23 19:06:46 +02:00
808bba3695 edit dockerfile 2026-09-23 19:02:26 +02:00
8132fca9b6 edit dockerfile 2026-09-23 19:00:41 +02:00
0ccac0087e dockerfile 2026-09-23 18:57:19 +02:00
6 changed files with 35 additions and 10 deletions

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
COPY . .
RUN bun install
# run the app
USER bun
ENTRYPOINT [ "bun", "run", "index.js" ]

View File

@@ -8,7 +8,7 @@ export default {
handle: async (interaction, database) => {
await interaction.defer(MessageFlags.EPHEMERAL)
const db = database.table(`rr`)
const db = await database.table(`rr`)
const splitID = interaction.data.customID.split('.')

View File

@@ -177,7 +177,7 @@ export default {
},
handle: async (interaction, database) => {
const db = database.table(`rr`)
const db = await database.table(`rr`)
const action = interaction.data.options.getSubCommand()[0]
@@ -648,8 +648,12 @@ export default {
let textZoznam = `# zoznam kolekcií`
for (const kolekcia of Object.keys(kolekcie)) {
textZoznam += `\n- ${kolekcia}`
if (Object.keys(kolekcie)?.length) {
for (const kolekcia of Object.keys(kolekcie)) {
textZoznam += `\n- ${kolekcia}`
}
} else {
textZoznam += `\nziadne kolekcie`
}
await interaction.createFollowup({
@@ -693,8 +697,12 @@ export default {
let textZoznam = `# zoznam rolí (${kolekcia})`
for (const rola of role) {
textZoznam += `\n- ${rola.nazov} <@&${rola.id}>`
if (role?.length) {
for (const rola of role) {
textZoznam += `\n- ${rola.nazov ? `${rola.nazov} `: ``}<@&${rola.id}>`
}
} else {
textZoznam += `\nziadne role`
}
await interaction.createFollowup({

4
docker-compose.yml Normal file
View File

@@ -0,0 +1,4 @@
services:
itckar-bot:
build:
context: .

View File

@@ -8,7 +8,7 @@ export default {
handle: async (interaction, database) => {
await interaction.defer(MessageFlags.EPHEMERAL)
const db = database.table(`rr`)
const db = await database.table(`rr`)
const splitID = interaction.data.customID.split('.')

View File

@@ -32,10 +32,12 @@ export class KVDB {
/**
* Switch database table/context sharing the same connection pool
* @param {string} newTableName
* @returns {KVDB}
* @returns {Promise<KVDB>}
*/
table(newTableName) {
return new KVDB(this.pool, newTableName);
async table(newTableName) {
const newDb = new KVDB(this.pool, newTableName);
await newDb.init();
return newDb;
}
/**