-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84931f2
commit 32b874e
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |