Skip to content

Conversation

@Vivekgupta008
Copy link
Contributor

🚀 Discord Bot Integration for Devr.AI

Fixes #di

📌 Summary

This PR adds a Discord bot that integrates with Devr.AI, enabling seamless community engagement, automated event handling, and FAQ responses. The bot listens for key events (messages, reactions, user joins, etc.) and dispatches them via an event bus for further processing.

✨ Features Added

  • Event Handling

    • on_message: Captures and processes user messages.
    • on_message_edit: Detects and logs message edits.
    • on_message_delete: Handles message deletions.
    • on_member_join: Triggers onboarding events for new members.
    • on_raw_reaction_add: Captures reactions to messages.
  • Event Bus & Handlers

    • EventBus: Manages event dispatching for modular processing.
    • HandlerRegistry: Stores registered handlers for different event types.
    • FAQHandler: Detects FAQ queries and responds with predefined answers.
    • MessageHandler: Manages standard message-related events.
    • OnboardingHandler: Sends welcome messages to new users.
  • Duplicate Event Prevention

    • Tracks processed events using processed_events set to avoid duplicate dispatching.

🔧 Fixes & Improvements

  • Ensured correct channel_id propagation in event dispatching.
  • Improved logging for better debugging and traceability.
  • Enhanced channel retrieval using fetch_channel() as a fallback if get_channel() fails.

🚀 How to Test

  1. Set up a .env file with DISCORD_BOT_TOKEN.
  2. Run the bot using:
    python bot.py
    

image

image

@Vivekgupta008 Vivekgupta008 changed the title (SR No. 10) Create discord bot and integrate it with event bus (SR No. 11) Create discord bot and integrate it with event bus Mar 21, 2025
@ishaanxgupta
Copy link
Contributor

Looks Great!

@smokeyScraper
Copy link
Contributor

@Vivekgupta008
can you please check on twice initialized ANALYTICS_COLLECTED = "analytics.collected" in events/enums.py, it wasn't a change by your side, don't know how it got initialized twice, might have been some conflict not resolved properly.

@Vivekgupta008
Copy link
Contributor Author

Yaa, it was inherited from previous prs. Done it. Thanks

@chandansgowda chandansgowda merged commit 6a4ab72 into AOSSIE-Org:main Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants