Add version check in utils folder

This commit is contained in:
Simon authored and Callum Leslie committed 2022-08-09 18:15:21 +00:00
1 parent 21ef6a17d1
commit 0050655499
1 file changed
+11
+11
View File
@@ -0,0 +1,11 @@
import requests
from utils.console import print_step
def checkversion(__VERSION__):
response = requests.get("https://api.github.com/repos/elebumm/RedditVideoMakerBot/releases/latest")
latestversion = (response.json()["tag_name"])
if __VERSION__ == latestversion:
print_step(f"You are using the newest version ({__VERSION__}) of the bot")
return True
else:
print_step(f"You are using an older version ({__VERSION__}) of the bot. Download the newest version ({latestversion}) from https://github.com/elebumm/RedditVideoMakerBot/releases/latest")