argparse: add --no-connect option to disable autoconnect rules in configuration files
This commit is contained in:
parent
f575674d47
commit
22a2ba76c4
2
bot.py
2
bot.py
@ -326,7 +326,7 @@ class Bot(threading.Thread):
|
|||||||
|
|
||||||
if srv.id not in self.servers:
|
if srv.id not in self.servers:
|
||||||
self.servers[srv.id] = srv
|
self.servers[srv.id] = srv
|
||||||
if autoconnect:
|
if autoconnect and not hasattr(self, "noautoconnect"):
|
||||||
srv.open()
|
srv.open()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ if __name__ == "__main__":
|
|||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument("-a", "--no-connect", action="store_true",
|
||||||
|
help="disable auto-connect to servers at startup")
|
||||||
|
|
||||||
parser.add_argument("-v", "--verbose", action="count",
|
parser.add_argument("-v", "--verbose", action="count",
|
||||||
default=0,
|
default=0,
|
||||||
help="verbosity level")
|
help="verbosity level")
|
||||||
@ -87,6 +90,9 @@ if __name__ == "__main__":
|
|||||||
context = bot.Bot(modules_paths=modules_paths, data_path=args.data_path,
|
context = bot.Bot(modules_paths=modules_paths, data_path=args.data_path,
|
||||||
verbosity=args.verbose)
|
verbosity=args.verbose)
|
||||||
|
|
||||||
|
if args.no_connect:
|
||||||
|
context.noautoconnect = True
|
||||||
|
|
||||||
# Load the prompt
|
# Load the prompt
|
||||||
prmpt = prompt.Prompt()
|
prmpt = prompt.Prompt()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user