-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbegging.py
71 lines (54 loc) · 1.81 KB
/
begging.py
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
60
61
62
63
64
65
66
67
68
69
70
71
import time
import keyboard
import random
import chardet
from datetime import datetime
#change these to your Minecraft settings
rank = 'rank'
color = 'rank color'
name = 'username'
delay_start = 7
delay_stop = 20
#dont change these options
loop = True
lastbegtest = ""
stop = False
def pause():
global stop
stop = not stop
print(datetime.now().strftime('%H:%M:%S:%f'), f": Pause is now {stop}")
with open('begs.txt', 'rb') as file:
file_raw = chardet.detect(file.read())
with open('begs.txt', 'r', encoding=file_raw['encoding']) as file:
beg_lines = file.readlines()
print(datetime.now().strftime('%H:%M:%S:%f'),": Waiting for K")
keyboard.wait("k")
keyboard.add_hotkey('b', pause)
while True:
while not stop:
print(datetime.now().strftime('%H:%M:%S:%f'),": Random choice ahead!")
begtext = random.choice(beg_lines)
begtext = begtext.replace('{rank}', rank)
begtext = begtext.replace('{color}', color)
begtext = begtext.replace('{name}', name)
print(begtext)
if lastbegtest == begtext:
nottwice = True
print(datetime.now().strftime('%H:%M:%S:%f'),": It has been twice")
else:
nottwice = False
print(datetime.now().strftime('%H:%M:%S:%f'),": It has not been twice")
lastbegtest = begtext
wait = random.randint(delay_start, delay_stop)
wait = int(wait)
time.sleep(wait)
if stop:
break
if not nottwice:
print(datetime.now().strftime('%H:%M:%S:%f'),": Writing")
print("")
keyboard.press_and_release("t")
time.sleep(0.1)
keyboard.write(begtext)
time.sleep(2)
keyboard.press_and_release("enter")