mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-09-01 16:48:26 +00:00
Implement automatic creation of config.ini from example file
- Added logic to the `install-service.sh` script to automatically create a `config.ini` file from `config.ini.example` if it does not exist in the installation directory. - Included warnings for users if the example file is not found, ensuring proper configuration setup before starting the bot. - Refactored joke command configuration in `core.py` to maintain consistency and clarity in the configuration structure.
This commit is contained in:
@@ -405,6 +405,19 @@ copy_files_smart "$SCRIPT_DIR" "$INSTALL_DIR" || {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# If no config.ini in install dir, create it from config.ini.example
|
||||
if [ ! -f "$INSTALL_DIR/config.ini" ]; then
|
||||
if [ -f "$INSTALL_DIR/config.ini.example" ]; then
|
||||
cp "$INSTALL_DIR/config.ini.example" "$INSTALL_DIR/config.ini"
|
||||
print_success "Created $INSTALL_DIR/config.ini from config.ini.example (no config was present)"
|
||||
elif [ -f "$SCRIPT_DIR/config.ini.example" ]; then
|
||||
cp "$SCRIPT_DIR/config.ini.example" "$INSTALL_DIR/config.ini"
|
||||
print_success "Created $INSTALL_DIR/config.ini from config.ini.example (no config was present)"
|
||||
else
|
||||
print_warning "config.ini.example not found. Create $INSTALL_DIR/config.ini manually before starting the bot."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create venv and install dependencies before chown so the service user ends up
|
||||
# owning a complete, working venv (avoids partial root-owned venv and import errors).
|
||||
print_section "Step 4: Setting Up Python Virtual Environment"
|
||||
|
||||
+24
-23
@@ -518,29 +518,6 @@ startup_advert = false
|
||||
# false: Manual mode - no automatic actions, use !repeater commands to manage contacts (default)
|
||||
auto_manage_contacts = false
|
||||
|
||||
[Joke_Command]
|
||||
# Enable or disable the joke command (true/false)
|
||||
enabled = true
|
||||
|
||||
# Enable seasonal joke defaults (October: spooky, December: Christmas)
|
||||
# true: Seasonal defaults are applied (default)
|
||||
# false: No seasonal defaults (always random)
|
||||
seasonal_jokes = true
|
||||
|
||||
# Handle long jokes (over 130 characters)
|
||||
# false: Fetch new jokes until we get a short one (default)
|
||||
# true: Split long jokes into multiple messages
|
||||
long_jokes = false
|
||||
|
||||
[DadJoke_Command]
|
||||
# Enable or disable the dad joke command (true/false)
|
||||
enabled = true
|
||||
|
||||
# Handle long jokes (over 130 characters)
|
||||
# false: Fetch new jokes until we get a short one (default)
|
||||
# true: Split long jokes into multiple messages
|
||||
long_jokes = false
|
||||
|
||||
[Admin_ACL]
|
||||
# Admin Access Control List (ACL) for restricted commands
|
||||
# Only users with public keys listed here can execute admin commands
|
||||
@@ -760,6 +737,30 @@ url_timeout = 10
|
||||
# true: Use 24-hour UTC format
|
||||
# false: Use 12-hour local format
|
||||
use_zulu_time = false
|
||||
|
||||
[Joke_Command]
|
||||
# Enable or disable the joke command (true/false)
|
||||
enabled = true
|
||||
|
||||
# Enable seasonal joke defaults (October: spooky, December: Christmas)
|
||||
# true: Seasonal defaults are applied (default)
|
||||
# false: No seasonal defaults (always random)
|
||||
seasonal_jokes = true
|
||||
|
||||
# Handle long jokes (over 130 characters)
|
||||
# false: Fetch new jokes until we get a short one (default)
|
||||
# true: Split long jokes into multiple messages
|
||||
long_jokes = false
|
||||
|
||||
[DadJoke_Command]
|
||||
# Enable or disable the dad joke command (true/false)
|
||||
enabled = true
|
||||
|
||||
# Handle long jokes (over 130 characters)
|
||||
# false: Fetch new jokes until we get a short one (default)
|
||||
# true: Split long jokes into multiple messages
|
||||
long_jokes = false
|
||||
|
||||
"""
|
||||
with open(self.config_file, 'w') as f:
|
||||
f.write(default_config)
|
||||
|
||||
Reference in New Issue
Block a user