Convert chk_decision, chk_nightdone, transition_day, transition_night, doomsayer, mayor, and convert+split shamans in three files with a shared helper. Fixes and updates for the User containers, and some other tweaks and fixes.
- Move the config comments to botconfig.py.example where they will be more useful,
and move the bits in settings.py near the other IRC-related settings.
- Removed support for hash types that aren't SHA-256 as we perform all the hashing on
our end (doesn't matter what the server does or does not support), and this greatly
simplifies the code while leaving things secure enough.
- Hardcode a default cipher suite according to mozilla modern standards, as the
builtin ciphersuite in python may be less secure for older python versions.
- Add support for EXTERNAL auth in SASL, if a client certificate is provided. If this
fails, it will fall back to PLAIN auth (to account for the case where a cert is added
to the bot, but has not yet been added to NickServ, so that the bot can connect and add
it to NickServ via !fsend)
- Redact passwords from console/log output so that asking people to pastebin their
--verbose output when reporting issues in #lykos is less fraught with peril.
MessageDispatcher, sleepy mode, warnings, and the latency command,
to be exact. Sleepy also benefits from some code deduplication in
addition to now operating on users.
The warnings code could use a more comprehensive overhaul too, but
that's going to be harder to achieve.
- Expand skel.py to be more useful
- Remove circular dependency from utilities.py. It *CANNOT* globally
import users.
- Remove unused functions from utilities.py and make some others proxy
through to user-aware functions to ensure functionality stays the
same.
- Remove duplicate event listener.
- Clarify some comments about stats.
Also allow prefixing commands by their role name to remove ambiguity
should a person be multiple roles. For example, "seer see foo" and
"augur see foo" will now work if a person is both seer and augur
(whereas normal see foo would be ambiguous). A player will be directed
to use the unambiguous prefixed version if we detect that a role command
will fire multiple times for them (note: coming soon).
For sanity reasons, these role prefixes are implemented as exclusive
commands, meaning no other commands or command aliases may use the same
name. Clone needs to be special-cased in this regard, as clone is both a
role name and a command name.
Don't start a new timer every time someone calls !latency, and make it
work even if automatic pinging is disabled. Also, moved the command to
handler.py per @Vgr255's suggestion.
In some cases, disconnection from the server can be unclean and won't be
noticed until the bot tries to send a message, which may never happen if
it did not disconnect during the game. To solve this problem, it will
now ping the server every 2 minutes by default, which will result in
a broken pipe error if the connection is dead. This won't be able to
detect netsplits where the server the bot is on stays online, because
those are impossible to correctly detect in every case.
This commit also adds a !latency command so that users can verify if the
bot is lagging.
Causing way too many bugs, need to use a more sane method of breaking
the cmd API, and only do so when it's actually ready to go. My
personal preference is to make the new API use @command instead of @cmd.
This reverts commits c90d35e6c0a9ba96692e9d73bbe27efca405d542 and 5f5966a8b49e5214c82d806ac43a2553754fdee6.
Whether or not GHOST is used now depends on if NICKSERV_RELEASE_COMMAND
or NICKSERV_REGAIN_COMMAND are empty. Also, we do not try to go into an
infinite loop should the command we use fail to work, and instead just
run with a "wrong" nick.
Not tested at all, so blame ilbelkyr when things inevitably don't work
with it (and while you're blaming him, get him to fix the ASM website).
We don't use it, as the only places where we'd need to, it's only one channel, and the surrounding code needs to add the user to the channel and vice-versa, so that's pretty pointless.
This also does some more bits of rudimentary user handling, but most of it still remains to be done.
Note: This adds DEV_PREFIX to botconfig and LOG_PREFIX to settings (var), make sure to properly update your bot!
All hostmask and account comparisons are now case-insensitive (nicks
still aren't, related to #217 -- changing nick sensitivity would break
everything in numerous places).
Also, refactor some things into other files where it makes sense to do
so, because putting unrelated things into the same commit is fun.
An artifact of how we run commands means that we try to run the rest of
the "give" command handlers even after the first (shaman) one ended night.
As such, check the phase and if it's different, stop trying to execute
command handlers.
This has a small race condition where the error this fixes can happen
anyway, but since it's purely a visual error I think that's fine. Better
than happening all of the time, at least.
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`
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