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

Move Discord Bot app to main commonwealth package #9425

Merged
merged 26 commits into from
Oct 8, 2024

Conversation

timolegros
Copy link
Collaborator

@timolegros timolegros commented Oct 3, 2024

Link to Issue

Closes: #9392

Description of Changes

  • Created the DiscordBotPolicy which handles messages from the MessageRelayer and replaces the discord-consumer and the discord bot integration API
  • Moved the discord listener to a worker in the main commonwealth app
  • Created proper event pipelines for each Discord bot event message type

Test Plan

  1. Add DiscordThreadCreated,DiscordThreadBodyUpdated,DiscordThreadTitleUpdated,DiscordThreadDeleted,DiscordThreadCommentCreated,DiscordThreadCommentUpdated,DiscordThreadCommentDeleted to ALLOWED_EVENTS in .env.
  2. In packages/commonwealth execute:
    • pnpm start
    • pnpm start-message-relayer
    • pnpm start-discord-listener
    • pnpm start-consumer
  3. In the app link one of your communities + topics to a discord server
  4. CRUD threads and comments in Discord and check that each operation is correctly synced to the commonwealth forum

Deployment Plan

  1. Delete both Heroku discord bot apps
  2. DiscordThreadCreated,DiscordThreadBodyUpdated,DiscordThreadTitleUpdated,DiscordThreadDeleted,DiscordThreadCommentCreated,DiscordThreadCommentUpdated,DiscordThreadCommentDeleted to ALLOWED_EVENTS
  3. Ensure DISCORD_TOKEN and DISCORD_CLIENT_ID env var are set in all Heroku env
  4. Remove CW_BOT_KEY environment variable

Other Considerations

@timolegros timolegros marked this pull request as ready for review October 3, 2024 19:30
@Rotorsoft
Copy link
Contributor

A few issues when trying to test this:

  • Remove discord-bot/tsconfig.build.json from main package.json
  • Note that these scripts are inside commonwealth, I usually run: p -F commonwealth start-message-relayer
    • pnpm start-message-relayer
    • pnpm start-discord-listener
    • pnpm start-consumer
  • Need to add new events to .env allowed events

@timolegros
Copy link
Collaborator Author

A few issues when trying to test this:

* Remove discord-bot/tsconfig.build.json from main package.json

* Note that these scripts are inside commonwealth, I usually run: `p -F commonwealth start-message-relayer`
  
  * pnpm start-message-relayer
  * pnpm start-discord-listener
  * pnpm start-consumer

* Need to add new events to .env allowed events

fixed

Copy link
Contributor

@Rotorsoft Rotorsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested adding, editing, removing discord posts and comments... works as expected 👍

@timolegros timolegros added the deployment plan (PRs only) requires manual infrastructure changes on release label Oct 8, 2024
@timolegros timolegros merged commit 8e2ccb3 into master Oct 8, 2024
10 checks passed
@timolegros timolegros deleted the tim/merge-discord-bot branch October 8, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment plan (PRs only) requires manual infrastructure changes on release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge Discobot App with CommonwealthApp
3 participants