Commit Graph

1721 Commits

Author SHA1 Message Date
skizzerz
1b50a37b69 Fix break_long_message, broken in 5793097626 2015-08-06 22:06:04 -05:00
Vgr E.Barry
38b7ef81e2 Add proper error handling. Closes #151
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`
2015-08-06 12:29:47 -04:00
nyuszika7h
74555f013a Fix Windows error messages in !ping 2015-08-06 12:37:37 +02:00
nyuszika7h
74d4f9c95e Actually add that ping message 2015-08-06 12:27:39 +02:00
nyuszika7h
e27cb0c1e0 Add another ping message 2015-08-06 12:27:10 +02:00
Vgr E.Barry
b3c8fd562a Fix some errors and style in !swap 2015-08-05 21:55:09 -04:00
Vgr E.Barry
a6a128586d Add a !swap command. Closes #129
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.
2015-08-05 21:28:04 -04:00
Vgr E.Barry
188ede0b2e Change is_user_altpinged to return only an integer 2015-08-05 21:22:42 -04:00
Vgr E.Barry
397d7362db Update !roles
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.
2015-08-01 09:54:08 -04:00
Vgr E.Barry
eef01df1f7 Nitpick by ChrisE 2015-08-01 09:35:27 -04:00
Vgr E.Barry
ff53ad4bcf Modify is_user_stasised to return only an integer, not a tuple 2015-08-01 09:22:42 -04:00
Vgr E.Barry
0eee4b1c88 Fix random randomly failing to start
Pun unintended
2015-08-01 09:18:19 -04:00
Vgr E.Barry
29cf18f7be Update revealroles
Now shows which side turncoat is on, and what role someone was if they
changed during game. Also removed string concanetation so save on
memory/time.
2015-07-31 13:30:40 -04:00
Vgr E.Barry
7c9b5ce51b Fix decorators 2015-07-31 13:29:26 -04:00
Vgr E.Barry
e259502ad4 Change a few hasattr/getattr calls for something more intuitive 2015-07-31 13:29:05 -04:00
Vgr E.Barry
f40e749c07 Allow !fjoin to join ranges of fake nicks 2015-07-31 13:28:34 -04:00
Vgr E.Barry
5793097626 Improve var.break_long_message
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
2015-07-31 13:28:08 -04:00
Vgr E.Barry
dc54fdc883 Add random !ping replies 2015-07-31 13:26:50 -04:00
skizzerz
6fecec6df3 Re-add limit for fwait
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.
2015-07-30 13:06:48 -05:00
skizzerz
e27fd8c1fa Fix connect hooks
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).
2015-07-29 03:14:10 -05:00
skizzerz
dbb80a940e Fix issues related to undernet (and in general)
- 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
2015-07-28 22:35:47 -05:00
skizzerz
b4c5fc4188 Fix error introduced in 32ab792e 2015-07-27 22:36:43 -05:00
Vgr E.Barry
9d10a1a342 Display what amnesiac would have turned into at end of night 2015-07-27 10:24:55 -04:00
Vgr E.Barry
120a2f3717 Fix error (blame @nyuszika7h) 2015-07-27 09:26:40 -04:00
nyuszika7h
32ab792e2f Use the specified username for NickServ identify 2015-07-27 14:19:46 +02:00
nyuszika7h
7751efdd3c Another accidentally removed config option. 2015-07-27 14:14:15 +02:00
nyuszika7h
578c86a8e1 Oops, accidentally removed this from the example config 2015-07-27 13:55:14 +02:00
nyuszika7h
21060b2bfb Add an option to change NickServ's name and the identify command 2015-07-27 13:08:52 +02:00
skizzerz
80f5f7d4e8 Separate bite from kill for alpha wolf.
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.)?
2015-07-26 23:29:40 -05:00
Vgr E.Barry
017811b7db Fix game mode docstring parsing 2015-07-26 13:34:04 -04:00
skizzerz
4eaedea442 Fix fgame autocompletion 2015-07-26 12:32:07 -05:00
nyuszika7h
0e704e5533 Fix missing period in !hex message 2015-07-25 22:27:10 +02:00
skizzerz
6dd9c199fd Disable stats for noreveal, and make the 'no reveal' message more clear 2015-07-24 12:27:08 -05:00
nyuszika7h
2f5712cb3b Prefix "/me"s in wolfchat with an asterisk
This is needed to disambiguate them from the bot announcing wolfteam
actions in wolfchat, which was recently added.
2015-07-24 13:50:42 +02:00
jacob1
c39298cd43 remove det from lycan (a bit too OP), replaced with 2nd seer at 19p (fakeclaiming opportunity) 2015-07-22 20:27:41 -04:00
nyuszika7h
bf18c5fbb2 Fix previous commit 2015-07-22 21:10:15 +02:00
nyuszika7h
c3fa5d4907 Change all "to not" -> "not to" 2015-07-22 21:01:09 +02:00
nyuszika7h
0d0bda349d Announce wolf/alpha retracting in wolfchat too & remove redunant check 2015-07-22 20:56:55 +02:00
nyuszika7h
e1271290aa Add note about random picking to shaman and matchmaker role message 2015-07-22 19:03:16 +02:00
nyuszika7h
a41d302607 Fix "already charmed" message for piper
"For tonight" implies that charmed players are only charmed until the
night ends, which is certainly not true.
2015-07-22 18:32:20 +02:00
nyuszika7h
164785d589 Announce wolf actions in wolfchat
This way it's immediately obvious if it was a legit command or not. The
result of werecrow's observation is not announced, because it's possible
for the crow to be killed at night and this would take away that
strategy. For sorcerer, it does not even bother announcing the fact that
they observed, since they can tell the result immediately if they are
alive, so the message is pretty much redundant.

Also, minor fixes:

* Log kill by angry wolves properly, instead of the non-obvious hack
  that @Vgr255 used.

* Add missing quotes in angry wolves wolfchat message.
2015-07-22 17:59:53 +02:00
nyuszika7h
22faf0b961 Skip leading symbols in complete_match
This allows you to vote |evil| with "!v evil", for example, provided
that no other nick matches that.
2015-07-22 16:11:38 +02:00
skizzerz
d26c621b55 Fix win sequencing bug
If all wolves are dead and there are the same number of wolfteam as
vills (due to sorcerers, hags, etc.), then village should be credited
with win.
2015-07-20 23:06:22 -05:00
nyuszika7h
f65f48c70d Add missing bolding + period & fix format string 2015-07-20 17:52:40 +02:00
nyuszika7h
66fe0ec167 Fix typo that broke everything 2015-07-20 15:58:34 +02:00
skizzerz
93345c990d Make DISABLE_ACCOUNTS actually disable account-related stuff.
Right now the only thing that still tracks accounts if DISABLE_ACCOUNTS
is True is stats stuff (in sqlite), as I'm unsure of how we want to
handle that for when accounts aren't enabled; likely track by nick but
unsure on that right now.

This further implements issue #112 but doesn't fix it entirely yet.
2015-07-19 14:37:17 -05:00
nyuszika7h
40a7337ee8 Remove redundant calls to set() in previous commit 2015-07-19 21:24:55 +02:00
nyuszika7h
66a8826eb1 Reuse same code for is_admin/is_owner 2015-07-19 21:22:38 +02:00
nyuszika7h
c13e3087d6 Clean up botconfig.py.example 2015-07-19 21:22:37 +02:00
skizzerz
99e4a49fe6 Also deduct min lycans if it is possible alpha turn with GAs around 2015-07-19 04:02:57 -05:00