forked from pawan-59/test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
26 lines (21 loc) · 720 Bytes
/
test.py
File metadata and controls
26 lines (21 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import json
import os
import requests
from discord_webhook import DiscordWebhook, DiscordEmbed
webhook = DiscordWebhook(url=os.environ["webhook_url"], username="Devtron")
r = requests.get('https://api.github.com/repos/%s/releases/latest'%os.environ["repo"])
output=json.loads(r.text)
release_name= output["name"]
tag_name= output["tag_name"]
tag_url= output["html_url"]
body=output["body"]
embed = DiscordEmbed(
title="New Release",description="**"+"[%s](%s)"%(tag_name,tag_url)+"**\n\n"+body, color='03b2f8'
)
embed.set_author(
name="Devtron",
url="https://devtron.ai/",
icon_url="https://avatars.githubusercontent.com/u/60952665?s=200&v=4",
)
webhook.add_embed(embed)
response = webhook.execute()