From c0ec0d141ed2c8948541bcee80f2f474d7c6aa64 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Mon, 21 Jun 2021 20:59:14 -0400 Subject: [PATCH 1/2] Move all onboard software to dedicated dir --- crawler_software/{ => raspberry_pi}/config/hardware.yaml | 0 .../raspberry_pi/requirements.txt | 0 crawler_software/{ => raspberry_pi}/servo_test.py | 0 crawler_software/{ => raspberry_pi}/sstv.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename crawler_software/{ => raspberry_pi}/config/hardware.yaml (100%) rename requirements.txt => crawler_software/raspberry_pi/requirements.txt (100%) rename crawler_software/{ => raspberry_pi}/servo_test.py (100%) rename crawler_software/{ => raspberry_pi}/sstv.py (100%) diff --git a/crawler_software/config/hardware.yaml b/crawler_software/raspberry_pi/config/hardware.yaml similarity index 100% rename from crawler_software/config/hardware.yaml rename to crawler_software/raspberry_pi/config/hardware.yaml diff --git a/requirements.txt b/crawler_software/raspberry_pi/requirements.txt similarity index 100% rename from requirements.txt rename to crawler_software/raspberry_pi/requirements.txt diff --git a/crawler_software/servo_test.py b/crawler_software/raspberry_pi/servo_test.py similarity index 100% rename from crawler_software/servo_test.py rename to crawler_software/raspberry_pi/servo_test.py diff --git a/crawler_software/sstv.py b/crawler_software/raspberry_pi/sstv.py similarity index 100% rename from crawler_software/sstv.py rename to crawler_software/raspberry_pi/sstv.py From f9a47e8891a3bf836ce9efa8442cbdb13c81792f Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Mon, 21 Jun 2021 21:02:11 -0400 Subject: [PATCH 2/2] Add basic bot, this should get changed --- companion_software/BasicBot.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 companion_software/BasicBot.py diff --git a/companion_software/BasicBot.py b/companion_software/BasicBot.py new file mode 100644 index 0000000..d06675a --- /dev/null +++ b/companion_software/BasicBot.py @@ -0,0 +1,23 @@ +from discord_webhook import DiscordWebhook +from picamera import PiCamera +from time import sleep + + +def get_uptime(): + with open('/proc/uptime', 'r') as f: + uptime_seconds = float(f.readline().split()[0]) + + return uptime_seconds + +webhookURL = "https://discord.com/api/webhooks/856609966404534272/TR9tnLq2sIGZoOeADNswmGRNlzBcqM5aKihfU6snVTP9WhSSoVVvi7nT6i-ZfZS7Hcqm" + +webhook = DiscordWebhook(url=webhookURL, content="Uptime: " + str( round( ((get_uptime() / 60) / 60 ), 2 )) + " hours") + +camera = PiCamera() +sleep(3) # let iso settle out +camera.capture('still.jpg') + +with open("still.jpg", "rb") as f: + webhook.add_file(file=f.read(), filename='still.jpg') +response = webhook.execute() # Hit send +