5 Commits

Author SHA1 Message Date
adator
61813e38ae Merge pull request #11 from adator85/dev
convert version string to int
2024-08-03 20:25:37 +02:00
adator
743069f8e0 convert version string to int 2024-08-03 20:24:58 +02:00
adator
de69a1af63 Merge pull request #10 from adator85/dev
Move checkversion command to admin commands
2024-08-03 20:13:03 +02:00
adator
c8c5f782d7 Move checkversion command to admin commands 2024-08-03 20:12:19 +02:00
adator
a639964701 Merge pull request #9 from adator85/dev
Dev
2024-08-03 19:22:30 +02:00
3 changed files with 28 additions and 26 deletions

View File

@@ -77,32 +77,34 @@ class Base:
self.logs.warning(f'Github not available to fetch latest version')
def check_for_new_version(self) -> bool:
try:
# Assigner la version actuelle de Defender
self.__set_current_defender_version()
# Récuperer la dernier version disponible dans github
self.__get_latest_defender_version()
# Assigner la version actuelle de Defender
self.__set_current_defender_version()
# Récuperer la dernier version disponible dans github
self.__get_latest_defender_version()
isNewVersion = False
latest_version = self.LATEST_DEFENDER_VERSION
current_version = self.DEFENDER_VERSION
curr_major, curr_minor, curr_patch = current_version.split('.')
last_major, last_minor, last_patch = latest_version.split('.')
if last_major > curr_major:
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
elif last_major == curr_major and last_minor > curr_minor:
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
elif last_major == curr_major and last_minor == curr_minor and last_patch > curr_patch:
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
else:
isNewVersion = False
latest_version = self.LATEST_DEFENDER_VERSION
current_version = self.DEFENDER_VERSION
return isNewVersion
curr_major , curr_minor, curr_patch = current_version.split('.')
last_major, last_minor, last_patch = latest_version.split('.')
if int(last_major) > int(curr_major):
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
elif int(last_major) == int(curr_major) and int(last_minor) > int(curr_minor):
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
elif int(last_major) == int(curr_major) and int(last_minor) == int(curr_minor) and int(last_patch) > int(curr_patch):
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
else:
isNewVersion = False
return isNewVersion
except ValueError as ve:
self.logs.error(f'Impossible to convert in version number : {ve}')
def get_unixtime(self) -> int:
"""

View File

@@ -28,8 +28,8 @@ class Irc:
# Liste des commandes internes du bot
self.commands_level = {
0: ['help', 'auth', 'copyright','checkversion'],
1: ['load','reload','unload', 'deauth', 'uptime'],
0: ['help', 'auth', 'copyright'],
1: ['load','reload','unload', 'deauth', 'uptime', 'checkversion'],
2: ['show_modules', 'show_timers', 'show_threads', 'sentinel'],
3: ['quit', 'restart','addaccess','editaccess', 'delaccess']
}

View File

@@ -1,3 +1,3 @@
{
"version": "4.0.0"
"version": "4.0.2"
}