Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/mod/python.mod/scripts/check_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2025 Michael Ortmann MIT License
# Copyright (C) 2025 Eggheads Development Team
# We use ruff as a code formatter to keep the code style consistent (and to
# avoid off-topic discussions)
import eggdrop
from eggdrop.tcl import putlog
import json
import threading
import urllib.request

current_version = eggdrop.tcl.set("version")
index1 = current_version.find(" ")
index2 = current_version.find("+")
current_version = (
f"v{current_version[: index1 if index2 < 0 or index2 > index1 else index2]}"
)


def check_version():
with urllib.request.urlopen(
"https://api.github.com/repos/eggheads/eggdrop/releases/latest"
) as fp:
latest_version = json.load(fp)["tag_name"]
if current_version != latest_version:
putlog(
f"Version check: eggdrop update found: latest {latest_version} current {current_version}"
)
threading.Timer(24 * 60 * 60, check_version).start() # 24h


check_version()
print("Loaded check_version.py")
Loading