Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed-althaf-h committed Dec 15, 2020
1 parent 84931f2 commit 32b874e
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions discord_webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from discord_webhooks import DiscordWebhooks

#Put your discord webhook url here.

webhook_url = ''


def send_msg(class_name,status,start_time,end_time):

WEBHOOK_URL = webhook_url

mah = DiscordWebhooks(WEBHOOK_URL)
# Attaches a footer
mah.set_footer(text='✍ Mohammed Althaf H ✌')

if(status=="joined"):

mah.set_content(title='Class Joined Succesfully',
description="Here's your report with :heart:")

# Appends a field
mah.add_field(name='Class', value=class_name)
mah.add_field(name='Status', value=status)

mah.add_field(name='Joined at', value=start_time)
mah.add_field(name='Leaving at', value=end_time)

elif(status=="left"):
mah.set_content(title='Class left Succesfully',
description="Here's your report with :heart:")

# Appends a field
mah.add_field(name='Class', value=class_name)
mah.add_field(name='Status', value=status)

mah.add_field(name='Joined at', value=start_time)
mah.add_field(name='Left at', value=end_time)


elif(status=="noclass"):
mah.set_content(title='Seems like no class today',
description="No join button found! Assuming no class.")

# Appends a field
mah.add_field(name='Class', value=class_name)
mah.add_field(name='Status', value=status)

mah.add_field(name='Expected Join time', value=status)
mah.add_field(name='Expected Leave time', value=end_time)

mah.send()

print("Sent message to discord")

0 comments on commit 32b874e

Please sign in to comment.