Skip to content

Commit 7df403b

Browse files
committed
#minor various command additions and improvements, added second script for support module
- Completely overhauled the user flow for `/subscribe` -- uses buttons and menu selections, explanations - Added `/items` command with `armor`/`weapon`/`grenade`/`booster` subcommands returning their stats, perks, etc. - Added `/updates` command, allowing you to see updates/posts from a variety of sources - the goal of this is to allow users who aren't in the official HD2 Discord to see the Community Managers' communications more easily - sources include: - High Command Dispatches (from the HD2 discord) - HD2 Announcements (from the HD2 discord) - Arrowhead Games News (from the HD2 discord) - HD2 Patch Notes (from the official Steam community) - Steam Posts (from the official Steam community) - Improved `/map` with more features, hopefully making it more generally useful - added supply lines, making paths between planets very clear - scaled up planet icons; active campaign planets have been *significantly* scaled up - planet faction colours are more visible and active campaign planets are slightly different - campaign planet colours are now displayed as a coloured pie chart - Renamed `/discord` to `/links`, updated its description and styling, and added external link buttons for each website - Added `/warbond` command featuring all current warbonds and their items - Changed war status summary message to include an external Ko-fi link - Developed a support bot/program to enable more functionality - runs using PM2 in the same container as the main bot - Built out frameworks so I can use more Discord's features more easily - Added more fields to be saved as historical data - Many bug fixes and optimization
1 parent a587970 commit 7df403b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3260
-1415
lines changed

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ COPY ./fonts ./fonts
1010
COPY ./images ./images
1111
COPY ./wiki ./wiki
1212
# Build the project, then re-install only runtime dependencies
13-
RUN npm run build \
13+
RUN npm run build \
1414
&& npm ci --omit=dev
1515
# - - - FRESH BUILD STAGE - - -
1616
FROM node:20-alpine as deploy
17+
ENV NEW_RELIC_NO_CONFIG_FILE=true
18+
ENV NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true
19+
ENV NEW_RELIC_LOG=stdout
1720
## These are runtime dependencies required by node-canvas
1821
RUN apk add --no-cache cairo pango libjpeg-turbo
1922
WORKDIR /home/node/app
@@ -24,8 +27,11 @@ COPY --chown=node:node package*.json *.config.js ./
2427
COPY --chown=node:node --from=build /app/fonts ./fonts
2528
COPY --chown=node:node --from=build /app/images ./images
2629
COPY --chown=node:node --from=build /app/wiki ./wiki
30+
31+
RUN npm install -g pm2
32+
2733
# Set 'node' as owner of this directory (permits creating files eg. logs)
2834
RUN chown -h node:node .
2935
USER node
3036
# Start the application
31-
CMD ["node", "build/src/index.js"]
37+
CMD ["pm2-runtime", "ecosystem.config.js"]

drizzle.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ dotenv.config();
66
export default {
77
schema: './src/db/schema.ts',
88
out: './drizzle',
9-
driver: 'pg',
9+
dialect: 'postgresql',
1010
dbCredentials: {
11-
connectionString: process.env.DATABASE_URL as string,
11+
url: process.env.DATABASE_URL as string,
1212
},
1313
} satisfies Config;

drizzle/0010_dark_nova.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE TABLE IF NOT EXISTS "arrowhead_discord_anns" (
2+
"message_id" varchar PRIMARY KEY NOT NULL,
3+
"channel_id" varchar NOT NULL,
4+
"channel_name" varchar NOT NULL,
5+
"content" varchar NOT NULL,
6+
"timestamp" timestamp NOT NULL,
7+
"edited_timestamp" timestamp,
8+
"created_at" timestamp DEFAULT now() NOT NULL
9+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "arrowhead_discord_anns" ADD COLUMN "attachment_urls" json;

drizzle/meta/0000_snapshot.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"id": "5f8ada69-3f53-4d4e-8f3d-b2db5fbc20c8",
3-
"prevId": "00000000-0000-0000-0000-000000000000",
4-
"version": "5",
5-
"dialect": "pg",
2+
"version": "6",
3+
"dialect": "postgresql",
64
"tables": {
7-
"announcement_channels": {
5+
"public.announcement_channels": {
86
"name": "announcement_channels",
97
"schema": "",
108
"columns": {
@@ -51,7 +49,7 @@
5149
"compositePrimaryKeys": {},
5250
"uniqueConstraints": {}
5351
},
54-
"persistent_messages": {
52+
"public.persistent_messages": {
5553
"name": "persistent_messages",
5654
"schema": "",
5755
"columns": {
@@ -106,18 +104,21 @@
106104
}
107105
},
108106
"enums": {
109-
"user_perms": {
107+
"public.user_perms": {
110108
"name": "user_perms",
111-
"values": {
112-
"admin": "admin",
113-
"officer": "officer"
114-
}
109+
"schema": "public",
110+
"values": [
111+
"admin",
112+
"officer"
113+
]
115114
}
116115
},
117116
"schemas": {},
118117
"_meta": {
119-
"columns": {},
120118
"schemas": {},
121-
"tables": {}
122-
}
119+
"tables": {},
120+
"columns": {}
121+
},
122+
"id": "5f8ada69-3f53-4d4e-8f3d-b2db5fbc20c8",
123+
"prevId": "00000000-0000-0000-0000-000000000000"
123124
}

drizzle/meta/0001_snapshot.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"id": "cab2e7f3-b27e-4e52-a1d2-ea18c83bf156",
3-
"prevId": "5f8ada69-3f53-4d4e-8f3d-b2db5fbc20c8",
4-
"version": "5",
5-
"dialect": "pg",
2+
"version": "6",
3+
"dialect": "postgresql",
64
"tables": {
7-
"announcement_channels": {
5+
"public.announcement_channels": {
86
"name": "announcement_channels",
97
"schema": "",
108
"columns": {
@@ -51,7 +49,7 @@
5149
"compositePrimaryKeys": {},
5250
"uniqueConstraints": {}
5351
},
54-
"persistent_messages": {
52+
"public.persistent_messages": {
5553
"name": "persistent_messages",
5654
"schema": "",
5755
"columns": {
@@ -106,18 +104,21 @@
106104
}
107105
},
108106
"enums": {
109-
"user_perms": {
107+
"public.user_perms": {
110108
"name": "user_perms",
111-
"values": {
112-
"admin": "admin",
113-
"officer": "officer"
114-
}
109+
"schema": "public",
110+
"values": [
111+
"admin",
112+
"officer"
113+
]
115114
}
116115
},
117116
"schemas": {},
118117
"_meta": {
119-
"columns": {},
120118
"schemas": {},
121-
"tables": {}
122-
}
119+
"tables": {},
120+
"columns": {}
121+
},
122+
"id": "cab2e7f3-b27e-4e52-a1d2-ea18c83bf156",
123+
"prevId": "5f8ada69-3f53-4d4e-8f3d-b2db5fbc20c8"
123124
}

drizzle/meta/0002_snapshot.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"id": "1da07753-15a2-4548-a8cb-a6095b0743d9",
3-
"prevId": "cab2e7f3-b27e-4e52-a1d2-ea18c83bf156",
4-
"version": "5",
5-
"dialect": "pg",
2+
"version": "6",
3+
"dialect": "postgresql",
64
"tables": {
7-
"announcement_channels": {
5+
"public.announcement_channels": {
86
"name": "announcement_channels",
97
"schema": "",
108
"columns": {
@@ -51,7 +49,7 @@
5149
"compositePrimaryKeys": {},
5250
"uniqueConstraints": {}
5351
},
54-
"persistent_messages": {
52+
"public.persistent_messages": {
5553
"name": "persistent_messages",
5654
"schema": "",
5755
"columns": {
@@ -113,18 +111,21 @@
113111
}
114112
},
115113
"enums": {
116-
"user_perms": {
114+
"public.user_perms": {
117115
"name": "user_perms",
118-
"values": {
119-
"admin": "admin",
120-
"officer": "officer"
121-
}
116+
"schema": "public",
117+
"values": [
118+
"admin",
119+
"officer"
120+
]
122121
}
123122
},
124123
"schemas": {},
125124
"_meta": {
126-
"columns": {},
127125
"schemas": {},
128-
"tables": {}
129-
}
126+
"tables": {},
127+
"columns": {}
128+
},
129+
"id": "1da07753-15a2-4548-a8cb-a6095b0743d9",
130+
"prevId": "cab2e7f3-b27e-4e52-a1d2-ea18c83bf156"
130131
}

drizzle/meta/0003_snapshot.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"id": "186cdb9d-92a1-43cd-80e3-298f8590c594",
3-
"prevId": "1da07753-15a2-4548-a8cb-a6095b0743d9",
4-
"version": "5",
5-
"dialect": "pg",
2+
"version": "6",
3+
"dialect": "postgresql",
64
"tables": {
7-
"announcement_channels": {
5+
"public.announcement_channels": {
86
"name": "announcement_channels",
97
"schema": "",
108
"columns": {
@@ -51,7 +49,7 @@
5149
"compositePrimaryKeys": {},
5250
"uniqueConstraints": {}
5351
},
54-
"persistent_messages": {
52+
"public.persistent_messages": {
5553
"name": "persistent_messages",
5654
"schema": "",
5755
"columns": {
@@ -113,18 +111,21 @@
113111
}
114112
},
115113
"enums": {
116-
"user_perms": {
114+
"public.user_perms": {
117115
"name": "user_perms",
118-
"values": {
119-
"admin": "admin",
120-
"officer": "officer"
121-
}
116+
"schema": "public",
117+
"values": [
118+
"admin",
119+
"officer"
120+
]
122121
}
123122
},
124123
"schemas": {},
125124
"_meta": {
126-
"columns": {},
127125
"schemas": {},
128-
"tables": {}
129-
}
126+
"tables": {},
127+
"columns": {}
128+
},
129+
"id": "186cdb9d-92a1-43cd-80e3-298f8590c594",
130+
"prevId": "1da07753-15a2-4548-a8cb-a6095b0743d9"
130131
}

drizzle/meta/0004_snapshot.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"id": "2329915e-8c3c-4665-84f5-29533a5a5d2b",
3-
"prevId": "186cdb9d-92a1-43cd-80e3-298f8590c594",
4-
"version": "5",
5-
"dialect": "pg",
2+
"version": "6",
3+
"dialect": "postgresql",
64
"tables": {
7-
"announcement_channels": {
5+
"public.announcement_channels": {
86
"name": "announcement_channels",
97
"schema": "",
108
"columns": {
@@ -51,7 +49,7 @@
5149
"compositePrimaryKeys": {},
5250
"uniqueConstraints": {}
5351
},
54-
"persistent_messages": {
52+
"public.persistent_messages": {
5553
"name": "persistent_messages",
5654
"schema": "",
5755
"columns": {
@@ -113,18 +111,21 @@
113111
}
114112
},
115113
"enums": {
116-
"user_perms": {
114+
"public.user_perms": {
117115
"name": "user_perms",
118-
"values": {
119-
"admin": "admin",
120-
"officer": "officer"
121-
}
116+
"schema": "public",
117+
"values": [
118+
"admin",
119+
"officer"
120+
]
122121
}
123122
},
124123
"schemas": {},
125124
"_meta": {
126-
"columns": {},
127125
"schemas": {},
128-
"tables": {}
129-
}
126+
"tables": {},
127+
"columns": {}
128+
},
129+
"id": "2329915e-8c3c-4665-84f5-29533a5a5d2b",
130+
"prevId": "186cdb9d-92a1-43cd-80e3-298f8590c594"
130131
}

drizzle/meta/0005_snapshot.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"id": "e0fd70b8-3890-4740-a5fe-17b7396d4969",
3-
"prevId": "2329915e-8c3c-4665-84f5-29533a5a5d2b",
4-
"version": "5",
5-
"dialect": "pg",
2+
"version": "6",
3+
"dialect": "postgresql",
64
"tables": {
7-
"announcement_channels": {
5+
"public.announcement_channels": {
86
"name": "announcement_channels",
97
"schema": "",
108
"columns": {
@@ -51,7 +49,7 @@
5149
"compositePrimaryKeys": {},
5250
"uniqueConstraints": {}
5351
},
54-
"api_data": {
52+
"public.api_data": {
5553
"name": "api_data",
5654
"schema": "",
5755
"columns": {
@@ -86,7 +84,7 @@
8684
"compositePrimaryKeys": {},
8785
"uniqueConstraints": {}
8886
},
89-
"persistent_messages": {
87+
"public.persistent_messages": {
9088
"name": "persistent_messages",
9189
"schema": "",
9290
"columns": {
@@ -148,18 +146,21 @@
148146
}
149147
},
150148
"enums": {
151-
"user_perms": {
149+
"public.user_perms": {
152150
"name": "user_perms",
153-
"values": {
154-
"admin": "admin",
155-
"officer": "officer"
156-
}
151+
"schema": "public",
152+
"values": [
153+
"admin",
154+
"officer"
155+
]
157156
}
158157
},
159158
"schemas": {},
160159
"_meta": {
161-
"columns": {},
162160
"schemas": {},
163-
"tables": {}
164-
}
161+
"tables": {},
162+
"columns": {}
163+
},
164+
"id": "e0fd70b8-3890-4740-a5fe-17b7396d4969",
165+
"prevId": "2329915e-8c3c-4665-84f5-29533a5a5d2b"
165166
}

0 commit comments

Comments
 (0)