Pass colored pixels
This commit is contained in:
parent
df06ca94a3
commit
4f5e14e131
27
bot.py
27
bot.py
@ -5,17 +5,27 @@ from tqdm import tqdm
|
|||||||
global xc, yc
|
global xc, yc
|
||||||
xc = 0 ; yc = 0
|
xc = 0 ; yc = 0
|
||||||
|
|
||||||
|
def gcolor(x, y):
|
||||||
|
response = requests.get(f'http://pb.dmcraft.online/?get_color={x},{y}')
|
||||||
|
return response.text
|
||||||
|
|
||||||
def draw(cords, color = "black"):
|
def draw(cords, color = "black"):
|
||||||
global xc, yc
|
global xc, yc
|
||||||
for i in tqdm(range(len(cords))):
|
for i in tqdm(range(len(cords))):
|
||||||
payload = {'x': cords[i][1] + yc, 'y': cords[i][0] + xc, 'color': color }
|
try:
|
||||||
|
color = cords[i][2]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if str(gcolor(cords[i][1], cords[i][0])) != color:
|
||||||
|
payload = {'x': cords[i][1] + yc, 'y': cords[i][0] + xc, 'color': color }
|
||||||
|
|
||||||
response = requests.post('http://pb.dmcraft.online', data=payload)
|
|
||||||
|
|
||||||
while str(response) != "<Response [200]>":
|
|
||||||
response = requests.post('http://pb.dmcraft.online', data=payload)
|
response = requests.post('http://pb.dmcraft.online', data=payload)
|
||||||
print("Error, retrying...")
|
|
||||||
sleep(0.1)
|
while str(response) != "<Response [200]>":
|
||||||
|
response = requests.post('http://pb.dmcraft.online', data=payload)
|
||||||
|
print("Error, retrying...")
|
||||||
|
sleep(0.1)
|
||||||
print("DONE!")
|
print("DONE!")
|
||||||
|
|
||||||
def linex(y, x1, x2):
|
def linex(y, x1, x2):
|
||||||
@ -40,10 +50,9 @@ def fill(xy1, xy2):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#xc = 500
|
print(gcolor(0, 1))
|
||||||
#yc = 500
|
draw([[0,1, "red"]])
|
||||||
|
|
||||||
draw(fill([26,0], [50, 85]),"white")
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
#Russian flag
|
#Russian flag
|
||||||
|
Loading…
Reference in New Issue
Block a user