21 lines
672 B
Python
21 lines
672 B
Python
from discord_webhook import DiscordWebhook
|
|
import subprocess
|
|
|
|
webhookURL = "https://discordapp.com/api/webhooks/719690867811811348/8LExCQbqOPP0XAdNcbV8JHrVYupOSYmeLwkBJWCDCe72JoPyc4Yy_R2wzbkKSN33MPAn"
|
|
|
|
out = subprocess.Popen(['echo messages | bconsole'],
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT,
|
|
shell=True)
|
|
|
|
stdout,stderr = out.communicate()
|
|
print(stdout)
|
|
print(stderr)
|
|
cleaned_stdout = b"```" + stdout.partition(b"\nmessages\n")[2] + b"```"
|
|
|
|
if (cleaned_stdout != b'```You have no messages.\n```'):
|
|
webhook = DiscordWebhook(url=webhookURL, content=cleaned_stdout)
|
|
response = webhook.execute()
|
|
else:
|
|
print("Done.")
|