From 50769543a29838f09276f65672f6fded189b6fd2 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 1 Sep 2023 06:56:41 +0800 Subject: fixed "return None" error --- __pycache__/main.cpython-311.pyc | Bin 1945 -> 2299 bytes main.py | 13 ++++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc index 4744830..bde0bc7 100644 Binary files a/__pycache__/main.cpython-311.pyc and b/__pycache__/main.cpython-311.pyc differ diff --git a/main.py b/main.py index c00ca97..fd7f2bc 100644 --- a/main.py +++ b/main.py @@ -12,9 +12,9 @@ url = f'https://discord.com/api/v9/channels/{channel_id}/messages' # Set the headers with the bot token for authentication headers = {'Authorization': f'Bot {token}'} -old_message = "" +old_id = "" def main(): - global old_message + global old_id global url # Make the API request to fetch messages from the channel response = get(url, headers=headers) @@ -35,16 +35,19 @@ def main(): cmd = "webfile " + str(files) except: pass - if message['id'] != old_message: + if message['id'] != old_id: try: - old_message = message['id'] + old_id = message['id'] + while cmd == None: + main() return cmd except: pass else: sleep(1) else: - return f'Error: {response.status_code} - {response.text}' + return f'Error: {response.status_code}' # response.text + if __name__ == "__main__": cache = None -- cgit v1.2.3