-
Notifications
You must be signed in to change notification settings - Fork 0
/
c_discord_webhook.py
77 lines (60 loc) · 3.24 KB
/
c_discord_webhook.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from discord_webhooks import DiscordWebhooks
from discord_webhook import DiscordWebhook, DiscordEmbed
# Put your discord webhook url here.
WEBHOOK_URL = 'https://discord.com/api/webhooks/786428735548031006/2wM2kjk-lHVciULTSQCNdaXgpPnt49MMnMGVun92JbfgNYekUM1_luvCAi8ICct_Xdfc'
def send_msg2(ign, class_name, status, start_time, end_time):
webhook = DiscordWebhooks(WEBHOOK_URL)
# Attaches a footer
webhook.set_footer(text='-- Teams Auto Attender')
webhook.add_field(name='IGN', value=ign)
webhook.add_field(name='Class', value=str(class_name))
webhook.add_field(name='Status', value=str(status))
if status == "Joined":
webhook.set_content(title='Class Joined Succesfully',
description="Here's your report with :heart:")
# Appends a field
webhook.add_field(name='Joined at', value=start_time)
webhook.add_field(name='Leaving at', value=end_time)
elif status == "Left":
webhook.set_content(title='Class Left Succesfully',
description="Here's your report with :heart:")
# Appends a field
webhook.add_field(name='Joined at', value=start_time)
webhook.add_field(name='Left at', value=end_time)
elif status == "Failed":
webhook.set_content(title='One step closer to debar',
description="Failed to join class!!!You're absolutely fucked")
# Appends a field
webhook.add_field(name='Expected Join time', value=start_time)
webhook.add_field(name='Expected Leave time', value=end_time)
else:
webhook.set_content(title='Status Code Diagnostic',
description="Actual Status Code")
webhook.add_field(name='Join Time', value=start_time)
webhook.add_field(name='Expected Leave Time', value=end_time)
webhook.send()
def send_msg(ign, class_name, status, start_time, end_time):
webhook = DiscordWebhook(url=WEBHOOK_URL)
if status == 'Joined':
embed = DiscordEmbed(title='Class Joined Succesfully', description="Here's your report with :heart:",
color='03b2f8')
elif status == 'Failed':
embed = DiscordEmbed(title='One step closer to debar',
description="Failed to join class!!!You're absolutely fucked",
color='03b2f8')
elif status == 'Left':
embed = DiscordEmbed(title='Class Left Succesfully', description="Here's your report with :heart:",
color='03b2f8')
else:
embed = DiscordEmbed(title='Status Code Diagnostic', description="Actual Status Code",
color='03b2f8')
embed.set_footer(text='-- Teams Auto Attender')
embed.set_timestamp()
embed.add_embed_field(name='IGN', value=ign)
embed.add_embed_field(name='Class', value=str(class_name))
embed.add_embed_field(name='Status', value=str(status))
embed.add_embed_field(name='Joining Time', value=start_time)
embed.add_embed_field(name='Leaving Time', value=end_time)
webhook.add_embed(embed)
response = webhook.execute()
# send_msg2('Apvaadak', 'Test Class', 'Left', '09:10', '10:10')