-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
main.py
96 lines (90 loc) · 4.71 KB
/
main.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# copyright 2020-22 @Mohamed Rizad
# Telegram @riz4d
# Instagram @riz.4d
from pyrogram import *
import requests as re
from Config import *
from pyrogram.types import InlineKeyboardButton,InlineKeyboardMarkup
import wget
import os
buttons=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('Generate', callback_data='generate'),
InlineKeyboardButton('Refresh', callback_data='refresh'),
InlineKeyboardButton('Close', callback_data='close')
]
])
msg_buttons=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('View message', callback_data='view_msg'),
InlineKeyboardButton('Close', callback_data='close')
]
])
app=Client('Temp-Mail Bot',
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN)
email=''
@app.on_message(filters.command('start'))
async def start_msg(client,message):
await message.reply("**Hey "+message.from_user.first_name+" !!**\n @mysterymailbot is a free service that allows to generates and receive emails at a temporary address that self-destructed after a certain time elapses.\n\n**__ How It Safe's You??**__\n- Using the temporary mail allows you to completely protect your real mailbox against the loss of personal information. Your temporary e-mail address is completely anonymous. Your details: information about your person and users with whom you communicate, IP-address, e-mail address are protected and completely confidential.\n\nFurther Queris @riz4d🌚")
await message.reply("**Generate a Email Now❕**",
reply_markup=buttons)
@app.on_callback_query()
async def mailbox(client,message):
response=message.data
if response=='generate':
global email
email = re.get("https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1").json()[0]
await message.edit_message_text('__**Your Temporary E-mail: **__`'+str(email)+'`',
reply_markup=buttons)
print(email)
elif response=='refresh':
print(email)
try:
if email=='':
await message.edit_message_text('Genaerate a email',reply_markup=buttons)
else:
getmsg_endp = "https://www.1secmail.com/api/v1/?action=getMessages&login=" + email[:email.find("@")] + "&domain=" + email[email.find("@") + 1:]
print(getmsg_endp)
ref_response = re.get(getmsg_endp).json()
global idnum
idnum=str(ref_response[0]['id'])
from_msg=ref_response[0]['from']
subject=ref_response[0]['subject']
refreshrply='You a message from '+from_msg+'\n\nSubject : '+subject
await message.edit_message_text(refreshrply,
reply_markup=msg_buttons)
except:
await message.answer('No messages were received..\nin your Mailbox '+email)
elif response=='view_msg':
msg =re.get("https://www.1secmail.com/api/v1/?action=readMessage&login=" + email[:email.find("@")] + "&domain=" + email[email.find("@") + 1:] + "&id=" + idnum).json()
print(msg)
from_mail=msg['from']
date=msg['date']
subjectt=msg['subject']
try:
attachments=msg['attachments'][0]
except:
pass
body=msg['body']
mailbox_view='ID No : '+idnum+'\nFrom : '+from_mail+'\nDate : '+date+'\nSubject : '+subjectt+'\nmessage : \n'+body
await message.edit_message_text(mailbox_view,reply_markup=buttons)
mailbox_view='ID No : '+idnum+'\nFrom : '+from_mail+'\nDate : '+date+'\nSubject : '+subjectt+'\nmessage : \n'+body
if attachments == "[]":
await message.edit_message_text(mailbox_view,reply_markup=buttons)
await message.answer("No Messages Were Recieved..", show_alert=True)
else:
dlattach=attachments['filename']
attc="https://www.1secmail.com/api/v1/?action=download&login=" + email[:email.find("@")] + "&domain=" + email[email.find("@") + 1:] + "&id=" + idnum+"&file="+dlattach
print(attc)
mailbox_vieww='ID No : '+idnum+'\nFrom : '+from_mail+'\nDate : '+date+'\nSubject : '+subjectt+'\nmessage : \n'+body+'\n\n'+'[Download]('+attc+') Attachments'
filedl=wget.download(attc)
await message.edit_message_text(mailbox_vieww,reply_markup=buttons)
os.remove(dlattach)
elif response=='close':
await message.edit_message_text('Session Closed✅')
app.run()
# Stay tuned for more : Instagram[@riz.4d]