From fb01696636001bfc1df2ec81030ad815732ce2c7 Mon Sep 17 00:00:00 2001 From: jan6 Date: Sun, 7 Nov 2021 12:38:04 +0200 Subject: [PATCH] added autojoin list option --- config.py | 21 +++++++++++---------- stuff.py | 10 +++++++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/config.py b/config.py index 8937baa..9885b20 100644 --- a/config.py +++ b/config.py @@ -11,16 +11,7 @@ class config: port = 6697 ssl = True channel = "##jan6" - - capabilities = [ - "message-tags", - "multi-prefix", - "account-tag", - "batch", - "account-notify", - "chghost", - "away-notify", - ] + autojoin = ["##sharing"] class admin: accounts = ["jan6"] @@ -33,3 +24,13 @@ class config: # admin-only override, # useful for testing broken commands which should still be normal-user accessible admin_only = [] + + capabilities = [ + "message-tags", + "multi-prefix", + "account-tag", + "batch", + "account-notify", + "chghost", + "away-notify", + ] diff --git a/stuff.py b/stuff.py index f74fd8c..40e92d3 100755 --- a/stuff.py +++ b/stuff.py @@ -17,7 +17,8 @@ def stuff(bot, sock): # mesg=util.mesg server_caps = [] wanted_caps = config.capabilities - chan = config.server.channel # autojoin channel + chan = config.server.channel # main channel + autojoin_done=False is_pm = False mode = "init" @@ -87,6 +88,13 @@ def stuff(bot, sock): elif mode == "boot": send(irctokens.build("JOIN", [chan]).format()) mode = "normal" + elif mode == "normal" and autojoin_done==False: + try: + for channel in config.server.autojoin: + send("JOIN "+channel) + time.sleep(0.25) + except Exception: True + autojoin_done=True elif mode == "normal": if line.command == "433": mesg("nick in use!", chan)