Initial Commit

This commit is contained in:
Christer Warén 2024-11-01 01:27:30 +02:00
commit a013466077
13 changed files with 219 additions and 0 deletions

19
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,19 @@
version: 2
updates:
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"
labels:
- "dependencies"
# npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"
labels:
- "dependencies"

13
.github/labeler.yml vendored Normal file
View File

@ -0,0 +1,13 @@
dependencies:
- changed-files:
- any-glob-to-any-file:
- package-lock.json
documentation:
- changed-files:
- any-glob-to-any-file:
- README.md
- SECURITY.md
- CONTRIBUTING.md
- LICENSE
- .env_example

View File

@ -0,0 +1,20 @@
name: Dependabot Auto-Merge
on:
pull_request_target:
branches: [ develop ]
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
name: Dependabot Auto-Merge
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

22
.github/workflows/docker-build.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Docker Build
on:
pull_request:
types: [opened, synchronize, reopened, assigned, edited, ready_for_review]
push:
workflow_dispatch:
jobs:
buildx:
name: Docker Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.7.1
id: buildx
with:
install: true
- name: Build
run: docker build . # will run buildx

17
.github/workflows/labeler.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Labeler
on: [pull_request]
jobs:
label:
name: Labeler
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true

22
.github/workflows/typescript-build.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: TypeScript Build
on:
pull_request:
types: [opened, synchronize, reopened, assigned, edited, ready_for_review]
push:
workflow_dispatch:
jobs:
tsc:
name: TypeScript Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install node v22
uses: actions/setup-node@v4
with:
node-version: 22
- name: npm install
run: npm install
- name: tsc
uses: icrawl/action-tsc@v1

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules/
npm-debug.log
.env

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"editor.renderFinalNewline": false
}

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM docker.io/node:22-alpine
#Dependencies
RUN apk add --virtual .build-deps python3 make g++ gcc git
WORKDIR /usr/src/app
COPY / /usr/src/app/
RUN npm install
RUN npm run build
CMD [ "npm", "start" ]

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Verkkopeliyhdistys Insomnia ry & Warén Group
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

20
README.md Normal file
View File

@ -0,0 +1,20 @@
# Insomnia ID - Bot
## Description
Verkkopeliyhdistys Insomnia ry - Identity Bot
## Commands
### Build Image
`podman build -t ghcr.io/insomniafi/insid-bot`
### Publish Image
`podman push ghcr.io/insomniafi/insid-bot`
### Run Container
`podman run --name insid-bot -d -e DISCORD_TOKEN= ghcr.io/insomniafi/insid-bot`
### Update Dependencies
`podman run --name insid-bot -d -e DISCORD_TOKEN= -v "$PWD":/usr/src/app/ ghcr.io/insomniafi/insid-bot`

26
package.json Normal file
View File

@ -0,0 +1,26 @@
{
"name": "insid-bot",
"version": "0.0.1",
"description": "Verkkopeliyhdistys Insomnia ry - Identity Bot",
"main": "index.js",
"scripts": {
"build": "rimraf ./build && tsc",
"start": "node --no-warnings build/index.js",
"start:dev": "rimraf ./build && tsc && node --no-warnings build/index.js"
},
"author": "Christer Warén / Warén Group",
"license": "MIT",
"private": true,
"homepage": "https://insomnia.fi",
"dependencies": {
"discord.js": "^14.16.3"
},
"devDependencies": {
"rimraf": "^6.0.1",
"typescript": "^5.6.3"
},
"engines": {
"node": ">=22.0.0",
"npm": ">=10.0.0"
}
}

16
tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["esnext"],
"allowJs": true,
"outDir": "build",
"rootDir": "src",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true
},
"exclude": ["build", "node_modules", "datastore"]
}