Class: Findbug::Alerts::Channels::Discord
- Defined in:
- lib/findbug/alerts/channels/discord.rb
Overview
Discord sends alerts via Discord webhooks.
CONFIGURATION
config.alerts do |alerts|
alerts.discord(
enabled: true,
webhook_url: ENV["DISCORD_WEBHOOK_URL"],
username: "Findbug", # optional
avatar_url: "https://..." # optional
)
end
SETTING UP DISCORD WEBHOOK
-
Go to your Discord server settings
-
Navigate to Integrations > Webhooks
-
Create a new webhook
-
Copy the webhook URL
Discord webhooks are similar to Slack but use a different payload format.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Findbug::Alerts::Channels::Base
Instance Method Details
#send_alert(error_event) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/findbug/alerts/channels/discord.rb', line 35 def send_alert(error_event) webhook_url = config[:webhook_url] return if webhook_url.blank? payload = build_payload(error_event) post_to_webhook(webhook_url, payload) end |