-
Notifications
You must be signed in to change notification settings - Fork 3
/
discordWH.py
21 lines (18 loc) · 912 Bytes
/
discordWH.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from discord_webhook import DiscordWebhook, DiscordEmbed
import os
from dotenv import load_dotenv
from time import sleep
load_dotenv() #Check Environment Variables in .env file
webhook_url= os.getenv('WEBHOOK')
webhook = DiscordWebhook(url=webhook_url) #Discord WebHook URL
def sendMessage(tokens, amount, cauldrons, settings, chain):
amount=int(amount)
amount=(f"{amount:,}")
embed=DiscordEmbed(title=cauldrons[tokens]['title'], url=cauldrons[tokens]['website'], color=settings[chain]['color'])
embed.set_thumbnail(url=cauldrons[tokens]['logo'])
embed.add_embed_field(name="%s Market Replenish" %tokens, value="%s MIMs are available for minting on %s! <:MIM:888155951016857662>" %(amount,settings[chain]['message_name']), inline=False)
embed.set_footer(text=chain)
webhook.add_embed(embed)
response = webhook.execute(remove_embeds=True)
print("discord sent!")
sleep(5)