Customizeable limit and token-system.
This commit is contained in:
parent
6abc4c4691
commit
3b73faa794
14
bot.py
14
bot.py
@ -22,21 +22,20 @@ def fill(x1,y1, x2,y2, color):
|
|||||||
pxls.append([x, y, r, g, b])
|
pxls.append([x, y, r, g, b])
|
||||||
return pxls
|
return pxls
|
||||||
|
|
||||||
# draw( fill(...) )
|
# draw( fill(...), limit=500, token="fdsfs" )
|
||||||
def draw(pxls):
|
def draw(pxls, limit=300, token=None):
|
||||||
global server
|
global server
|
||||||
ic(pxls)
|
ic(pxls)
|
||||||
|
|
||||||
push = [] # Push %limit% items
|
push = [] # Push %limit% items
|
||||||
limit = 300
|
|
||||||
while len(pxls) > limit:
|
while len(pxls) > limit:
|
||||||
packs = [] # Merge elements to %limit% size list
|
packs = [] # Merge elements to %limit% size list
|
||||||
for i in range(limit):
|
for i in range(limit):
|
||||||
# Take first element
|
# Take first element
|
||||||
packs.append(pxls[0])
|
packs.append(pxls[0])
|
||||||
pxls.pop(0)
|
pxls.pop(0)
|
||||||
push.append({"main": pack(packs)})
|
push.append({"main": pack(packs), "token": token})
|
||||||
push.append({"main": pack(pxls)}) # Pack last
|
push.append({"main": pack(pxls), "token": token}) # Pack last
|
||||||
|
|
||||||
ic(push)
|
ic(push)
|
||||||
for i in tqdm(push):
|
for i in tqdm(push):
|
||||||
@ -65,7 +64,6 @@ def ccheck(packed):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### EXAMPLE
|
### EXAMPLE
|
||||||
# Draw random square 100x100 on 0,0
|
# Draw random square 100x100 on 0,0
|
||||||
from random import randint as ri
|
from random import randint as ri
|
||||||
@ -83,3 +81,7 @@ from im_convert import *
|
|||||||
image = convert("example.png", [10,0])
|
image = convert("example.png", [10,0])
|
||||||
from remove_back import *
|
from remove_back import *
|
||||||
draw( optimize(image, [255,255,255]) ) # Remove white background and draw
|
draw( optimize(image, [255,255,255]) ) # Remove white background and draw
|
||||||
|
|
||||||
|
# Draw with premium-token, limit 450
|
||||||
|
# Token is fake, >ERROR<
|
||||||
|
draw( fill(758,0, 1123,198, [255,255,255]), limit=450, token="3744138bd462cd8180e4w3534rfdsw4rwert" )
|
||||||
|
Loading…
Reference in New Issue
Block a user