TowerDiscord
View SourceError reporting to Discord.
A simple post-to-Discord reporter for Tower error handler that sends formatted error messages to a Discord channel via webhooks.
Installation
The package can be installed by adding tower_discord
to your list of dependencies in mix.exs
:
def deps do
[
{:tower_discord, "~> 0.1.0"}
]
end
Usage
Register the reporter with Tower:
# config/config.exs
config :tower, :reporters, [
# along with any other possible reporters
TowerDiscord
]
Add the Discord-specific configurations:
# config/runtime.exs
config :tower_discord,
webhook_url: System.get_env("TOWER_DISCORD_WEBHOOK_URL"),
level: :error # Optional, defaults to :error
Discord Webhook Setup
- In your Discord server, go to Server Settings -> Integrations
- Click on "Create Webhook"
- Choose the channel where you want the error reports to appear
- Copy the Webhook URL and use it in your configuration
The reporter will format error messages with:
- Error type and source location
- Exception details
- Stacktrace information
- Hashtags for easy filtering (#towerreport #tower_type[kind])
Configuration Options
Option | Required | Description | Default |
---|---|---|---|
webhook_url | Yes | Discord webhook URL for message delivery | - |
level | No | Minimum level for reported events | :error |
License
Copyright 2024 Your Name/Organization
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.