From 867b9f029baf8c663823d0c40a092cf00c9ec7d8 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 14 Oct 2024 14:21:35 +0400 Subject: [PATCH 1/3] feat: add queue and event for the DiscordHivemindAdapter --- package.json | 4 ++-- src/enums/event.enum.ts | 24 ++++++++++++++---------- src/enums/queue.enum.ts | 4 +--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index f621781..cc89215 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@togethercrew.dev/tc-messagebroker", - "version": "0.0.46", + "version": "0.0.47", "description": "a service that include common things that need in every microservies ", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -28,4 +28,4 @@ "files": [ "dist/**/*" ] -} \ No newline at end of file +} diff --git a/src/enums/event.enum.ts b/src/enums/event.enum.ts index 77d133c..96658cd 100644 --- a/src/enums/event.enum.ts +++ b/src/enums/event.enum.ts @@ -14,7 +14,7 @@ enum AnalyzerEvent { const ServerEvent = { UPDATE_GUILD: 'UPDATE_GUILD', - ANNOUNCEMENT_SAFETY_MESSAGE: 'ANNOUNCEMENT_SAFETY_MESSAGE' + ANNOUNCEMENT_SAFETY_MESSAGE: 'ANNOUNCEMENT_SAFETY_MESSAGE', }; const DiscordBotEvent = { @@ -29,7 +29,12 @@ const DiscordBotEvent = { }, FOLLOWUP_MESSAGE: { CREATE: 'FOLLOWUP_CREATE', - } + }, +}; + +const DiscordHivemindAdapterEvent = { + DISCORD_COMMAND_RECIVED: 'DISCORD_COMMAND_RECIVED', + HIVEMIND_RESPONSE_RECIVED: 'HIVEMIND_RESPONSE_RECIVED', }; const DiscordAnalyzerEvent = { @@ -38,23 +43,22 @@ const DiscordAnalyzerEvent = { const TwitterBotEvent = { EXTRACT: { - TWEETS: "EXTRACT_TWEETS", - LIKES: "EXTRACT_LIKES", - PROFILES: "EXTRACT_PROFILES" + TWEETS: 'EXTRACT_TWEETS', + LIKES: 'EXTRACT_LIKES', + PROFILES: 'EXTRACT_PROFILES', }, SEND_MESSAGE: 'SEND_MESSAGE', -} +}; const HivemindEvent = { - INTERACTION_CREATED: 'INTERACTION_CREATED', - GUILD_MESSAGES_UPDATED: 'GUILD_MESSAGES_UPDATED', -} + QUESTION_RECIVED: 'QUESTION_RECIVED', +}; export const Event = { [Queue.SERVER_API]: ServerEvent, [Queue.DISCORD_BOT]: DiscordBotEvent, [Queue.DISCORD_ANALYZER]: DiscordAnalyzerEvent, - + [Queue.DISCORD_HIVEMIND_ADAPTER]: DiscordHivemindAdapterEvent, [Queue.TWITTER_BOT]: TwitterBotEvent, [Queue.HIVEMIND]: HivemindEvent, } as const; diff --git a/src/enums/queue.enum.ts b/src/enums/queue.enum.ts index 77acf77..873f70d 100644 --- a/src/enums/queue.enum.ts +++ b/src/enums/queue.enum.ts @@ -2,9 +2,7 @@ export enum Queue { SERVER_API = 'SERVER_API', DISCORD_BOT = 'DISCORD_BOT', DISCORD_ANALYZER = 'DISCORD_ANALYZER', - - // TWITTER + DISCORD_HIVEMIND_ADAPTER = 'DISCORD_HIVEMIND_ADAPTER', TWITTER_BOT = 'TWITTER_BOT', - HIVEMIND = 'HIVEMIND', } From 610cba85cf2cb1da17d78de4f73b64080bb70f08 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Mon, 14 Oct 2024 14:32:40 +0400 Subject: [PATCH 2/3] feat: change event names --- src/enums/event.enum.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/enums/event.enum.ts b/src/enums/event.enum.ts index 96658cd..0eb1cf9 100644 --- a/src/enums/event.enum.ts +++ b/src/enums/event.enum.ts @@ -33,8 +33,8 @@ const DiscordBotEvent = { }; const DiscordHivemindAdapterEvent = { - DISCORD_COMMAND_RECIVED: 'DISCORD_COMMAND_RECIVED', - HIVEMIND_RESPONSE_RECIVED: 'HIVEMIND_RESPONSE_RECIVED', + QUESTION_COMMAND_RECIVED: 'QUESTION_COMMAND_RECIVED', + QUESTION_RESPONSE_RECIVED: 'QUESTION_RESPONSE_RECIVED', }; const DiscordAnalyzerEvent = { From 3eef6cec6bf71d41a8b5a78d0d8eed14a508c444 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei Date: Tue, 15 Oct 2024 15:21:44 +0400 Subject: [PATCH 3/3] fix: fix typo --- src/enums/event.enum.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/enums/event.enum.ts b/src/enums/event.enum.ts index 0eb1cf9..95f6632 100644 --- a/src/enums/event.enum.ts +++ b/src/enums/event.enum.ts @@ -33,8 +33,8 @@ const DiscordBotEvent = { }; const DiscordHivemindAdapterEvent = { - QUESTION_COMMAND_RECIVED: 'QUESTION_COMMAND_RECIVED', - QUESTION_RESPONSE_RECIVED: 'QUESTION_RESPONSE_RECIVED', + QUESTION_COMMAND_RECIVED: 'QUESTION_COMMAND_RECEIVED', + QUESTION_RESPONSE_RECIVED: 'QUESTION_RESPONSE_RECEIVED', }; const DiscordAnalyzerEvent = { @@ -51,7 +51,7 @@ const TwitterBotEvent = { }; const HivemindEvent = { - QUESTION_RECIVED: 'QUESTION_RECIVED', + QUESTION_RECIVED: 'QUESTION_RECEIVED', }; export const Event = {