From c0e29b3bbe7d15788c82d93a6c2fed93cb2381be Mon Sep 17 00:00:00 2001 From: Kevin Dang <77701718+kevinthedang@users.noreply.github.com> Date: Mon, 11 May 2026 11:42:48 -0700 Subject: [PATCH] Pipeline Trigger Change and Newline Format (#193) --- .github/ISSUE_TEMPLATE/feature_request.md | 4 +- .github/workflows/build.yml | 150 ++++++++++----------- .github/workflows/deploy.yml | 9 +- .github/workflows/test.yml | 96 +++++++------- README.md | 6 +- src/client.ts | 86 ++++++------ src/index.ts | 2 +- src/keys.ts | 18 +-- tests/commands.test.ts | 154 +++++++++++----------- 9 files changed, 263 insertions(+), 262 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index b41186e..abf212f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,10 +8,10 @@ assignees: '' --- ## Issue -A clear and concise description of what the problem/feature is. +A clear and concise description of what the problem/feature is. PLease describe it as best as possible. ## Solution -* Provide steps or ideals to how to implement or investigate this new feature. +* Provide steps or ideas to how to implement or investigate this new feature. ## References * Provide additional context and external references here diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3675511..0b161a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,75 +1,75 @@ -name: Builds -run-name: Validate Node and Docker Builds -on: - push: - branches: - - master # runs after Pull Request is merged - -jobs: - Discord-Node-Build: # test if the node install and run - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set up Node Environment lts/jod - uses: actions/setup-node@v4 - with: - node-version: lts/jod - cache: "npm" - - - name: Install Project Dependencies - run: | - npm install - - - name: Build Application - run: | - npm run build - - - name: Create Environment Variables - run: | - touch .env - echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env - echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env - echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env - echo MODEL = ${{ secrets.MODEL }} >> .env - - # set -e ensures if nohup fails, this section fails - - name: Startup Discord Bot Client - run: | - set -e - nohup npm run prod & - - Discord-Ollama-Container-Build: # test docker build and run - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set up Node Environment lts/jod - uses: actions/setup-node@v4 - with: - node-version: lts/jod - cache: "npm" - - - name: Create Environment Variables - run: | - touch .env - echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env - echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env - echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env - echo MODEL = ${{ secrets.MODEL }} >> .env - - - name: Setup Docker Network and Images - run: | - npm run docker:start-cpu - - - name: Check Images Exist - run: | - (docker images | grep -q 'kevinthedang/discord-ollama' && docker images | grep -qE 'ollama/ollama') || exit 1 - - - name: Check Containers Exist - run: | - (docker ps | grep -q 'ollama' && docker ps | grep -q 'discord') || exit 1 +name: Builds +run-name: Validate Node and Docker Builds +on: + push: + branches: + - master # runs after Pull Request is merged + +jobs: + Discord-Node-Build: # test if the node install and run + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Node Environment lts/jod + uses: actions/setup-node@v4 + with: + node-version: lts/jod + cache: "npm" + + - name: Install Project Dependencies + run: | + npm install + + - name: Build Application + run: | + npm run build + + - name: Create Environment Variables + run: | + touch .env + echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env + echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env + echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env + echo MODEL = ${{ secrets.MODEL }} >> .env + + # set -e ensures if nohup fails, this section fails + - name: Startup Discord Bot Client + run: | + set -e + nohup npm run prod & + + Discord-Ollama-Container-Build: # test docker build and run + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Node Environment lts/jod + uses: actions/setup-node@v4 + with: + node-version: lts/jod + cache: "npm" + + - name: Create Environment Variables + run: | + touch .env + echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env + echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env + echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env + echo MODEL = ${{ secrets.MODEL }} >> .env + + - name: Setup Docker Network and Images + run: | + npm run docker:start-cpu + + - name: Check Images Exist + run: | + (docker images | grep -q 'kevinthedang/discord-ollama' && docker images | grep -qE 'ollama/ollama') || exit 1 + + - name: Check Containers Exist + run: | + (docker ps | grep -q 'ollama' && docker ps | grep -q 'discord') || exit 1 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dee7c17..4291c7e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,10 @@ name: Deploy run-name: Deploy Application Latest -on: - push: - tags: - - 'v*' +# on: +# push: +# tags: +# - 'v*' +on: workflow_dispatch jobs: Deploy-Application: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5fe9007..c7a4a4b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,48 +1,48 @@ -name: Tests -run-name: Unit Tests -on: - pull_request: - branches: - - master - paths: - - '*' - - 'package*.json' - - 'src/**' - - 'tests/**' - - '!docs/**' - - '!imgs/**' - - '!.github/**' - - '.github/workflows/**' - - '!.gitignore' - - '!LICENSE' - - '!README' - -jobs: - Discord-Node-Test: - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set up Node Environment lts/jod - uses: actions/setup-node@v4 - with: - node-version: lts/jod - cache: "npm" - - - name: Install Project Dependencies - run: | - npm install - - - name: Create Environment Variables - run: | - touch .env - echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env - echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env - echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env - echo MODEL = ${{ secrets.MODEL }} >> .env - - - name: Test Application - run: | - npm run tests +name: Tests +run-name: Unit Tests +on: + pull_request: + branches: + - master + paths: + - '*' + - 'package*.json' + - 'src/**' + - 'tests/**' + - '!docs/**' + - '!imgs/**' + - '!.github/**' + - '.github/workflows/**' + - '!.gitignore' + - '!LICENSE' + - '!README' + +jobs: + Discord-Node-Test: + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Node Environment lts/jod + uses: actions/setup-node@v4 + with: + node-version: lts/jod + cache: "npm" + + - name: Install Project Dependencies + run: | + npm install + + - name: Create Environment Variables + run: | + touch .env + echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env + echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env + echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env + echo MODEL = ${{ secrets.MODEL }} >> .env + + - name: Test Application + run: | + npm run tests diff --git a/README.md b/README.md index 9d8436e..b10ee40 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/src/client.ts b/src/client.ts
index fbf72f5..6e5996d 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -1,44 +1,44 @@
-import { Client, GatewayIntentBits } from 'discord.js'
-import { Ollama } from 'ollama'
-import { Queue } from './queues/queue.js'
-import { UserMessage, registerEvents } from './utils/index.js'
-import Events from './events/index.js'
-import Keys from './keys.js'
-
-// initialize the client with the following permissions when logging in
-const client = new Client({
- intents: [
- GatewayIntentBits.Guilds,
- GatewayIntentBits.GuildMembers,
- GatewayIntentBits.GuildMessages,
- GatewayIntentBits.MessageContent
- ]
-})
-
-// initialize connection to ollama container
-export const ollama = new Ollama({
- host: `http://${Keys.ipAddress}:${Keys.portAddress}`,
-})
-
-// Create Queue managed by Events
-const messageHistory: Queue