Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete Remake [TypeScript, Postgres, Crawler] #26

Merged
merged 52 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
057bc99
Removed all projects since we're completly rewriting this.
moonstar-x Jul 30, 2024
a3cc978
Initialized project files.
moonstar-x Jul 30, 2024
6255bd7
Created base for client and command handling.
moonstar-x Jul 31, 2024
c99bbb2
Added permissions and guildOnly for command structure.
moonstar-x Aug 1, 2024
aba1e62
Added tests for currently implemented code.
moonstar-x Aug 1, 2024
b4ef476
Added GameOffer model.
moonstar-x Aug 2, 2024
ef1ecca
Added env environment with Docker Compose.
moonstar-x Aug 2, 2024
8c52bfa
Added env variables in config for services.
moonstar-x Aug 2, 2024
354aac7
Created Postgres service.
moonstar-x Aug 2, 2024
dc676d7
Migrations are now executed on start and startSharded.
moonstar-x Aug 2, 2024
f344084
Created database migration.
moonstar-x Aug 2, 2024
b0d4bac
Created Redis client.
moonstar-x Aug 3, 2024
5c2d250
Added getCurrentGameOffers
moonstar-x Aug 3, 2024
440d4c8
Implemented getStorefronts.
moonstar-x Aug 4, 2024
6ea911f
Implemented getGuild service.
moonstar-x Aug 4, 2024
be86349
Implemented updateOrCreateGuildChannel.
moonstar-x Aug 4, 2024
809bf92
Implemented SetGuildGameOffersEnabled.
moonstar-x Aug 5, 2024
1eab7d8
Implemented DeleteGuild.
moonstar-x Aug 5, 2024
a5d7ed4
Removed custom guildOnly and handlePermission from Command base.
moonstar-x Aug 5, 2024
6b8c673
Renamed CommandDispatcher to InteractionDIspatcher.
moonstar-x Aug 5, 2024
6a5792f
Replaced InteractionDispatcher logic to allow for more types of inter…
moonstar-x Aug 5, 2024
982821b
Guild leave event now deletes guild data.
moonstar-x Aug 5, 2024
46ffaed
Created basic commands to be implemented.
moonstar-x Aug 5, 2024
ab86f6f
Implemented a base for Configure and Info commands.
moonstar-x Aug 5, 2024
8384a55
Created i18n utility.
moonstar-x Aug 6, 2024
baad6ec
Added localized error message for commands.
moonstar-x Aug 6, 2024
093f3af
Added localized texts in command builders.
moonstar-x Aug 6, 2024
756afe3
Implemented Help command.
moonstar-x Aug 7, 2024
5303a58
Implemented InfoCommand.
moonstar-x Aug 7, 2024
32568c6
Implemented OffersCommand.
moonstar-x Aug 8, 2024
fdbe39a
Added locale as part of guild settings.
moonstar-x Aug 8, 2024
12cfe1d
Implemented ConfigureCommand.
moonstar-x Aug 8, 2024
0fc26a8
Created getNotifiableGuilds service.
moonstar-x Aug 8, 2024
5633bdf
Implemented subscribeToOffers service.
moonstar-x Aug 8, 2024
44ce3cd
Created base for OffersNotifier.
moonstar-x Aug 8, 2024
2a5341c
Fixed SQL function for get_notifiable_guilds().
moonstar-x Aug 8, 2024
bb8b5de
Fixed client creation registering commands before event registration.
moonstar-x Aug 9, 2024
42a4395
Created a startSharded entrypoint.
moonstar-x Aug 9, 2024
f65facf
Added a dev:sharded script to run bot sharded for development purposes.
moonstar-x Aug 9, 2024
3e2c00e
Fixed InfoCommand throwing when set channel no longer exists.
moonstar-x Aug 9, 2024
ce65240
Created OfferNotifier service.
moonstar-x Aug 9, 2024
83702b8
Created a presence resolver to get preset presences.
moonstar-x Aug 9, 2024
6d5f50a
Implemented PresenceManager.
moonstar-x Aug 10, 2024
b8d73e1
Added PresenceManager to ExtendedClient,
moonstar-x Aug 10, 2024
7113727
Added new env config.
moonstar-x Aug 10, 2024
2ea1641
Updated entrypoints to enable sharding based on env variable.
moonstar-x Aug 10, 2024
1b149f0
Added Docker image.
moonstar-x Aug 12, 2024
ba9dfdf
Added new CI workflows.
moonstar-x Aug 12, 2024
0eea52f
Added old PR and issue templates.
moonstar-x Aug 12, 2024
82dd100
Updated README.
moonstar-x Aug 12, 2024
fe06a2f
Added translations to Spanish and French.
moonstar-x Aug 12, 2024
824ae00
Added TZ to test runner in CI.
moonstar-x Aug 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 11 additions & 35 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
# OS Generated
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Thrashes
ehthumbs.db
Thumbs.db

# IDE
.vscode/
.idea/

# Node
node_modules
npm-debug.log

# Development
config/settings.json
data
dev-data

# Tests
__mocks__
test

# Git
.github
.git

# Root files
.eslintignore
.eslintrc
.gitignore
jest.config.js
# Ignore everything by default.
*

# Allow the public project files.
!migrations
!src
!Dockerfile
!LICENSE
!package*.json
!README.md
!tsconfig*.json
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules
build
12 changes: 7 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"globals": {
"NodeJS": true
},
"extends": [
"greencoast/node"
"@moonstar-x/eslint-config/rules/node",
"@moonstar-x/eslint-config/rules/typescript"
],
"rules": {
"one-var": "off"
},
"parserOptions": {
"ecmaVersion": 2020
"no-dupe-class-members": "off",
"camelcase": "off"
}
}
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Make sure that your PR fulfills these requirements:
- [ ] Tests have been added for this feature.
- [ ] All tests pass on your local machine.
- [ ] Code has been linted with the proper rules.
- [ ] Project builds on your local machine.

### :page_facing_up: Description

Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/callable-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build Docker Image

on:
workflow_call:
inputs:
ghcr_image_name:
required: true
type: string
image_name:
required: true
type: string
image_tag:
required: true
type: string
ghcr_username:
rquired: true
type: string
dockerhub_username:
required: true
type: string
secrets:
ghcr_token:
required: true
dockerhub_token:
required: true

jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest

steps:
- name: Checkout the Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker Layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ inputs.ghcr_username }}
password: ${{ secrets.ghcr_token }}

- name: Login to DockerHub Registry
uses: docker/login-action@v3
with:
username: ${{ inputs.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}

- name: Get Version from package.json
id: package-version
uses: martinbeentjes/npm-get-version-action@master

- name: Build & Push Docker Image
id: docker_build
uses: docker/build-push-action@v3
env:
GHCR_IMAGE: ghcr.io/${{ inputs.ghcr_image_name }}
DOCKERHUB_IMAGE: ${{ inputs.dockerhub_username }}/${{ inputs.image_name }}
with:
context: .
push: true
tags: |
${{ env.GHCR_IMAGE }}:${{ inputs.image_tag }}
${{ env.GHCR_IMAGE }}:${{ steps.package-version.outputs.current-version }}
${{ env.DOCKERHUB_IMAGE }}:${{ inputs.image_tag }}
${{ env.DOCKERHUB_IMAGE }}:${{ steps.package-version.outputs.current-version }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64,linux/arm64/v8

- name: Image Digest
run: echo ${{ steps.docker_build.outputs.digest }}
35 changes: 35 additions & 0 deletions .github/workflows/callable-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Tests

on:
workflow_call:

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout the Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install Dependencies
run: npm ci

- name: Run Type Checks
run: npm run type-check

- name: Run Linter
run: npm run lint

- name: Run Tests
run: npm run test
env:
TZ: America/Guayaquil
44 changes: 0 additions & 44 deletions .github/workflows/ci.yml

This file was deleted.

55 changes: 0 additions & 55 deletions .github/workflows/docker-build.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: On Pull Request

on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened

jobs:
test:
name: Run Tests
uses: ./.github/workflows/callable-test.yml
26 changes: 26 additions & 0 deletions .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: On Push (Main)

on:
push:
branches:
- main

jobs:
test:
name: Run Tests
uses: ./.github/workflows/callable-test.yml

build:
name: Build Docker Image
uses: ./.github/workflows/callable-build.yml
needs:
- test
with:
ghcr_image_name: ${{ github.repository }}
image_name: discord-free-games-notifier
image_tag: latest
ghcr_username: ${{ github.actor }}
dockerhub_username: moonstarx
secrets:
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
Loading