UEWBot / dipvis

Django-based visualiser for tournaments for the boardgame Diplomacy
GNU General Public License v3.0
7 stars 5 forks source link

Post board calls to discord #213

Closed UEWBot closed 1 year ago

UEWBot commented 2 years ago

We'd need to be able to add a webhook to a Tournament, and we'd need whatever has to happen behind the scenes to actually do the posting

UEWBot commented 1 year ago

Looks like the code to post to a webhook is quite simple:

from discord import SyncWebhook

webhook = SyncWebhook.from_url("url-here")
webhook.send("Hello World")
UEWBot commented 1 year ago

We may not even need to use the discord library. Webhooks are just a POST to a URL, according to https://hookdeck.com/webhooks/platforms/how-to-get-started-with-discord-webhooks#conclusion So we’d just need to add a new webhook URL attribute to Tournament and make a call to post to that URL at the same place we send email board call notifications