forked from sch/Slixfeed
Fix configuration
This commit is contained in:
parent
2f6b86522f
commit
8dcff0b2fe
3 changed files with 15 additions and 15 deletions
|
@ -237,16 +237,16 @@ def main():
|
|||
# Try configuration file
|
||||
values = get_value(
|
||||
"accounts", "XMPP Client", [
|
||||
"alias", "username", "password", "hostname", "port"])
|
||||
"alias", "jid", "password", "hostname", "port"])
|
||||
alias = values[0]
|
||||
username = values[1]
|
||||
jid = values[1]
|
||||
password = values[2]
|
||||
hostname = values[3]
|
||||
port = values[4]
|
||||
|
||||
# Use arguments if were given
|
||||
if args.jid:
|
||||
username = args.jid
|
||||
jid = args.jid
|
||||
if args.password:
|
||||
password = args.password
|
||||
if args.alias:
|
||||
|
@ -257,8 +257,8 @@ def main():
|
|||
port = args.port
|
||||
|
||||
# Prompt for credentials if none were given
|
||||
if not username:
|
||||
username = input("Username: ")
|
||||
if not jid:
|
||||
jid = input("JID: ")
|
||||
if not password:
|
||||
password = getpass("Password: ")
|
||||
if not alias:
|
||||
|
@ -266,9 +266,9 @@ def main():
|
|||
|
||||
match xmpp_type:
|
||||
case "client":
|
||||
JabberClient(username, password, alias)
|
||||
JabberClient(jid, password, alias)
|
||||
case "component":
|
||||
JabberComponent(username, password, hostname, port, alias)
|
||||
JabberComponent(jid, password, hostname, port, alias)
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
# and also from which accounts it receives instructions.
|
||||
|
||||
[XMPP]
|
||||
# JID of bot master
|
||||
operator =
|
||||
reconnect_timeout = 30
|
||||
type = client
|
||||
#type = component
|
||||
|
||||
[XMPP Client]
|
||||
alias = Slixfeed
|
||||
username =
|
||||
jid =
|
||||
password =
|
||||
# Hostname (also address) may be an i2p or onion hostname
|
||||
hostname =
|
||||
|
@ -17,22 +19,20 @@ port =
|
|||
|
||||
[XMPP Component]
|
||||
alias = Slixfeed
|
||||
username =
|
||||
jid =
|
||||
password =
|
||||
hostname =
|
||||
port =
|
||||
|
||||
[XMPP Profile]
|
||||
name = Slixfeed
|
||||
alias = Slixfeed
|
||||
nickname = Slixfeed
|
||||
role = Syndication News Bot
|
||||
organization = RSS Task Force
|
||||
url = https://gitgud.io/sjehuda/slixfeed
|
||||
description = XMPP news bot (supports Atom, JSON, RDF and RSS).
|
||||
note = This is a syndication news bot powered by Slixfeed.
|
||||
birthday = 21 June 2022
|
||||
# JID of bot master
|
||||
operator =
|
||||
|
||||
[XMPP Proxy]
|
||||
# NOTE You might want to consider support for socks4 too (this
|
||||
|
|
|
@ -202,7 +202,7 @@ async def message(self, message):
|
|||
response = None
|
||||
match message_lowercase:
|
||||
# case "breakpoint":
|
||||
# if jid == get_value("accounts", "XMPP Profile", "operator"):
|
||||
# if jid == get_value("accounts", "XMPP", "operator"):
|
||||
# breakpoint()
|
||||
# print("task_manager[jid]")
|
||||
# print(task_manager[jid])
|
||||
|
@ -372,7 +372,7 @@ async def message(self, message):
|
|||
send_reply_message(self, message, response)
|
||||
case _ if message_lowercase.startswith("bookmark -"):
|
||||
if jid == get_value(
|
||||
"accounts", "XMPP Profile", "operator"):
|
||||
"accounts", "XMPP", "operator"):
|
||||
muc_jid = message_text[11:]
|
||||
await bookmark.remove(self, muc_jid)
|
||||
response = (
|
||||
|
@ -386,7 +386,7 @@ async def message(self, message):
|
|||
send_reply_message(self, message, response)
|
||||
case "bookmarks":
|
||||
if jid == get_value(
|
||||
"accounts", "XMPP Profile", "operator"):
|
||||
"accounts", "XMPP", "operator"):
|
||||
response = await action.list_bookmarks(self)
|
||||
else:
|
||||
response = (
|
||||
|
|
Loading…
Reference in a new issue