forked from Firepup650/FireBot
Compare commits
No commits in common. "d3a824dc24b0e9046012218a6f05bf84510e8351" and "913e2d7de888782d1f845447fd663c6c567cd544" have entirely different histories.
d3a824dc24
...
913e2d7de8
3 changed files with 5 additions and 12 deletions
2
bot.py
2
bot.py
|
@ -272,7 +272,7 @@ class bot(bare.bot):
|
|||
tdict = {}
|
||||
for thread in self.threads:
|
||||
tdict[thread] = timers.data[thread]
|
||||
if tdict[thread]["passInstance"]:
|
||||
if thread in ["radio"]:
|
||||
tdict[thread]["args"] = [self]
|
||||
tMgr = Thread(target=timers.threadManager, args=(tdict,))
|
||||
tMgr.daemon = True
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Optional, Any
|
|||
import bare, pylast
|
||||
|
||||
load_dotenv()
|
||||
__version__ = "v3.0.7-dev"
|
||||
__version__ = "v3.0.6"
|
||||
npbase: str = (
|
||||
"\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence]
|
||||
)
|
||||
|
|
13
timers.py
13
timers.py
|
@ -17,7 +17,7 @@ def is_dead(thr: Thread) -> bool:
|
|||
def threadWrapper(data: dict) -> NoReturn:
|
||||
if not data["noWrap"]:
|
||||
while 1:
|
||||
if data["ignoreErrors"]:
|
||||
if ignoreErrors:
|
||||
try:
|
||||
data["func"](*data["args"])
|
||||
except Exception:
|
||||
|
@ -112,18 +112,11 @@ def radio(instance: bare.bot) -> NoReturn:
|
|||
instance.log("Thread while loop broken", "FATAL")
|
||||
exit(1)
|
||||
|
||||
|
||||
def mcDown(instance: bare.bot) -> None:
|
||||
instance.sendraw("TOPIC #firemc :FireMC Relay channel (offline)")
|
||||
|
||||
|
||||
data: dict[str, dict[str, Any]] = {
|
||||
"radio": {"noWrap": True, "func": radio, "passInstance": True},
|
||||
"mc-down": {
|
||||
"noWrap": False,
|
||||
"func": mcDown,
|
||||
"passInstance": True,
|
||||
"interval": 60,
|
||||
"ignoreErrors": True,
|
||||
},
|
||||
"radio": {"noWrap": True, "func": radio, "args": []},
|
||||
"mc-down": {"noWrap": False, "func": mcDown, "args": [], "interval": 60}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue