Avoid spamming #firemc #6
3 changed files with 12 additions and 5 deletions
2
bot.py
2
bot.py
|
@ -272,7 +272,7 @@ class bot(bare.bot):
|
|||
tdict = {}
|
||||
for thread in self.threads:
|
||||
Firepup650 marked this conversation as resolved
Outdated
9pfs marked this conversation as resolved
Outdated
Firepup650
commented
This needs to be indented another layer This needs to be indented another layer
9pfs marked this conversation as resolved
Outdated
Firepup650
commented
We CANNOT use a tab here, this will crash the bot. It absolutely must be 4 spaces. We CANNOT use a tab here, this will crash the bot. It absolutely must be 4 spaces.
9pfs
commented
Uh, what? I thought that WAS 4 spaces! Uh, what? I thought that WAS 4 spaces!
|
||||
tdict[thread] = timers.data[thread]
|
||||
if thread in ["radio"]:
|
||||
if tdict[thread]["passInstance"]:
|
||||
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.6"
|
||||
__version__ = "v3.0.7-dev"
|
||||
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 ignoreErrors:
|
||||
if data["ignoreErrors"]:
|
||||
try:
|
||||
data["func"](*data["args"])
|
||||
except Exception:
|
||||
|
@ -112,11 +112,18 @@ def radio(instance: bare.bot) -> NoReturn:
|
|||
instance.log("Thread while loop broken", "FATAL")
|
||||
exit(1)
|
||||
|
||||
|
||||
def mcDown(instance: bare.bot) -> None:
|
||||
Firepup650 marked this conversation as resolved
Outdated
Firepup650
commented
`radio` needs to use `"passInstance": True`, not `"args": []`
|
||||
instance.sendraw("TOPIC #firemc :FireMC Relay channel (offline)")
|
||||
|
||||
|
||||
data: dict[str, dict[str, Any]] = {
|
||||
"radio": {"noWrap": True, "func": radio, "args": []},
|
||||
"mc-down": {"noWrap": False, "func": mcDown, "args": [], "interval": 60}
|
||||
Firepup650 marked this conversation as resolved
Outdated
Firepup650
commented
related to my other commit, this needs to use the new related to my other commit, this needs to use the new `passInstance` param.
|
||||
"radio": {"noWrap": True, "func": radio, "passInstance": True},
|
||||
Firepup650 marked this conversation as resolved
Outdated
Firepup650
commented
Reverting that commit didn't even remove the timer, lol Reverting that commit didn't even remove the timer, lol
9pfs
commented
Looking for other commits to revert then Looking for other commits to revert then
Firepup650
commented
Just revert the revert, I'll delete the stuff that needs removal myself if you want. Just revert the revert, I'll delete the stuff that needs removal myself if you want.
|
||||
"mc-down": {
|
||||
"noWrap": False,
|
||||
"func": mcDown,
|
||||
"passInstance": True,
|
||||
"interval": 60,
|
||||
"ignoreErrors": True,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue
Critical change, needs to be un-reverted