-
Notifications
You must be signed in to change notification settings - Fork 0
1 intro
The GitHub-Discord Webhook package is a powerful integration tool that seamlessly connects GitHub repositories with Discord channels. It allows for customizable notifications of various GitHub events to be sent directly to specified Discord channels.
The package utilizes three main factories:
- Located in
src\Factories\PayloadFactory.php - Creates payload instances based on GitHub events
- Uses
PayloadResolverto determine the appropriate payload class
- Located in
src\Factories\WebhookFactory.php - Creates webhook profiles based on configuration settings
- Extracts webhook name from the request URI
- Located in
src\Factories\MessageFactory.php - Creates message objects based on events and webhook data
- Supports custom overrides for message classes
The package uses configuration files to manage webhooks and messages:
- Webhook settings:
config\webhooks.php - Message settings:
config\messages.php
The main execution flow is handled in index.php:
- Create appropriate payload
- Create webhook profile
- Create message object
- Send the message if all objects are successfully created
- Configure Discord webhook in your server
- Set up webhook configuration in
config\webhooks.php - Configure other settings (or use defaults)
- Register webhook in your GitHub repository
- Ensure the payload URL follows the format:
http://example.com/webhook/[webhook-name]
- Multiple webhook support for different repositories and Discord channels
- Customizable notifications for various GitHub events
- Easy setup and configuration
- Flexible message class system with override capabilities
The package uses several interfaces to ensure consistency:
PayloadInterfaceWebhookInterfaceMessageInterface
These interfaces are implemented by the respective classes to maintain a standardized structure throughout the package.
The package uses ResponseHandler to manage and send error messages, ensuring smooth operation and helpful debugging.
The modular design of the package allows for easy extension and customization of payload, webhook, and message classes to suit specific needs.