summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--__pycache__/main.cpython-311.pycbin1945 -> 2299 bytes
-rw-r--r--main.py13
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
--- a/__pycache__/main.cpython-311.pyc
+++ b/__pycache__/main.cpython-311.pyc
Binary files 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