Skip to content

Commit aed0bf1

Browse files
author
welli7ngton
committed
fix: solve incompatibility problem.
1 parent af6d397 commit aed0bf1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

botcity/core/bot.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,16 +1135,19 @@ def kb_type(self, text: str, interval: int = 0) -> None:
11351135
self.sleep(interval)
11361136
self.sleep(config.DEFAULT_SLEEP_AFTER_ACTION)
11371137

1138-
def paste(self, text: Optional[str] = None) -> None:
1138+
def paste(self, text: Optional[str] = None, wait: int = 0) -> None:
11391139
"""
11401140
Paste content from the clipboard.
11411141
11421142
Args:
11431143
text (str, optional): The text to be pasted. Defaults to None
1144+
wait (int, optional): Wait interval (ms) after task
11441145
"""
11451146
if text:
11461147
pyperclip.copy(text)
11471148
self.control_v()
1149+
delay = max(0, wait or config.DEFAULT_SLEEP_AFTER_ACTION)
1150+
self.sleep(delay)
11481151

11491152
def copy_to_clipboard(self, text: str, wait: int = 0) -> None:
11501153
"""
@@ -1198,7 +1201,7 @@ def key_right(self, wait: int = 0) -> None:
11981201
delay = max(0, wait or config.DEFAULT_SLEEP_AFTER_ACTION)
11991202
self.sleep(delay)
12001203

1201-
def key_enter(self, wait: int = 0) -> None:
1204+
def key_enter(self, wait: int = 0):
12021205
"""
12031206
Press key Enter
12041207
@@ -1348,7 +1351,7 @@ def type_keys_with_interval(self, interval: int, keys: List) -> None:
13481351
self._kb_controller.release(key)
13491352
self.sleep(interval)
13501353

1351-
def type_keys(self, keys: List) -> None:
1354+
def type_keys(self, keys: List):
13521355
"""
13531356
Press a sequence of keys. Hold the keys in the specific order and releases them.
13541357
@@ -1433,7 +1436,7 @@ def control_c(self, wait: int = 0) -> str:
14331436
self.control_key(key_to_press="c", wait=wait)
14341437
return self.get_clipboard()
14351438

1436-
def control_v(self, wait=0):
1439+
def control_v(self, wait=0) -> None:
14371440
"""
14381441
Press keys CTRL+V
14391442
@@ -1545,7 +1548,7 @@ def control_end(self, wait: int = 0) -> None:
15451548

15461549
def control_home(self, wait: int = 0) -> None:
15471550
"""
1548-
press keys ctrl+home
1551+
press keys CTRL+home
15491552
15501553
args:
15511554
wait (int, optional): wait interval (ms) after task

0 commit comments

Comments
 (0)