Skip to main content

Discord Webhooks

CocoLottery can send lottery events to Discord using webhooks. Configure them in plugins/CocoLottery/webhook.yml.

Supported Events

EventDescription
buyPlayer purchases tickets
addAdmin adds tickets to player
removeAdmin removes tickets from player
resetLottery is reset
drawLottery winner announced
preDrawPre-draw countdown notifications

Configuration Examples

Buy Webhook

plugins/CocoLottery/webhook.yml
buy:
url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL"
embed:
title: "🎟️ Ticket Purchase"
description: |
**Purchase Details:**
• Player: `%player%`
• Tickets Purchased: `%amount%`

✅ Thank you for your purchase! Best of luck in the lottery.
color: "#00FF00"
footer: "CocoLottery"
image: ""
thumbnail: ""

Draw Result Webhook

plugins/CocoLottery/webhook.yml
draw:
url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL"
embed:
title: "🏆 Lottery Draw Result"
description: |
**Draw Result:**
• Winner: `%winner%`
• Prize: `%prize%`

🎉 Congratulations to the winner! Thank you for participating.
color: "#FFD700"
footer: "CocoLottery"
image: ""
thumbnail: ""

Reset Webhook

plugins/CocoLottery/webhook.yml
reset:
url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL"
embed:
title: "🔄 Lottery Reset"
description: |
The lottery has been reset to its base state.

🎲 A new round will start shortly.
color: "#FFFF00"
footer: "CocoLottery"
image: ""
thumbnail: ""

Pre-Draw Notifications

Send countdown notifications before the draw:

plugins/CocoLottery/webhook.yml
draw:
# Times (in seconds) to send pre-draw notifications
preDraw:
- 7200 # 2 hours
- 3600 # 1 hour
- 1800 # 30 minutes
- 600 # 10 minutes
- 300 # 5 minutes
- 60 # 1 minute

preDrawEmbed:
url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL"
title: "⏳ Lottery Starting Soon"
description: |
**Pre-Draw Notice:**
Only `%time%` seconds left until the lottery draw begins.

⌛ Get ready for the big moment!
color: "#FFA500"
footer: "CocoLottery - PreDraw"

Available Placeholders

PlaceholderDescription
%player%Player name
%amount%Ticket amount
%winner%Lottery winner
%prize%Prize amount
%time%Time until draw (seconds)

Setup Guide

  1. Go to your Discord server settings
  2. Navigate to IntegrationsWebhooks
  3. Click New Webhook
  4. Copy the webhook URL
  5. Paste the URL in webhook.yml for each event
  6. Reload the plugin: /lottery reload