Skip to content

Commit 08173ac

Browse files
committed
lib: Don't use "--force_sync_on_startup" if not needed
1 parent a7ece3f commit 08173ac

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ python3 -m discordbotlinuxmonitor --help
8181
# Use "--nodebug" to not show any warning information during command
8282

8383
# 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
8585

8686
# 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
8888
```
8989
- Go to discord (restart discord if you were already in it)
9090
- 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
138138
After=network.target
139139
140140
[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
142142
WorkingDirectory=$DISCORD_BOT_FOLDER
143143
User=$DISCORD_BOT_SERVICE_USER
144144
Group=$DISCORD_BOT_SERVICE_GROUP

discordbotlinuxmonitor/__main__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def main() -> None:
1111

1212
# Define available arguments
1313
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)')
1515

1616
parser.add_argument('--debug', action='store_true', help='Enable debug mode')
1717
parser.add_argument('--nodebug', action='store_true', help='Disable all logs')
@@ -35,12 +35,10 @@ def main() -> None:
3535
sys.exit(1)
3636
config_file: str = args.config_file
3737

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
4442

4543
# Prepare the Discord bot (will throw an exception if the configuration is invalid)
4644
discord_bot_linux_monitor = DiscordBotLinuxMonitor(config_file=config_file, force_sync_on_startup=force_sync_on_startup)

0 commit comments

Comments
 (0)