-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathqr.py
More file actions
19 lines (18 loc) · 812 Bytes
/
qr.py
File metadata and controls
19 lines (18 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pyrogram import Client, filters
from command import fox_command, fox_sudo, who_message
import os
@Client.on_message(fox_command("qr", "QRcode", os.path.basename(__file__), "[text]") & fox_sudo())
async def qr(client, message):
message = await who_message(client, message)
try:
texts = ""
if message.reply_to_message:
texts = message.reply_to_message.text
elif len(message.text.split(maxsplit=1)) == 2:
texts = message.text.split(maxsplit=1)[1]
text = texts.replace(' ', '%20')
QRcode = f"https://api.qrserver.com/v1/create-qr-code/?size=300x300&data={text}"
await message.delete()
await client.send_photo(message.chat.id, QRcode)
except Exception as e:
await message.edit(f'Error: {e}')