rework config to be more flexible, and comment more
idk about stuff.py's changes
This commit is contained in:
parent
f722589c3e
commit
1808fa74f0
|
@ -1,5 +1,8 @@
|
||||||
venv
|
venv
|
||||||
pass.txt
|
pass.txt
|
||||||
|
local_config.py
|
||||||
|
log.txt
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
56
config.py
56
config.py
|
@ -1,9 +1,19 @@
|
||||||
class config:
|
# default config file, copy the contents into local_config.py and modify
|
||||||
|
if __name__ == "local_config":
|
||||||
|
from config import config
|
||||||
|
else:
|
||||||
|
|
||||||
|
class config: # dummy, so the local config can simply be a copy of this template
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class config(config):
|
||||||
class self:
|
class self:
|
||||||
nick = "bot6"
|
nick = "bot6"
|
||||||
username = "jan6_bot" # you can set it to your username
|
username = "jan6_bot"
|
||||||
|
# you should probably indicate yourself to be the owner of the bot, in username, or realname, or both
|
||||||
realname = "jan6's bot"
|
realname = "jan6's bot"
|
||||||
source = "https://tildegit.org/jan6/bot6"
|
source = "https://tildegit.org/jan6/bot6" # so far only used for ctcp response, perhaps we're running a fork?
|
||||||
|
|
||||||
class server:
|
class server:
|
||||||
name = "libera"
|
name = "libera"
|
||||||
|
@ -13,28 +23,40 @@ class config:
|
||||||
nickserv_auth = True
|
nickserv_auth = True
|
||||||
# get password from secret file
|
# get password from secret file
|
||||||
nickserv_pass = open("pass.txt", "r").read().strip()
|
nickserv_pass = open("pass.txt", "r").read().strip()
|
||||||
nickserv_recover = "RECOVER" #might be GHOST sometimes?
|
nickserv_recover = "RECOVER" # I recall it being GHOST on some networks?
|
||||||
channel = "##jan6"
|
channel = "#bots"
|
||||||
autojoin = ["##share", "#1337331"]
|
autojoin = ["#some-other", "##channels"]
|
||||||
|
|
||||||
class admin:
|
class admin:
|
||||||
accounts = ["jan6"]
|
# ircv3 account-tag based admin
|
||||||
hostmasks = ["jan6!jan6@mischievous.deity","jan6!~jan6@mischievous.deity"]
|
accounts = ["jan6", "totally-not-jan6"]
|
||||||
|
# hostmask-based admin, if at all possible, you should try to use a vhost or reverse dns, to prevent fakery
|
||||||
|
hostmasks = ["jan6!jan6@mischievous.deity", "jan6!~jan6@mischievous.deity"]
|
||||||
|
|
||||||
class cmd:
|
class cmd:
|
||||||
|
# right now, single-character prefixes only (plus bot's own nick)
|
||||||
prefixes = ["6", "'"]
|
prefixes = ["6", "'"]
|
||||||
# disabled commands, won't run via normal means, probably
|
# disabled commands, won't run via normal means...probably
|
||||||
disabled = []
|
disabled = []
|
||||||
# admin-only override,
|
# admin-only override,
|
||||||
# useful for testing broken commands which should still be normal-user accessible
|
# useful for testing broken commands which should still be normal-user accessible
|
||||||
|
# commands which should only ever be used by admins, should be designated as such in code, not through here (e.g. exit)
|
||||||
admin_only = []
|
admin_only = []
|
||||||
|
|
||||||
capabilities = [
|
capabilities = [ # what capabilities shall we request?
|
||||||
"message-tags",
|
"message-tags", # needed for account-tag!
|
||||||
"multi-prefix",
|
"account-tag", # account tag allows us to identify people without needing custom login!
|
||||||
"account-tag",
|
"multi-prefix", # perhaps eventually useful for detecting people's status, such as +v AND +o ?
|
||||||
"batch",
|
"batch", # we wouldn't want to trigger on historic message playback (only usage of it I've seen)
|
||||||
"account-notify",
|
"away-notify", # no functionality deals with away status yet
|
||||||
"chghost",
|
"account-notify", # I don't remember why I try requesting this lol
|
||||||
"away-notify",
|
"chghost", # uh, same, forgot
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# you can remove the following lines if you're editing local_config.py
|
||||||
|
if __name__ == "config":
|
||||||
|
try:
|
||||||
|
from local_config import config
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
print("\x1b[31m!!! you should probably set up local config !!!\x1b[0m")
|
||||||
|
|
5
stuff.py
5
stuff.py
|
@ -93,9 +93,10 @@ def stuff(bot, sock):
|
||||||
|
|
||||||
for line in recv_lines:
|
for line in recv_lines:
|
||||||
try:
|
try:
|
||||||
server.parse_tokens(line)
|
server.parse_tokens(line)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("\x1b[31;1mNGIRCD SUCKS\x1b[0m ",line)
|
print("\x1b[31;1mNGIRCD SUCKS\x1b[0m ", line)
|
||||||
|
continue
|
||||||
stri = line.format()
|
stri = line.format()
|
||||||
for k, v in util.dict.items():
|
for k, v in util.dict.items():
|
||||||
stri = stri.replace(k, v)
|
stri = stri.replace(k, v)
|
||||||
|
|
Loading…
Reference in New Issue