File tree 7 files changed +19
-53
lines changed
7 files changed +19
-53
lines changed Original file line number Diff line number Diff line change 13
13
test :
14
14
runs-on : ubuntu-latest
15
15
steps :
16
- - uses : actions/checkout@v4
16
+ - uses : actions/checkout@v3
17
17
- uses : oven-sh/setup-bun@v1
18
18
- run : bun install --frozen-lockfile
19
19
- run : bun run tsc
@@ -26,20 +26,20 @@ jobs:
26
26
packages : write
27
27
28
28
steps :
29
- - uses : actions/checkout@v4
29
+ - uses : actions/checkout@v3
30
30
- uses : oven-sh/setup-bun@v1
31
31
- run : bun install --frozen-lockfile
32
32
- run : bun run build
33
33
- name : Log in to the Container registry
34
- uses : docker/login-action@v3
34
+ uses : docker/login-action@v2
35
35
with :
36
36
registry : ${{ env.REGISTRY }}
37
37
username : ${{ github.actor }}
38
38
password : ${{ secrets.GITHUB_TOKEN }}
39
39
40
40
- name : Extract metadata (tags, labels) for Docker
41
41
id : meta
42
- uses : docker/metadata-action@v5
42
+ uses : docker/metadata-action@v4
43
43
with :
44
44
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45
45
Original file line number Diff line number Diff line change 1
- FROM oven/bun:1
1
+ FROM gcr.io/distroless/nodejs18-debian11
2
2
3
3
WORKDIR /app
4
- COPY dist/server.js /app/server.js
4
+
5
+ COPY dist /app
5
6
6
7
EXPOSE 3000
7
8
8
9
ENV NODE_ENV=production
9
10
10
- CMD ["server .js" ]
11
+ CMD ["index .js" ]
Original file line number Diff line number Diff line change 6
6
"repository" : " https://github.com/karl-run/1337-bot.git" ,
7
7
"packageManager" : " yarn@3.5.1" ,
8
8
"scripts" : {
9
- "start" : " bun run src/server.ts" ,
10
- "build" : " bun build --target=bun src/server.ts --outfile dist/server.js "
9
+ "start" : " ncc run src/server.ts" ,
10
+ "build" : " ncc build src/server.ts -o dist"
11
11
},
12
12
"dependencies" : {
13
13
"@slack/bolt" : " ^3.13.1" ,
14
14
"croner" : " ^7.0.1" ,
15
15
"date-fns" : " ^2.30.0" ,
16
16
"date-fns-tz" : " ^2.0.0" ,
17
+ "dotenv" : " ^16.0.3" ,
17
18
"open" : " ^9.1.0" ,
18
19
"pg" : " ^8.11.3" ,
19
20
"remeda" : " ^1.27.0" ,
20
21
"yargs" : " ^17.7.2"
21
22
},
22
23
"devDependencies" : {
23
- "@types/bun" : " ^1.1.1" ,
24
24
"@types/node" : " ^20.2.3" ,
25
25
"@types/pg" : " ^8.10.2" ,
26
26
"@types/yargs" : " ^17.0.25" ,
27
+ "@types/bun" : " ^1.1.1" ,
28
+ "@vercel/ncc" : " ^0.38.0" ,
27
29
"prettier" : " ^3.0.3" ,
28
30
"prettier-plugin-sql" : " ^0.15.1" ,
29
31
"typescript" : " ^5.2.2"
Original file line number Diff line number Diff line change 1
- import { startOfDay , startOfYear } from "date-fns" ;
2
- import { app } from "../src/slack/slack" ;
3
-
4
- // @ts -ignore Bun :)
5
- const messages = await app . client . conversations . history ( {
6
- channel : "C04N7R2F8B0" ,
7
- oldest : `${ startOfYear ( new Date ( ) ) . getTime ( ) / 1000 } ` ,
8
- } ) ;
9
-
10
- console . log ( messages . has_more ) ;
11
- console . log ( messages . response_metadata . next_cursor ) ;
12
- console . log ( messages . messages . length ) ;
13
-
14
- let pages = 1 ;
15
- let nextCursor = messages . response_metadata . next_cursor ;
16
-
17
- while ( nextCursor != null ) {
18
- try {
19
- // @ts -ignore Bun :)
20
- const nextMessages = await app . client . conversations . history ( {
21
- channel : "C04N7R2F8B0" ,
22
- oldest : `${ startOfYear ( new Date ( ) ) . getTime ( ) / 1000 } ` ,
23
- cursor : nextCursor ,
24
- } ) ;
25
-
26
- nextCursor = nextMessages . response_metadata . next_cursor ;
27
-
28
- if ( pages > 3 ) {
29
- break ;
30
- }
31
-
32
- pages ++ ;
33
- console . log ( `Page: ${ pages } ` ) ;
34
- console . log ( messages . has_more ) ;
35
- console . log ( messages . response_metadata . next_cursor ) ;
36
- console . log ( messages . messages . length ) ;
37
-
38
- console . log ( messages . messages . map ( ( it ) => it . text ) ) ;
39
- } catch ( e ) {
40
- console . error ( e ) ;
41
- break ;
42
- }
43
- }
Original file line number Diff line number Diff line change
1
+ import { config } from "dotenv" ;
1
2
import { Client } from "pg" ;
2
3
4
+ config ( ) ;
5
+
3
6
export const client = new Client ( {
4
7
host : process . env . DATABASE_URL ,
5
8
user : process . env . DATABASE_USER ,
Original file line number Diff line number Diff line change 1
1
import { App } from "@slack/bolt" ;
2
+ import { config } from "dotenv" ;
3
+
4
+ config ( ) ;
2
5
3
6
export const app = new App ( {
4
7
token : process . env . BOT_TOKEN ,
You can’t perform that action at this time.
0 commit comments