summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-09-01 06:56:41 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-09-01 06:56:41 +0800
commit50769543a29838f09276f65672f6fded189b6fd2 (patch)
treee1384be8de28db1dcd2db3a269c3990487b4e8c3 /main.py
parent51292dc7e6db6e99691a8df0240154020cfa6b4a (diff)
fixed "return None" error
Diffstat (limited to 'main.py')
-rw-r--r--main.py13
1 files changed, 8 insertions, 5 deletions
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