Skip to content

Commit

Permalink
updated bot.ts & regenerated readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Jul 25, 2024
1 parent 045aa9b commit 746ff68
Show file tree
Hide file tree
Showing 34 changed files with 1,244 additions and 3,614 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:lts

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

# Rebuild les dépendances natives
RUN npm rebuild sqlite3 || true

CMD ["npm", "run", "start"]
37 changes: 36 additions & 1 deletion Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ function _overrideNativeFiles() {
"temp/.gitattributes",
"temp/.gitignore",
"temp/.eslintrc.json",
"temp/Dockerfile",
"temp/compose.yml",
"temp/.github/workflows/**/*.native.*",
"temp/template.env",
"temp/template.md",
Expand Down Expand Up @@ -348,6 +350,20 @@ async function _generateReadme(cb) {
client.user.displayAvatarURL({ format: "png", size: 128 }) +
"&fit=cover&mask=circle"

const config = await import("./dist/config.js").then(
(config) => config.default,
)

const invitation = client.application.botPublic
? await client.generateInvite({
scopes: [
discord.OAuth2Scopes.Bot,
discord.OAuth2Scopes.ApplicationsCommands,
],
permissions: config.permissions,
})
: null

await client.destroy()

const packageJSON = JSON.parse(
Expand All @@ -359,6 +375,10 @@ async function _generateReadme(cb) {
const configFile = await fs.promises.readFile("./src/config.ts", "utf8")
const template = await fs.promises.readFile("./template.md", "utf8")

/**
* @param dirname {string}
* @return {Promise<Map<any>>}
*/
const handle = async (dirname) => {
const handler = new Handler(path.join(__dirname, "dist", dirname), {
pattern: /\.js$/i,
Expand All @@ -369,7 +389,22 @@ async function _generateReadme(cb) {

await handler.init()

return handler.elements
// crop all the paths from the root directory

const output = new Map()

for (const [_path, value] of handler.elements) {
output.set(
path
.relative(__dirname, _path)
.replace("dist", "./src")
.replace(/\\/g, "/")
.replace(/\.js$/, ".ts"),
value,
)
}

return output
}

const slash = await handle("slash")
Expand Down
9 changes: 9 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
bot:
build:
context: .
dockerfile: Dockerfile
container_name: ${BOT_NAME}
restart: always
volumes:
- ./data:/data
Loading

0 comments on commit 746ff68

Please sign in to comment.