Add relaying to discord
This commit is contained in:
parent
c08a264717
commit
4b41a107b0
25
stdin2discord.py
Normal file
25
stdin2discord.py
Normal file
@ -0,0 +1,25 @@
|
||||
import sys
|
||||
import requests
|
||||
|
||||
def send(_msg: str):
|
||||
if len(_msg) == 0:
|
||||
return
|
||||
|
||||
r = requests.post(
|
||||
url='https://discord.com/api/webhooks/936927833572380692/QrqoK8aVCOkGFh1L0HaHPd_Z-Usj-ubhXYvHadZyCA1Y5GOB7-0xWmuyKI9l4byvKjQ1',
|
||||
data=f'content={requests.utils.quote(_msg)}'.encode('utf-8'),
|
||||
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
msg = ''
|
||||
|
||||
for line in sys.stdin:
|
||||
if len(msg + line) >= 2000:
|
||||
send(msg)
|
||||
msg = ''
|
||||
|
||||
else:
|
||||
msg += line
|
||||
|
||||
send(msg)
|
@ -11,6 +11,7 @@ if [ $http_response != "200" ]; then
|
||||
|
||||
else
|
||||
git diff "list.csv"
|
||||
git diff "list.csv" | python3 stdin2discord.py
|
||||
git add "list.csv"
|
||||
git commit -m "commit" | grep -vE 'On branch master|nothing to commit, working tree clean'
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user