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) => {
|
handle: async (interaction, database) => {
|
||||||
await interaction.defer(MessageFlags.EPHEMERAL)
|
await interaction.defer(MessageFlags.EPHEMERAL)
|
||||||
|
|
||||||
const db = database.table(`rr`)
|
const db = await database.table(`rr`)
|
||||||
|
|
||||||
const splitID = interaction.data.customID.split('.')
|
const splitID = interaction.data.customID.split('.')
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
handle: async (interaction, database) => {
|
handle: async (interaction, database) => {
|
||||||
const db = database.table(`rr`)
|
const db = await database.table(`rr`)
|
||||||
|
|
||||||
const action = interaction.data.options.getSubCommand()[0]
|
const action = interaction.data.options.getSubCommand()[0]
|
||||||
|
|
||||||
@@ -648,9 +648,13 @@ export default {
|
|||||||
|
|
||||||
let textZoznam = `# zoznam kolekcií`
|
let textZoznam = `# zoznam kolekcií`
|
||||||
|
|
||||||
|
if (Object.keys(kolekcie)?.length) {
|
||||||
for (const kolekcia of Object.keys(kolekcie)) {
|
for (const kolekcia of Object.keys(kolekcie)) {
|
||||||
textZoznam += `\n- ${kolekcia}`
|
textZoznam += `\n- ${kolekcia}`
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
textZoznam += `\nziadne kolekcie`
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.createFollowup({
|
await interaction.createFollowup({
|
||||||
flags: MessageFlags.IS_COMPONENTS_V2,
|
flags: MessageFlags.IS_COMPONENTS_V2,
|
||||||
@@ -693,8 +697,12 @@ export default {
|
|||||||
|
|
||||||
let textZoznam = `# zoznam rolí (${kolekcia})`
|
let textZoznam = `# zoznam rolí (${kolekcia})`
|
||||||
|
|
||||||
|
if (role?.length) {
|
||||||
for (const rola of role) {
|
for (const rola of role) {
|
||||||
textZoznam += `\n- ${rola.nazov} <@&${rola.id}>`
|
textZoznam += `\n- ${rola.nazov ? `${rola.nazov} `: ``}<@&${rola.id}>`
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
textZoznam += `\nziadne role`
|
||||||
}
|
}
|
||||||
|
|
||||||
await interaction.createFollowup({
|
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) => {
|
handle: async (interaction, database) => {
|
||||||
await interaction.defer(MessageFlags.EPHEMERAL)
|
await interaction.defer(MessageFlags.EPHEMERAL)
|
||||||
|
|
||||||
const db = database.table(`rr`)
|
const db = await database.table(`rr`)
|
||||||
|
|
||||||
const splitID = interaction.data.customID.split('.')
|
const splitID = interaction.data.customID.split('.')
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,12 @@ export class KVDB {
|
|||||||
/**
|
/**
|
||||||
* Switch database table/context sharing the same connection pool
|
* Switch database table/context sharing the same connection pool
|
||||||
* @param {string} newTableName
|
* @param {string} newTableName
|
||||||
* @returns {KVDB}
|
* @returns {Promise<KVDB>}
|
||||||
*/
|
*/
|
||||||
table(newTableName) {
|
async table(newTableName) {
|
||||||
return new KVDB(this.pool, newTableName);
|
const newDb = new KVDB(this.pool, newTableName);
|
||||||
|
await newDb.init();
|
||||||
|
return newDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user