-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
190 lines (123 loc) · 5.9 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
from time import sleep
from pynput.keyboard import Key, Controller
import discord
keyboard = Controller()
client = discord.Client()
TOKEN = "TYPE YOUR TOKEN HERE"#--------------------------------------------------------------------------------------
client.user = input("What is the name of the person that is using the bot (without tag and spaces) ")
client.usersname = "======[ ", client.user , "'s Adventure ]======"
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
username = str(message.author)
user_message = str(message.content)
channel = str(message.channel.name)
if message.author == client.user:
return
if username == "DiscordRPG#0366":
#!adv
if message.channel.name == "discord-rpg-1": #discord rpg deciding heal or pheal or adv
print(user_message)
if user_message[3] == "d":
if user_message.split("!")[1] == client.usersname:
client.pethp = ""
client.petmaxhp = ""
client.index1 = 0
client.index2 = 0
client.playermaxhp = ""
client.playerhp = ""
#pet max hp
client.index1 = user_message.index("HP left")
client.index2= user_message.index("/")
for i in range(client.index2 + 1, client.index1):
if user_message[i] != ",":
client.petmaxhp = client.petmaxhp + user_message[i]
#pet max hp
#-----------------------------------
#pethp
client.index1 = user_message.index("/")
client.index2 = user_message.index("+ Pet Rock has ")
for i in range(client.index2 + 15, client.index1):
if user_message[i] != ",":
client.pethp = client.pethp + user_message[i]
#pethp
#---------------------------------------------------------------------------------------------
#playermaxhp
client.index1 = user_message.index("HP left.")
client.index2 = user_message.index("/",user_message.index("/")+2)
for i in range(client.index2 + 1, client.index1):
if user_message[i] != ",":
client.playermaxhp = client.playermaxhp + user_message[i]
#playermaxhp
# -----------------------------------
#playerhp
client.index1 = user_message.index("/", user_message.index("/") + 2)
client.index2 = user_message.index("o has ") +6
for i in range(client.index2, client.index1):
if user_message[i] != ",":#!adv
client.playerhp = client.playerhp + user_message[i]
#playerhp
await message.channel.send(f"{client.playerhp} = playerhp")
await message.channel.send(f"{client.playermaxhp} = playermaxhp")
await message.channel.send(f"{client.pethp} = pethp")
await message.channel.send(f"{client.petmaxhp} = petmaxhp")
print(user_message)
sleep(15)
if int(client.pethp) <= int(client.petmaxhp)/2: #pheal
sleep(7)
keyboard.press("#")
keyboard.release("#")
keyboard.press("!")
keyboard.release("!")
keyboard.press("p")
keyboard.release("p")
keyboard.press("h")
keyboard.release("h")
keyboard.press("e")
keyboard.release("e")
keyboard.press("a")
keyboard.release("a")
keyboard.press("l")
keyboard.release("l")
keyboard.press(" ")
keyboard.release(" ")
keyboard.press("5")
keyboard.release("5")
keyboard.press(Key.enter)
keyboard.release(Key.enter)
if int(client.playerhp) <= int(client.playermaxhp)/2:
sleep(7)
keyboard.press("#")
keyboard.release("#")
keyboard.press("!")
keyboard.release("!")
keyboard.press("h")
keyboard.release("h")
keyboard.press("e")
keyboard.release("e")
keyboard.press("a")
keyboard.release("a")
#!adv
keyboard.press("l")
keyboard.release("l")
keyboard.press(" ")
keyboard.release(" ")
keyboard.press("5")#!forage
keyboard.release("5")
keyboard.press(Key.enter)
keyboard.release(Key.enter)
keyboard.press("#")
keyboard.release("#")
keyboard.press("!")
keyboard.release("!")
keyboard.press("a")
keyboard.release("a")
keyboard.press("d")
keyboard.release("d")
keyboard.press("v")
keyboard.release("v")
keyboard.press(Key.enter)
keyboard.release(Key.enter)
client.run(TOKEN)