Skip to content
Open
Show file tree
Hide file tree
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
14 changes: 13 additions & 1 deletion GramAddict/core/bot_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,20 @@ def start_bot(**kwargs):

if len(configs.enabled) < 1:
logger.error(
"You have to specify one of these actions: " + ", ".join(configs.actions)
"No actions found! You need to specify at least one action in your config file or command line."
)
logger.error("Available actions: " + ", ".join(sorted(configs.actions)))
logger.info("")
logger.info("Common examples:")
logger.info(" - feed: 2-5 # Like 2-5 posts from your feed")
logger.info(" - blogger-followers: [user1] # Interact with user1's followers")
logger.info(" - unfollow: 10-20 # Unfollow 10-20 users")
logger.info("")
logger.info("To fix this:")
logger.info(" 1. Open your config file and uncomment at least one action (remove the # symbol)")
logger.info(" 2. Or add an action via command line, e.g.: python run.py --config config.yml --feed 5")
logger.info("")
logger.info("For more details, see: https://docs.gramaddict.org/#/configuration")
return
device = create_device(configs.device_id, configs.app_id)
session_state = None
Expand Down
26 changes: 19 additions & 7 deletions GramAddict/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,27 @@ def _is_legacy_arg(arg):
and not _is_legacy_arg(item)
):
self.enabled.append(item)
# Also check sys.argv for command-line arguments that may override config
for item in sys.argv:
if item.startswith("--"):
nitem = item[2:]
if (
nitem in self.actions
and getattr(self.args, nitem.replace("-", "_")) is not None
and not _is_legacy_arg(nitem)
and nitem not in self.enabled
):
self.enabled.append(nitem)
else:
for item in sys.argv:
nitem = item[2:]
if (
nitem in self.actions
and getattr(self.args, nitem.replace("-", "_")) is not None
and not _is_legacy_arg(nitem)
):
self.enabled.append(nitem)
if item.startswith("--"):
nitem = item[2:]
if (
nitem in self.actions
and getattr(self.args, nitem.replace("-", "_")) is not None
and not _is_legacy_arg(nitem)
):
self.enabled.append(nitem)


def get_time_last_save(file_path) -> str:
Expand Down