Discord Webhooks
CocoLottery can send lottery events to Discord using webhooks. Configure them in plugins/CocoLottery/webhook.yml.
Supported Events
| Event | Description |
|---|---|
| buy | Player purchases tickets |
| add | Admin adds tickets to player |
| remove | Admin removes tickets from player |
| reset | Lottery is reset |
| draw | Lottery winner announced |
| preDraw | Pre-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
| Placeholder | Description |
|---|---|
| %player% | Player name |
| %amount% | Ticket amount |
| %winner% | Lottery winner |
| %prize% | Prize amount |
| %time% | Time until draw (seconds) |
Setup Guide
- Go to your Discord server settings
- Navigate to Integrations → Webhooks
- Click New Webhook
- Copy the webhook URL
- Paste the URL in
webhook.ymlfor each event - Reload the plugin:
/lottery reload