-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenewURL.py
More file actions
26 lines (20 loc) · 873 Bytes
/
renewURL.py
File metadata and controls
26 lines (20 loc) · 873 Bytes
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
import discord
from discord.ext import commands
import nginxURLGen
import os, binascii
printerName = ["hades", "kraken", "poseidon"]
passwd = ["hacklab!", "Hacklab!", "hacklab!"]
ip = ["216", "217", "218"]
bot = commands.Bot(command_prefix='.')
@bot.event
async def on_ready():
i = 0
sizeofList = len(printerName)
embedVar = discord.Embed(title="Hyvää huomenta!", description="Octoprint links had been renewed.", color=0x00ff00)
while i < sizeofList:
token = binascii.b2a_hex(os.urandom(15)).decode("utf-8")
nginxURLGen.createConf(printerName[i], token, ip[i]);
embedVar.add_field(name=printerName[i].title(), value=f"Use `hacklab`:`{passwd[i]}` to access: https://{printerName[i]}.dynamic.hacklabmikkeli.fi/{token}", inline=False)
i += 1
await channel.send(embed=embedVar)
await bot.logout()