mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add providers
This commit is contained in:
parent
e228f04345
commit
b15477ca4c
@ -6,6 +6,22 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class WebhookHandler:
|
class WebhookHandler:
|
||||||
|
@staticmethod
|
||||||
|
def get_providers():
|
||||||
|
return [
|
||||||
|
"Discord",
|
||||||
|
"Home Assistant",
|
||||||
|
"Mattermost",
|
||||||
|
"Opsgenie",
|
||||||
|
"Signal",
|
||||||
|
"Slack",
|
||||||
|
"SMTP",
|
||||||
|
"Splunk",
|
||||||
|
"Teams",
|
||||||
|
"Telegram",
|
||||||
|
"Custom",
|
||||||
|
]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def send_discord_webhook(title, message, color):
|
def send_discord_webhook(title, message, color):
|
||||||
dataset = {
|
dataset = {
|
||||||
@ -23,7 +39,7 @@ class WebhookHandler:
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
"Webhook response: "
|
"Webhook response: "
|
||||||
+ requests.post(
|
+ requests.post(
|
||||||
"https://discord.com/api/webhooks/1107017140004995081/leFCJ4g_Uw6ZwxaZXTLmi-L7njIFwVvFbf3JEHnAvUJAd90PoMknlivel0rosfnFed77",
|
"",
|
||||||
data=json.dumps(dataset),
|
data=json.dumps(dataset),
|
||||||
headers={"Content-type": "application/json"},
|
headers={"Content-type": "application/json"},
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user