An open API service indexing awesome lists of open source software.

https://github.com/dismob/github

A dismob plugin to create an endpoint for github webhooks and display custom messages on Discord
https://github.com/dismob/github

bot discord discord-bot discord-py dismob modular modularity module modules plugin plugins python python-3 python3 webhook webhooks

Last synced: 10 months ago
JSON representation

A dismob plugin to create an endpoint for github webhooks and display custom messages on Discord

Awesome Lists containing this project

README

          

# Github Webhook Endpoint

This is a [dismob](https://github.com/dismob/dismob) plugin which creates an endpoint server to receive github webhooks.

You can then configure how you want the bot using the added slash commands to post messages in your discord server when webhooks are received.

## Installation

> [!IMPORTANT]
> You need to have an already setup [dismob](https://github.com/dismob/dismob) bot. Follow the instruction there to do it first.

Just download/clone (or add as submodule) this repo into your dismob's `plugins` folder.
The path **must** be `YourBot/plugins/github/main.py` at the end.

The default port of the endpoint is `8080`, but you can configure it by defining `WEBHOOK_PORT` in your `.env` file.
You can also define the webhook secret by setting the `WEBHOOK_SECRET` value in your `.env` file.

Something like that:

```txt
WEBHOOK_PORT="5555"
WEBHOOK_SECRET="your webhook secret"
```

Once your bot is up and live, run those commands on your discord server:

```
!modules load github
!sync
```

> [!NOTE]
> Replace the prefix `!` by your own bot prefix when doing those commands!

Then you can reload your discord client with `Ctrl+R` to see the new slash commands.

## Commands

Command | Description
--- | ---
`/github set-webhook-settings [params ...]` | Create or update settings for a specific webhook event. If no parameters are passed, display the current settings for the event.
`/github enable-webhook-event ` | Enable or disable a specific webhook event

You can use any data sent by the webhook in your title and messages.
For example, a `release.published` event will have some data about the release and its repo.
For example, `release[html_url]` will holds the link to the github release, and `release[name]` will holds the name of the github release.

An example command:

```
/github set-webhook-settings event:release.published title:{release[name]} message:New release! :tada: \nGet it [here]({release[html_url]})
```