-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathQRcode.py
More file actions
23 lines (20 loc) · 698 Bytes
/
Copy pathQRcode.py
File metadata and controls
23 lines (20 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import discord, asyncio, qrcode, os, logging
from discord.ext import commands
class QRcode(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['qrcode'])
async def qr(self, ctx, *, data):
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=2,
)
qr.add_data(data)
img = qr.make_image(fill_color="black", back_color="white")
img.save("temp/QR.png")
await ctx.send(f"{ctx.author.mention}", file=discord.File("temp/QR.png"))
os.remove("temp/QR.png")
def setup(bot):
bot.add_cog(QRcode(bot))