Gather nick and room
This commit is contained in:
15
xbotlib.py
15
xbotlib.py
@ -49,18 +49,21 @@ class Bot(ClientXMPP):
|
|||||||
|
|
||||||
def generate_config(self):
|
def generate_config(self):
|
||||||
"""Generate bot configuration."""
|
"""Generate bot configuration."""
|
||||||
jid = (
|
jid = input("XMPP address (e.g. foo@bar.com): ") or "foo@bar.com"
|
||||||
input("XMPP address of your bot (e.g. alice@myserver.com): ")
|
|
||||||
or "alice@myserver.com"
|
|
||||||
)
|
|
||||||
password = (
|
password = (
|
||||||
getpass("Password for the bot account (e.g. my-cool-password): ")
|
getpass("Password (e.g. my-cool-password): ") or "my-cool-password"
|
||||||
or "my-cool-password"
|
|
||||||
)
|
)
|
||||||
|
room = input("XMPP room (e.g. foo@bar.com): ")
|
||||||
|
nick = input("Nickname (e.g. lurkbot): ")
|
||||||
|
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config["bot"] = {"jid": jid, "password": password}
|
config["bot"] = {"jid": jid, "password": password}
|
||||||
|
|
||||||
|
if room:
|
||||||
|
config["bot"]["room"] = room
|
||||||
|
if nick:
|
||||||
|
config["bot"]["nick"] = nick
|
||||||
|
|
||||||
with open("bot.conf", "w") as file_handle:
|
with open("bot.conf", "w") as file_handle:
|
||||||
config.write(file_handle)
|
config.write(file_handle)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user