DiscordBotLinuxMonitor 1.0.2__tar.gz → 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DiscordBotLinuxMonitor
3
- Version: 1.0.2
3
+ Version: 1.1.1
4
4
  Summary: From discord channels: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
- Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
5
+ Home-page: https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
7
7
  Author-email: quentin@comte-gaz.com
8
8
  License: MIT
@@ -110,10 +110,10 @@ python3 -m discordbotlinuxmonitor --help
110
110
  # Use "--nodebug" to not show any warning information during command
111
111
 
112
112
  # Start the discord bot Linux monitor (First time)
113
- python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup True --debug
113
+ python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup --debug
114
114
 
115
115
  # Start the discord bot Linux monitor (after first time)
116
- python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup False
116
+ python3 -m discordbotlinuxmonitor --config_file config-example.json
117
117
  ```
118
118
  - Go to discord (restart discord if you were already in it)
119
119
  - You should see welcome messages on channels you configured in the config file and be able to communicate with the bot using command defined in previous section
@@ -167,7 +167,7 @@ Description=Discord Bot Linux Monitor Service
167
167
  After=network.target
168
168
 
169
169
  [Service]
170
- ExecStart=/home/$DISCORD_BOT_SERVICE_USER/venv/bin/python3 -m discordbotlinuxmonitor --config_file ${DISCORD_BOT_FOLDER}config.json --force_sync_on_startup False
170
+ ExecStart=/home/$DISCORD_BOT_SERVICE_USER/venv/bin/python3 -m discordbotlinuxmonitor --config_file ${DISCORD_BOT_FOLDER}config.json
171
171
  WorkingDirectory=$DISCORD_BOT_FOLDER
172
172
  User=$DISCORD_BOT_SERVICE_USER
173
173
  Group=$DISCORD_BOT_SERVICE_GROUP
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DiscordBotLinuxMonitor
3
- Version: 1.0.2
3
+ Version: 1.1.1
4
4
  Summary: From discord channels: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
- Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
5
+ Home-page: https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
7
7
  Author-email: quentin@comte-gaz.com
8
8
  License: MIT
@@ -110,10 +110,10 @@ python3 -m discordbotlinuxmonitor --help
110
110
  # Use "--nodebug" to not show any warning information during command
111
111
 
112
112
  # Start the discord bot Linux monitor (First time)
113
- python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup True --debug
113
+ python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup --debug
114
114
 
115
115
  # Start the discord bot Linux monitor (after first time)
116
- python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup False
116
+ python3 -m discordbotlinuxmonitor --config_file config-example.json
117
117
  ```
118
118
  - Go to discord (restart discord if you were already in it)
119
119
  - You should see welcome messages on channels you configured in the config file and be able to communicate with the bot using command defined in previous section
@@ -167,7 +167,7 @@ Description=Discord Bot Linux Monitor Service
167
167
  After=network.target
168
168
 
169
169
  [Service]
170
- ExecStart=/home/$DISCORD_BOT_SERVICE_USER/venv/bin/python3 -m discordbotlinuxmonitor --config_file ${DISCORD_BOT_FOLDER}config.json --force_sync_on_startup False
170
+ ExecStart=/home/$DISCORD_BOT_SERVICE_USER/venv/bin/python3 -m discordbotlinuxmonitor --config_file ${DISCORD_BOT_FOLDER}config.json
171
171
  WorkingDirectory=$DISCORD_BOT_FOLDER
172
172
  User=$DISCORD_BOT_SERVICE_USER
173
173
  Group=$DISCORD_BOT_SERVICE_GROUP
@@ -81,10 +81,10 @@ python3 -m discordbotlinuxmonitor --help
81
81
  # Use "--nodebug" to not show any warning information during command
82
82
 
83
83
  # Start the discord bot Linux monitor (First time)
84
- python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup True --debug
84
+ python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup --debug
85
85
 
86
86
  # Start the discord bot Linux monitor (after first time)
87
- python3 -m discordbotlinuxmonitor --config_file config-example.json --force_sync_on_startup False
87
+ python3 -m discordbotlinuxmonitor --config_file config-example.json
88
88
  ```
89
89
  - Go to discord (restart discord if you were already in it)
90
90
  - You should see welcome messages on channels you configured in the config file and be able to communicate with the bot using command defined in previous section
@@ -138,7 +138,7 @@ Description=Discord Bot Linux Monitor Service
138
138
  After=network.target
139
139
 
140
140
  [Service]
141
- ExecStart=/home/$DISCORD_BOT_SERVICE_USER/venv/bin/python3 -m discordbotlinuxmonitor --config_file ${DISCORD_BOT_FOLDER}config.json --force_sync_on_startup False
141
+ ExecStart=/home/$DISCORD_BOT_SERVICE_USER/venv/bin/python3 -m discordbotlinuxmonitor --config_file ${DISCORD_BOT_FOLDER}config.json
142
142
  WorkingDirectory=$DISCORD_BOT_FOLDER
143
143
  User=$DISCORD_BOT_SERVICE_USER
144
144
  Group=$DISCORD_BOT_SERVICE_GROUP
@@ -11,7 +11,7 @@ def main() -> None:
11
11
 
12
12
  # Define available arguments
13
13
  parser.add_argument('--config_file', type=str, required=True, help='Path to the configuration file (must be a JSON file)')
14
- parser.add_argument('--force_sync_on_startup', type=bool, required=True, help='Force discord command synchronization on startup (do it only the first time, because after, you will have a discord command to do it if really needed)')
14
+ parser.add_argument('--force_sync_on_startup', action='store_true', help='Force discord command synchronization on startup (do it only the first time, because after, you will have a discord command to do it if really needed)')
15
15
 
16
16
  parser.add_argument('--debug', action='store_true', help='Enable debug mode')
17
17
  parser.add_argument('--nodebug', action='store_true', help='Disable all logs')
@@ -35,12 +35,10 @@ def main() -> None:
35
35
  sys.exit(1)
36
36
  config_file: str = args.config_file
37
37
 
38
- # Ensure the force_sync_on_startup is provided
39
- if not args.force_sync_on_startup:
40
- print("Error: --force_sync_on_startup is required")
41
- parser.print_help()
42
- sys.exit(1)
43
- force_sync_on_startup: bool = args.force_sync_on_startup
38
+ # Check if force_sync_on_startup is provided
39
+ force_sync_on_startup: bool = False
40
+ if args.force_sync_on_startup:
41
+ force_sync_on_startup = True
44
42
 
45
43
  # Prepare the Discord bot (will throw an exception if the configuration is invalid)
46
44
  discord_bot_linux_monitor = DiscordBotLinuxMonitor(config_file=config_file, force_sync_on_startup=force_sync_on_startup)
@@ -30,7 +30,7 @@ __email__ = "quentin@comte-gaz.com"
30
30
  __license__ = "MIT License"
31
31
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
32
32
  __python_version__ = "3.+"
33
- __version__ = "1.0.2 (2024/09/14)"
33
+ __version__ = "1.1.1 (2024/09/14)"
34
34
  __status__ = "Usable for any Linux project"
35
35
 
36
36
  # pyright: reportMissingTypeStubs=false
@@ -537,7 +537,7 @@ class DiscordBotLinuxMonitor:
537
537
 
538
538
  try:
539
539
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
540
- out_msg: str = self.monitoring.ping_all_websites(is_private=is_private, display_only_if_critical=False)
540
+ out_msg: str = await self.monitoring.ping_all_websites(is_private=is_private, display_only_if_critical=False)
541
541
 
542
542
  # Respond to the user
543
543
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
@@ -579,7 +579,7 @@ class DiscordBotLinuxMonitor:
579
579
  await interaction.response.defer()
580
580
 
581
581
  try:
582
- out_msg: str = self.monitoring.reboot_server()
582
+ out_msg: str = await self.monitoring.reboot_server()
583
583
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
584
584
 
585
585
  except Exception as e:
@@ -598,7 +598,7 @@ class DiscordBotLinuxMonitor:
598
598
 
599
599
  try:
600
600
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
601
- out_msg: str = self.monitoring.check_all_services_status(is_private=is_private)
601
+ out_msg: str = await self.monitoring.check_all_services_status(is_private=is_private)
602
602
 
603
603
  # Respond to the user
604
604
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
@@ -619,7 +619,7 @@ class DiscordBotLinuxMonitor:
619
619
  try:
620
620
  # Restart all services and get the results
621
621
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
622
- out_msg: str = self.monitoring.restart_all_services(is_private=is_private)
622
+ out_msg: str = await self.monitoring.restart_all_services(is_private=is_private)
623
623
 
624
624
  # Respond to the user
625
625
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
@@ -640,7 +640,7 @@ class DiscordBotLinuxMonitor:
640
640
  try:
641
641
  # Redémarrer le service et récupérer le message de sortie
642
642
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
643
- out_msg: str = self.monitoring.restart_service(is_private=is_private, service_name=service_name)
643
+ out_msg: str = await self.monitoring.restart_service(is_private=is_private, service_name=service_name)
644
644
 
645
645
  # Répondre à l'utilisateur
646
646
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
@@ -683,7 +683,7 @@ class DiscordBotLinuxMonitor:
683
683
  try:
684
684
  # Récupérer le statut des ports
685
685
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
686
- out_msg: str = self.monitoring.check_all_ports(restart_if_down=True, is_private=is_private, display_only_if_critical=False)
686
+ out_msg: str = await self.monitoring.check_all_ports(restart_if_down=True, is_private=is_private, display_only_if_critical=False)
687
687
 
688
688
  # Répondre à l'utilisateur
689
689
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
@@ -729,7 +729,7 @@ class DiscordBotLinuxMonitor:
729
729
 
730
730
  try:
731
731
  # Arrêter le processus et récupérer le message de sortie
732
- out_msg: str = self.monitoring.kill_process(pid=pid)
732
+ out_msg: str = await self.monitoring.kill_process(pid=pid)
733
733
 
734
734
  # Répondre à l'utilisateur
735
735
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
@@ -6,11 +6,11 @@ with io.open(file='README.md', mode='r', encoding='utf-8') as readme_file:
6
6
 
7
7
  setup(
8
8
  name="DiscordBotLinuxMonitor",
9
- version="1.0.2",
9
+ version="1.1.1",
10
10
  description="From discord channels: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)",
11
11
  long_description=readme,
12
12
  long_description_content_type="text/markdown",
13
- url='https://github.com/QuentinCG/Linux-Monitor-Python-Library',
13
+ url='https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library',
14
14
  packages=['discordbotlinuxmonitor'],
15
15
  author='Quentin Comte-Gaz',
16
16
  author_email='quentin@comte-gaz.com',