Compare commits
11 Commits
aa1d60b19e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 161c8c1e80 | |||
| 8c0d10f28e | |||
| 44d8bd582b | |||
| 29144c8af4 | |||
| a7168aeddb | |||
| 8abe3ede90 | |||
| 2237aae4f8 | |||
| cbf1fec04d | |||
| 808bba3695 | |||
| 8132fca9b6 | |||
| 0ccac0087e |
11
Dockerfile
Normal file
11
Dockerfile
Normal 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" ]
|
||||
@@ -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('.')
|
||||
|
||||
|
||||
@@ -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
4
docker-compose.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
services:
|
||||
itckar-bot:
|
||||
build:
|
||||
context: .
|
||||
@@ -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('.')
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user