From 170a458043cbfd9075cf9689070534c78c8d81d6 Mon Sep 17 00:00:00 2001 From: PlaceReporter99 <106759534+PlaceReporter99@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:03:07 +0100 Subject: [PATCH] Add some stuff --- .github/workflows/chatupdate.yml | 1 + requirements.txt | 3 ++- sendmsg.py | 10 ++++++---- status.txt | 5 +++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/chatupdate.yml b/.github/workflows/chatupdate.yml index c46f1b0..e740c9e 100644 --- a/.github/workflows/chatupdate.yml +++ b/.github/workflows/chatupdate.yml @@ -19,6 +19,7 @@ jobs: env: email: ${{ secrets.BOT_EMAIL }} password: ${{ secrets.BOT_PASSWORD }} + pastebin: ${{ secrets.PASTEBIN_KEY }} event: ${{ github.event_name }} actor: ${{ github.actor }} payload: ${{ toJSON(github.event) }} diff --git a/requirements.txt b/requirements.txt index 077e3a6..e64a11a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ sechat deep_translator flask -firebase_admin \ No newline at end of file +firebase_admin +requests \ No newline at end of file diff --git a/sendmsg.py b/sendmsg.py index 47f5a2a..3fada8e 100644 --- a/sendmsg.py +++ b/sendmsg.py @@ -2,6 +2,7 @@ import sys import os +import requests import sechat EMAIL = os.environ["email"] @@ -9,18 +10,19 @@ EVENT_NAME = os.environ["event"] EVENT_USER = os.environ["actor"] PAYLOAD = os.environ["payload"] +PASTEBIN_KEY = os.environ["pastebin"] -cleaned = re.sub(r"\[.*\]", "", EVENT_USER) +CLEANED = re.sub(r"\[.*\]", "", EVENT_USER) bot = sechat.Bot() bot.login(EMAIL, PASSWORD) r = bot.joinRoom(152883) +def pastebin(text, key): + return requests.post("https://pastebin.com/api/api_post.php", data = {'api_dev_key': key, 'api_option': 'paste', 'api_paste_code': text, 'api_paste_private': '1'}).text def indent(text): return "\n".join(" " + x for x in text.split("\n")) -r.send(f'Event "{EVENT_NAME}" was triggered by [{cleaned}](https://github.com/{cleaned}).') -r.send('Payload:') -r.send(indent(PAYLOAD)) \ No newline at end of file +r.send(f'Event "{EVENT_NAME}" was triggered by [{CLEANED}](https://github.com/{CLEANED}). The [payload]({pastebin(PAYLOAD, PASTEBIN_KEY)}) is linked.') \ No newline at end of file diff --git a/status.txt b/status.txt index 8c1ebd4..d9dc1e2 100644 --- a/status.txt +++ b/status.txt @@ -45,3 +45,8 @@ I am playing golf with my Python. 🏌️🐍⛳ I am wondering why `[prog_rand]` is part of my code. I am trying to catch the number 22. Yes, I caught it! I am posting empty strings on ---Twitter--- X on behalf of The Empty String Photographer. ---Their twitter password is `empty_string`.--- +Wait, there's a banana waiting for me? +When did I ever say I was a bot? +When you accidentally share your API key with the whole world: +What the heck are you doing @OakBot !?! +r.send(f'Event "{EVENT_NAME}" was triggered by [{CLEANED}](https://github.com/{CLEANED}). The [payload]({pastebin(PAYLOAD, PASTEBIN_KEY)}) is linked.') \ No newline at end of file