diff --git a/templates/default/.env.example b/templates/default/.env.example index b690f3c..be002c9 100644 --- a/templates/default/.env.example +++ b/templates/default/.env.example @@ -3,4 +3,6 @@ TEST_BSKY_PASSWORD= DEBUG_LOG_ACTIVE=true DEBUG_LOG_LEVEL=info -JETSTREAM_URL='ws://jetstream:6008/subscribe' \ No newline at end of file +JETSTREAM_URL='ws://jetstream:6008/subscribe' + +SESSION_DATA_PATH='/sessionData' \ No newline at end of file diff --git a/templates/default/Dockerfile b/templates/default/Dockerfile index 6fcf96c..3f07e35 100644 --- a/templates/default/Dockerfile +++ b/templates/default/Dockerfile @@ -1,4 +1,4 @@ -FROM oven/bun:1.0.15 as base +FROM oven/bun:latest as base WORKDIR /usr/src/app # install dependencies into temp directory diff --git a/templates/default/docker-compose.yml b/templates/default/docker-compose.yml index 3d81e08..d3975fc 100644 --- a/templates/default/docker-compose.yml +++ b/templates/default/docker-compose.yml @@ -5,6 +5,8 @@ services: - jetstream build: . restart: unless-stopped + volumes: + - ./sessionData:/sessionData env_file: - .env networks: @@ -14,6 +16,7 @@ services: jetstream: image: "junibqueer/jetstream:main" container_name: jetstream + restart: unless-stopped environment: - CURSOR_FILE=/data/cursor.json ports: diff --git a/templates/default/package.json b/templates/default/package.json index c14eb7f..c3f1588 100644 --- a/templates/default/package.json +++ b/templates/default/package.json @@ -15,7 +15,7 @@ "typescript": "^5.0.0" }, "dependencies": { - "bsky-event-handlers": "^2.0.0-beta.9", + "bsky-event-handlers": "^2.0.0-beta.19", "@atproto/api": "^0.12.23" }, "license": "{{license}}" diff --git a/templates/default/src/index.ts b/templates/default/src/index.ts index b8c6666..a81e807 100644 --- a/templates/default/src/index.ts +++ b/templates/default/src/index.ts @@ -8,7 +8,7 @@ import { JetstreamSubscription, LogMessageAction, ReplyingToBotValidator, - ReplyToSkeetAction, + MessageHandler, IntervalSubscription, IntervalSubscriptionHandlers, AbstractHandler, @@ -30,9 +30,9 @@ let jetstreamSubscription: JetstreamSubscription; let handlers = { post: { c: [ - new CreateSkeetHandler( - [new ReplyingToBotValidator(), new InputEqualsValidator("Hello")], - [new LogMessageAction(), new ReplyToSkeetAction("World!")], + new MessageHandler( + [ReplyingToBotValidator().make(), InputEqualsValidator("Hello").make()], + [LogMessageAction().make(), CreateSkeetAction.make('World!', MessageHandler.generateReplyFromMessage)], testAgent ), new GoodBotHandler(testAgent), diff --git a/templates/interval/.env.example b/templates/interval/.env.example index b690f3c..4fc61b9 100644 --- a/templates/interval/.env.example +++ b/templates/interval/.env.example @@ -1,6 +1,4 @@ TEST_BSKY_HANDLE= TEST_BSKY_PASSWORD= DEBUG_LOG_ACTIVE=true -DEBUG_LOG_LEVEL=info - -JETSTREAM_URL='ws://jetstream:6008/subscribe' \ No newline at end of file +DEBUG_LOG_LEVEL=info \ No newline at end of file diff --git a/templates/interval/Dockerfile b/templates/interval/Dockerfile index 6fcf96c..3f07e35 100644 --- a/templates/interval/Dockerfile +++ b/templates/interval/Dockerfile @@ -1,4 +1,4 @@ -FROM oven/bun:1.0.15 as base +FROM oven/bun:latest as base WORKDIR /usr/src/app # install dependencies into temp directory diff --git a/templates/interval/package.json b/templates/interval/package.json index c14eb7f..c3f1588 100644 --- a/templates/interval/package.json +++ b/templates/interval/package.json @@ -15,7 +15,7 @@ "typescript": "^5.0.0" }, "dependencies": { - "bsky-event-handlers": "^2.0.0-beta.9", + "bsky-event-handlers": "^2.0.0-beta.19", "@atproto/api": "^0.12.23" }, "license": "{{license}}" diff --git a/templates/jetstream/.env.example b/templates/jetstream/.env.example new file mode 100644 index 0000000..be002c9 --- /dev/null +++ b/templates/jetstream/.env.example @@ -0,0 +1,8 @@ +TEST_BSKY_HANDLE= +TEST_BSKY_PASSWORD= +DEBUG_LOG_ACTIVE=true +DEBUG_LOG_LEVEL=info + +JETSTREAM_URL='ws://jetstream:6008/subscribe' + +SESSION_DATA_PATH='/sessionData' \ No newline at end of file diff --git a/templates/jetstream/docker-compose.yml b/templates/jetstream/docker-compose.yml index 3d81e08..d3975fc 100644 --- a/templates/jetstream/docker-compose.yml +++ b/templates/jetstream/docker-compose.yml @@ -5,6 +5,8 @@ services: - jetstream build: . restart: unless-stopped + volumes: + - ./sessionData:/sessionData env_file: - .env networks: @@ -14,6 +16,7 @@ services: jetstream: image: "junibqueer/jetstream:main" container_name: jetstream + restart: unless-stopped environment: - CURSOR_FILE=/data/cursor.json ports: diff --git a/templates/jetstream/package.json b/templates/jetstream/package.json index c14eb7f..c3f1588 100644 --- a/templates/jetstream/package.json +++ b/templates/jetstream/package.json @@ -15,7 +15,7 @@ "typescript": "^5.0.0" }, "dependencies": { - "bsky-event-handlers": "^2.0.0-beta.9", + "bsky-event-handlers": "^2.0.0-beta.19", "@atproto/api": "^0.12.23" }, "license": "{{license}}" diff --git a/templates/jetstream/src/index.ts b/templates/jetstream/src/index.ts index 5cbc905..df77131 100644 --- a/templates/jetstream/src/index.ts +++ b/templates/jetstream/src/index.ts @@ -1,6 +1,6 @@ import { BadBotHandler, - CreateSkeetHandler, + CreateSkeetAction, DebugLog, GoodBotHandler, HandlerAgent, @@ -8,7 +8,7 @@ import { JetstreamSubscription, LogMessageAction, ReplyingToBotValidator, - ReplyToSkeetAction + MessageHandler } from 'bsky-event-handlers'; const testAgent = new HandlerAgent( @@ -25,9 +25,9 @@ let jetstreamSubscription: JetstreamSubscription; let handlers = { post: { c: [ - new CreateSkeetHandler( - [new ReplyingToBotValidator(), new InputEqualsValidator("Hello")], - [new LogMessageAction(), new ReplyToSkeetAction("World!")], + new MessageHandler( + [ReplyingToBotValidator().make(), InputEqualsValidator("Hello").make()], + [LogMessageAction().make(), CreateSkeetAction.make('World!', MessageHandler.generateReplyFromMessage)], testAgent ), new GoodBotHandler(testAgent),