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

Merge undeployed changes from dev #45

Merged
merged 120 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
063c010
feat: basic thread auto-locking for matchmaking
MatthewL246 Jun 30, 2024
e465ec0
feat: add timeout before locking closed thread
MatthewL246 Jun 30, 2024
7edb5ea
feat: implement automatic matchmaking thread locking after inactivity
MatthewL246 Jul 1, 2024
a13e406
chore: add embed to thread inactivity message
MatthewL246 Jul 1, 2024
a206eac
fix: base member update/remove events on guild audit log
wolfendale Jul 16, 2024
f25aab4
chore: style fixes
wolfendale Jul 16, 2024
369696d
chore: address pr comments
wolfendale Jul 19, 2024
2f8cfeb
chore: address pr comments
wolfendale Jul 20, 2024
5170899
Merge pull request #20 from wolfendale/audit-log-fix
jonbarrow Jul 20, 2024
4616859
chore: update feature to TypeScript rewrite
MatthewL246 Jul 21, 2024
520ea12
feat: send user a DM when their first matchmaking thread is closed
MatthewL246 Jul 22, 2024
04b9df6
chore: schedule matchmaking thread checks less often
MatthewL246 Jul 22, 2024
ca03876
chore: use Discord timestamps in event log embed
MatthewL246 Jul 22, 2024
ef8200d
chore: explain why threads must be unarchived before locking
MatthewL246 Jul 22, 2024
1ab61d2
chore: move handleMatchmakingThreadMessage to matchmaking-threads.ts
MatthewL246 Jul 22, 2024
d0fb103
chore: address style review comments
MatthewL246 Jul 23, 2024
6f234f6
chore: fix import location
MatthewL246 Jul 23, 2024
54ced85
chore: export the bot client
MatthewL246 Jul 23, 2024
5826d6b
chore: improve code ordering and spacing
MatthewL246 Jul 23, 2024
971bbb1
fix: forgot to change checkMatchmakingThreads call
MatthewL246 Jul 23, 2024
05d165c
chore: pretty-print objects
MatthewL246 Jul 23, 2024
c169851
fix: check last message in matchmaking thread before closing
MatthewL246 Jul 23, 2024
7a45d9a
chore: increase scheduled job frequency and always run on startup
MatthewL246 Jul 23, 2024
6167f9b
chore: disable unused timestamps for MatchmakingThread
MatthewL246 Jul 23, 2024
bd954f4
Merge pull request #23 from MatthewL246/auto-lock-matchmaking-threads
jonbarrow Jul 23, 2024
93bc76a
enhancement: improve nsfw image checks
wolfendale Jul 19, 2024
904c28d
chore: address pr comments
wolfendale Jul 23, 2024
4595e70
chore: update readme to indicate that the project will only run on linux
wolfendale Jul 23, 2024
235acd6
chore: address pr comments
wolfendale Jul 23, 2024
194bf29
feat: implement trusted role leveling system
MatthewL246 Jul 22, 2024
c4027d8
feat: untrust user when a moderator action is taken
MatthewL246 Jul 23, 2024
c892f8e
chore: address style comments from #23
MatthewL246 Jul 23, 2024
e2f5906
chore: address pr comments
wolfendale Jul 23, 2024
54709c9
chore: update reference to sql-phhammdist code
wolfendale Jul 23, 2024
6b37c38
chore: address PR review comments
MatthewL246 Jul 23, 2024
60c2dd8
fix: make thread_id the primary key for notification-threads
wolfendale Jul 24, 2024
f137402
Merge pull request #26 from wolfendale/nsfw-js-update
jonbarrow Jul 24, 2024
e32aa13
chore: address PR review comments
MatthewL246 Jul 24, 2024
0157ed3
feat: implement untrusted role
MatthewL246 Jul 24, 2024
2b13872
chore: merge notification threads into leveling-system
MatthewL246 Jul 24, 2024
4b1b556
chore: use notifyUser instead of DM
MatthewL246 Jul 24, 2024
cee6959
chore: use getRoleFromSettings helper
MatthewL246 Jul 24, 2024
0f87f98
chore: simplify guildMemberUpdate handler
MatthewL246 Jul 24, 2024
1a5d226
Merge pull request #25 from MatthewL246/leveling-system
jonbarrow Jul 26, 2024
4883cf1
feat: add reaction log events
wolfendale Jul 27, 2024
313e505
fix: fix race condition where multiple reactions are removed
wolfendale Jul 28, 2024
fbf7897
feat: add previous audit log field to message updates
wolfendale Jul 28, 2024
c0a33a6
chore: fix comments
wolfendale Jul 28, 2024
17406e5
chore: add comment
wolfendale Jul 28, 2024
7586664
Merge pull request #29 from PretendoNetwork/reaction-log
wolfendale Jul 29, 2024
6a58c6b
feat: add modping command
dootskyre Jul 31, 2024
dfbd5cc
change text to string
dootskyre Jul 31, 2024
432a656
fix for adding the role every status change
dootskyre Jul 31, 2024
0b40dbc
accounts for null hasRole
dootskyre Jul 31, 2024
91618d8
auto remove when demoted, and other changes matthew suggested
dootskyre Aug 1, 2024
12ce0f9
replace spaces with tabs, again
dootskyre Aug 1, 2024
d7c15c0
implemented formatting changes matthew suggested
dootskyre Aug 1, 2024
bc3a288
implemented formatting changes + fixed role var being lowercase
dootskyre Aug 1, 2024
c701699
set any to Role, removed newlines
dootskyre Aug 1, 2024
086909a
removed newlines in presenceUpdate
dootskyre Aug 1, 2024
7826c63
added permission changes and other suggestions
dootskyre Aug 1, 2024
cd7166c
remove unused GuildMember
dootskyre Aug 1, 2024
1cee337
remove unnecessary newlines in auto current command
dootskyre Aug 1, 2024
af503c8
remove list format in auto current command
dootskyre Aug 1, 2024
1bb3939
capitalize userID
dootskyre Aug 2, 2024
57bd5f8
capitalize userID in removing settings
dootskyre Aug 2, 2024
398e380
capitalize userID in auto assign updating
dootskyre Aug 2, 2024
d133900
capitalize userID in auto assign command
dootskyre Aug 2, 2024
847bdfb
add spacing before allowedRoles
dootskyre Aug 2, 2024
623efe6
add spacing between settings and roles
dootskyre Aug 2, 2024
ae3a4f4
remove spacing between member and settings vars
dootskyre Aug 2, 2024
80f283a
add spacing above return
dootskyre Aug 2, 2024
f625c76
change mod ping toggle spacing
dootskyre Aug 2, 2024
08e3005
add spacing between if statements in status list
dootskyre Aug 2, 2024
6f59326
add spacing above if statement in auto current command
dootskyre Aug 2, 2024
58471e8
add spacing above return in auto disable command
dootskyre Aug 2, 2024
3028d93
make error use block formatting
dootskyre Aug 2, 2024
06fe2b9
make interaction reply use block formatting
dootskyre Aug 2, 2024
e6be95b
Merge pull request #32 from dootskyre/dev
jonbarrow Aug 3, 2024
0a8278d
feat: add auto slow mode
wolfendale Jul 28, 2024
6412bbc
fix: fix validation for slow-mode options
wolfendale Aug 1, 2024
b32949e
fix: check for empty slow mode stages
wolfendale Aug 1, 2024
ddd0271
fix: correct types on SlowMode model
wolfendale Aug 1, 2024
c2a1b0d
fix: make sure slow-mode stages are deleted from db when unset
wolfendale Aug 1, 2024
c262ecf
fix: use findAndCreate in slow mode commands
wolfendale Aug 1, 2024
f42e571
chore: remove redundant code from SlowMode
wolfendale Aug 1, 2024
8652de2
chore: move slow mode setup to ready event handler
wolfendale Aug 1, 2024
cb7826c
fix: destroy stage instead of slow mode
wolfendale Aug 3, 2024
8611614
fix: make min value for limit 0
wolfendale Aug 3, 2024
8952802
chore: fix slow mode stats
wolfendale Aug 3, 2024
929ab5d
chore: fix style issues
wolfendale Aug 3, 2024
14e15b4
Merge pull request #30 from PretendoNetwork/auto-slow-mode
jonbarrow Aug 3, 2024
f0d67a0
fix: avoid adding the string "undefined" to notifications
MatthewL246 Aug 4, 2024
3b70934
chore: use user notifications instead of DMs everywhere
MatthewL246 Aug 4, 2024
acf6d21
feat: implement soft-bans in /kick
MatthewL246 Aug 5, 2024
915ec1d
enhancement: add delete messages option to /ban
MatthewL246 Aug 5, 2024
d988f5b
enhancement: allow commands to take user IDs
MatthewL246 Aug 5, 2024
c93636e
chore: add global flag to regex
MatthewL246 Aug 5, 2024
85511ea
enhancement: separate single and multi-user commands
MatthewL246 Aug 5, 2024
de372fc
enhancement: add context menus to commands
MatthewL246 Aug 6, 2024
907c973
enhancement: add delete message history option to context menus
MatthewL246 Aug 6, 2024
a0ce4d2
chore: simplify regex literals
MatthewL246 Aug 6, 2024
ce48b1b
chore: increase modal timeout to 14.5 minutes
MatthewL246 Aug 7, 2024
38a4e95
Merge pull request #35 from PretendoNetwork/notification-threads
jonbarrow Aug 7, 2024
85f56e1
chore: correct naming for ID variables
MatthewL246 Aug 7, 2024
1d5b8a4
chore: remove confusing "soft-ban" wording
MatthewL246 Aug 7, 2024
7280465
Merge pull request #39 from PretendoNetwork/kick-ban-delete-messages
jonbarrow Aug 9, 2024
6813c08
Merge pull request #41 from PretendoNetwork/command-context-menus
jonbarrow Aug 9, 2024
752d2dd
Merge pull request #40 from PretendoNetwork/command-user-ids
jonbarrow Aug 9, 2024
1b54c04
Make it possible to compile without a config.json
mrjvs Aug 18, 2024
245e502
Update dockerfile + add CI
mrjvs Aug 18, 2024
cc8239d
Fix folder permissions in dockerfile
mrjvs Aug 18, 2024
38ea7fb
Fix indentation type
mrjvs Aug 18, 2024
78308ca
Added required newlines
mrjvs Aug 18, 2024
dc6d0b7
Merge pull request #43 from mrjvs/feat/docker
jonbarrow Aug 18, 2024
7f95542
Update types to officially support node 20
binaryoverload Sep 22, 2024
1e442e7
Use libc version of node image for tensorflow, also add the lib folde…
binaryoverload Sep 22, 2024
139b9c0
Fix linting
binaryoverload Sep 22, 2024
f99ef97
Add process Ctrl-C handler
binaryoverload Sep 22, 2024
eced0be
Merge pull request #44 from binaryoverload/dev
jonbarrow Sep 23, 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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.git
node_modules
config.json
database
node_modules
db.json
dist/
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
"@typescript-eslint/no-extra-semi": "error",
"@typescript-eslint/keyword-spacing": "error",
"require-atomic-updates": "warn",
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Publish Docker Image

on:
push:
pull_request:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-publish:
env:
SHOULD_PUSH_IMAGE: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')) || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Set up QEMU for Docker
uses: docker/setup-qemu-action@v3

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

- name: Log into the container registry
if: ${{ env.SHOULD_PUSH_IMAGE == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=edge,enable=${{ github.ref == 'refs/heads/dev' }}
type=sha

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: ${{ env.SHOULD_PUSH_IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
66 changes: 45 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
FROM node:18-buster

RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \
build-essential \
curl \
git-core \
iputils-ping \
pkg-config \
rsync \
software-properties-common \
unzip \
wget
WORKDIR /app

COPY "docker/entrypoint.sh" ./

COPY package*.json ./
RUN npm install
# syntax=docker/dockerfile:1

ARG app_dir="/home/node/app"

# * Base Node.js image
FROM node:20-slim AS base
ARG app_dir
WORKDIR ${app_dir}
RUN apt-get update && apt-get install -y python3 python3-pip make gcc g++

# * Installing production dependencies
FROM base AS dependencies

RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci --omit=dev


# * Installing development dependencies and building the application
FROM base AS build

RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci

COPY . .
RUN npm run build

COPY . ./
# * Running the final application
FROM base AS final
ARG app_dir

RUN mkdir database && chown node:node database

ENV NODE_ENV=production
USER node


COPY package.json .

COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
COPY --from=build ${app_dir}/dist ${app_dir}/dist
COPY lib lib

VOLUME [ "/app/config.json", "/app/database", "/app/db.json" ]
VOLUME ["./config.json", "./database"]

CMD ["sh", "entrypoint.sh"]
CMD ["node", "--max-old-space-size=4096", "."]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ Features:
- `/kick` command for kicking users. Supports multiple users per kick. 3 kicks results in a ban
- `/ban` command for banning users. Supports multiple users per warning
- NSFW content detection

Requirements:

- Linux OS
- At least 4096mb available memory

As we rely on the `phhammdist` extension for Sqlite3 (which is included in `lib/phhammdist`) currently this only supports Linux
2 changes: 0 additions & 2 deletions example.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"bot_token": "TOKEN",
"nsfw_model_path": "./nsfw_model",
"quantized_nsfw_model": false,
"json_db_path": "./db.json",
"sequelize": {
"force": false,
Expand Down
3 changes: 3 additions & 0 deletions lib/phhammdist/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The source of https://github.com/greycubesgav/sqlite-phhammdist/tree/master was modified to allow base 2 strings

updated source available at https://github.com/PretendoNetwork/sqlite-phhammdist
Loading