All exceptions, if not caught, are unconditionally sent to `sys.stderr`.
We only need to use our own custom class with some modifications and we
can intercept all errors, even those in threads (which #151 was about).
The only real downside from this practice is that `cli` is not
accessible to us when the errors happen, so I used a hack to set it on
an instance variable. If anyone can find a better solution, please step
forward. For the time being, this will have to do.
If for some obscure reason this class breaks, `sys.__stderr__` holds the
original `sys.stderr`
This allows people to swap out an existing player from the game, and
join instead. Useful if, say, your home connection dropped, but your ZNC
is still online and you want to keep playing through your phone for
example. The player swapping and the one being swapped must be
identified to the same account for this to work. After the command has
been used, an implicit !myrole is performed, informing the player of
their role and templates. The on_nick handler has been decoupled into
two functions, where most of the logic is now in rename_player (which
swap uses).
Known issues: Hard drive space is left untouched.
Now `!roles` while in a game will have the same effect as `!roles n`
where n is the number of players that joined. Also got rid of string
concatenation.
Concatenating strings repeatedly slows down the program and eats up
memory. It's not too bad for the number of players we have, but if you
get 10k players that makes a significant difference
Now restricted to adding/removing 900 seconds (15 minutes). There are no
valid reasons I can think of or that were given in -dev that would
require more time than this. 15 minutes is still likely too much and
from previous experience such long forced waits generally trigger a mass
exodus of players who would rather play a game than doing absolutely
nothing.
Apparently having multiple hooks on the same thing is just horribly
broken, even though we do it in other places. This only fixes the issue
on connecting as that one is the most severe, but the other cases will
need to be fixed as well (or the underlying issue preventing it from
working needs to be fixed).
- Now possible to use the bot without it having a registered account by
blanking NICKSERV_IDENTIFY_COMMAND
- Now possible to configure who ChanServ is as well as the command it
uses to op up in channel (blank to prevent it from auto-opping).
Example configuration provided for undernet
- Properly autojoin channels even if there isn't an MOTD
Alpha now can choose to either bite or kill, but not both. If other
wolves are alive, they can still kill as normal allowing both to happen
that night. Additional interactions were added to deal with visiting
harlots and to not accidentally kill bodyguards/GAs in the event that
they are bitten and would die from wolves (if
BODYGUARD/GUARDIAN_ANGEL_DIES_AT_NIGHT_CHANCE is set).
Things to consider for the future but didn't have time to do yet:
- Should we play a message in channel if alpha wolf successfully bites
someone at night?
- Avoid killing a bodyguard/GA if Fallen Angel is in play and said
bodyguard/GA was bitten that night.
- Should wolves avoid automatically killing people bitten on previous
nights (e.g. a bitten harlot wouldn't get nommed visiting wolves or
victims, bitten bodyguards/GAs wouldn't die from fallen angel, etc.)?