-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqrcode_handler.py
More file actions
59 lines (48 loc) · 2.59 KB
/
qrcode_handler.py
File metadata and controls
59 lines (48 loc) · 2.59 KB
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
import time
import discord
from discord.ext import commands
async def qrcode(ctx: commands.Context, self):
bot = commands.AutoShardedBot(commands.when_mentioned_or('!!'), intents=discord.Intents.all())
def __init__(self, bot):
self.bot = bot
await ctx.author.create_dm()
await ctx.author.dm_channel.send('Du willst also einen QR-Code? Dann brauch ich als erstes einen Link. Schreib mir einfach den Link in die DMs und ich erstelle dir einen QR-Code :)')
def check(message: discord.Message):
return message.channel == ctx.channel and message.author != ctx.me
message = await self.bot.wait_for('ctx', check=check)
print(message)
if message.startswith("https://"):
print(msg.content)
await ctx.author.dm_channel.send('Okay, ich erstelle dir jetzt einen QR-Code für ' + msg.content + ' :)')
time.sleep(3)
await ctx.author.dm_channel.send('Hier ist dein QR-Code :)')
await ctx.author.dm_channel.send('https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=' + msg.content)
#await ctx.author.dm_channel.send('Willst du noch einen QR-Code? Dann schreib mir einfach "y" (Du hast 60 Sekunden Zeit ⏱ ) :)')
#msg2 = self.bot.wait_for('y', timeout=60, check=check)
# try:
# if msg2.content == 'y':
# await qrcode(ctx, self)
# except asyncio.exceptions.TimeoutError:
# await ctx.author.dm_channel.send(
# 'Du hast zu lange gebraucht. Schreibe den Befehl wieder, wenn du noch einen Code erstellen willst :)')
# return
# else:
# try:
# 'https://' + ctx.content
# await message.author.dm_channel.send('Okay, ich erstelle dir jetzt einen QR-Code für ' + msg.content + ' :)')
# time.sleep(3)
# await ctx.author.dm_channel.send('Hier ist dein QR-Code :)')
# await ctx.author.dm_channel.send('https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=' + ctx.content)
#
# except:
# await ctx.author.dm_channel.send('Das ist kein Link. Versuche es nochmal :)')
# await qrcode(message , bot)
#
# await ctx.author.dm_channel.send('Willst du noch einen QR-Code? Dann schreib mir einfach "y" (Du hast 60 Sekunden Zeit ⏱ ) :)')
# msg = self.bot.wait_for('y', timeout=60, check=check)
# try:
# if msg.content == 'y':
# await qrcode(ctx, bot)
# except asyncio.exceptions.TimeoutError:
# await ctx.author.dm_channel.send('Du hast zu lange gebraucht. Schreibe den Befehl wieder, wenn du noch einen Code erstellen willst :)')
# return