Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ninjaclasher/django-discord-integration

Discord integration for Django, supporting error reporting via webhooks.
https://github.com/ninjaclasher/django-discord-integration

discord django error-reporting

Last synced: 19 days ago
JSON representation

Discord integration for Django, supporting error reporting via webhooks.

Awesome Lists containing this project

README

        

# Django Discord Integration

Discord integration for Django, supporting error reporting via webhooks.

This app comes with two message handlers: `DiscordMessageHandler` and `SimpleDiscordMessageHandler`. `DiscordMessageHandler` sends all the information related to the message, such as a traceback if there is one, while the `SimpleDiscordMessageHandler` only sends the title.

## Installation
```bash
$ pip install django-discord-integration
```

In your `settings.py`, add the following:
```python
INSTALLED_APPS = (
'discord_integration',
...
)
```

Next, migrate the database:
```
$ python manage.py migrate
```

Finally, create a Discord integration object in the Django admin site. Set the Discord webhook URL as well as the bot username and avatar URL if necessary. You can create multiple objects to direct different logs to different channels. The default object should the name `default`.

## Sample Logging Configuration

```python
LOGGING = {
'handlers': {
'discord_integration': {
'level': 'ERROR',
'class': 'discord_integration.log.DiscordMessageHandler',
'model_name': 'default', # OPTIONAL: specify a name to use a different integration configuration.
},
},
'loggers': {
'handlers': ['discord_integration'],
},
}
```