Commit Graph

2523 Commits

Author SHA1 Message Date
Vgr E. Barry
87df9e1440 Add a client attribute to MessageDispatcher 2017-01-12 12:43:18 -05:00
Vgr E. Barry
16022599e5 Use __class__ cell for channel comparisons 2017-01-12 12:42:46 -05:00
Vgr E. Barry
420d67250f Fix setting channel mode to None 2017-01-11 23:08:45 -05:00
Vgr E. Barry
fb6aa40170 Please stand away from water sources when short-circuiting 2017-01-11 22:54:19 -05:00
Vgr E. Barry
4bedfb0848 Fix unbound variable in sighandler 2017-01-07 11:28:05 -05:00
Ryan Schmidt
b1271ecbe0 Merge pull request #277 from lykoss/part-quit-hooks
Improve user part/quit/nick hooks
2017-01-06 10:17:28 -07:00
nyuszika7h
a6e4d2b3c1 Fix ping handling
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.
2017-01-06 17:07:42 +01:00
nyuszika7h
6f7e4398dd Simplify latency checking code
Since we send the timestamp of the request with the ping and the server
will send it back, there is no need to store it.
2017-01-06 16:20:40 +01:00
nyuszika7h
06c60dfdc3 Fix circular import
The strange thing is that it was working on my test instance.
Probably because Python 3.6 changed something regarding that.
2017-01-06 15:58:53 +01:00
nyuszika7h
a6e3c0a720 Periodically ping server to detect disconnection
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.
2017-01-06 15:52:26 +01:00
Vgr E. Barry
d78f0e5179 Fix realname being a space breaking handling 2017-01-01 11:01:33 -05:00
Vgr E. Barry
e0f8f172d6 Update part/quit/kick/nick hooks 2016-12-19 13:29:20 -05:00
Vgr E. Barry
53cd5dc616 Add a users.complete_match function, taking and returning Users 2016-12-19 13:29:02 -05:00
Vgr E. Barry
081f909260 Use proper __class__ cell for super 2016-12-19 13:10:06 -05:00
Vgr E. Barry
e7eabba791 More easily create fake users 2016-12-19 13:09:57 -05:00
Vgr E. Barry
85f8f9717a Change variable name to be more informative 2016-12-19 13:09:47 -05:00
Vgr E. Barry
b6738f2216 Better handle channel key 2016-12-19 13:09:34 -05:00
Vgr E. Barry
898a7107ca Allow passing contexts to Channel.mode 2016-12-19 13:09:23 -05:00
Vgr E. Barry
9014d5c35c Make comparing contexts easier 2016-12-19 13:09:12 -05:00
Vgr E. Barry
59e7c13a0b Move equals from users to context 2016-12-19 13:08:18 -05:00
Vgr E. Barry
63d908a61a Properly handle channel casing 2016-12-19 13:08:07 -05:00
nyuszika7h
a3fd532b3a Fix UnboundLocalError for regain/release 2016-12-16 11:38:07 +01:00
Vgr E. Barry
33563da1eb Fix users.get(..., allow_multiple=True) to always return a list 2016-12-14 20:04:36 -05:00
skizzerz
6bf12520f1 Fix day timeout causing game to end twice 2016-12-14 10:23:00 -06:00
nyuszika7h
144b01cfed !restart already fixed, small change for consistency 2016-12-11 10:27:39 +01:00
nyuszika7h
218366cbd8 !die: Fix first word of message being cut off in debug mode 2016-12-11 10:25:14 +01:00
Vgr E. Barry
06486e14bd Fix fsay/fact broken for non-existent users 2016-12-11 01:33:14 -05:00
Vgr E. Barry
dff024e5e4 Allow contexts to be used directly in str.format() calls 2016-12-09 10:56:34 -05:00
Vgr E. Barry
e1be940f24 Fix !join erroring out 2016-12-09 10:54:16 -05:00
jacob1
2c5e108751 fix error on !join when ACCOUNTS_ONLY is set 2016-12-09 07:56:40 -05:00
Ryan Schmidt
9f4b1a243d Merge pull request #274 from lykoss/cmd-old-api
Add a backwards-compatibility handler for commands
2016-12-08 16:35:19 -07:00
skizzerz
47339618f8 Remove part/fpart command
There is no reason for this to be a command. It has no analogue outside
of fsend, in which case you can just fsend a raw PART if needed as well.
2016-12-08 17:23:15 -06:00
Vgr E. Barry
bb8548ccdf Right. 2016-12-06 08:40:12 -05:00
nyuszika7h
3d5aa8c8e3 Fix message name 2016-12-05 14:06:22 +01:00
nyuszika7h
b2104e4d36 Respect LOG_PREFIX for !fwarn add/set 2016-12-01 23:21:01 +01:00
Vgr E. Barry
e8338d1ef6 Add the new command API + converted commands
Converted commands mostly use some backwards-compatibility hack. Please don't mind it, I'll eventually get to it.
2016-11-28 20:19:48 -05:00
nyuszika7h
da502fa34c Require a minimum of 6 players for charming
In 5-player charming games, it is possible to get into a situation where
it's impossible for the village to win - if all players except for the
wolf are charmed, lynching the wolf results in the piper winning, and
lynching the piper results in the wolf winning.
2016-11-25 14:23:16 +01:00
Vgr E. Barry
c26c7887bc Add a hook for account changes 2016-11-24 17:05:08 -05:00
Vgr E. Barry
5f50096d08 Delay error in users.get until after the end of the loop
This was originally done so that we wouldn't need to iterate through the (presumably large) set of users. However, when this raises, we have no idea which users actually match the criterias. By waiting until after, the traceback will actually print off the list of all potential users.
2016-11-24 16:29:58 -05:00
nyuszika7h
21b8ffa342 Fix denying commands with warnings 2016-11-24 16:17:53 +01:00
skizzerz
08652301c2 Properly delay night properly in villagergame, all proper-like now 2016-11-23 16:27:37 -06:00
skizzerz
a01f8860d0 Delay night properly in villagergame 2016-11-23 16:26:06 -06:00
nyuszika7h
ed7d3eda6a Add a random delay to night in villagergame 2016-11-23 19:34:41 +01:00
jacob1
bb99493ae8 fix protections not carrying over after nick change 2016-11-23 11:53:45 -05:00
Vgr E. Barry
27b0c9578d Move static methods out of the IRCContext class 2016-11-22 07:42:07 -05:00
Vgr E. Barry
423f7e352c Fix IRCContext.send_messages 2016-11-22 07:40:29 -05:00
Vgr E. Barry
ea3acbfb2a Allow implicit replacement of users without a ident and a host
This takes a different code path because of slightly different conditions; in the first case, the ident and host are both known, and so the instance is hashable. Being hashable, it can be checked for set containment, and exactly one instance in that set will be equal (since the hash is based off of the ident and host, and the comparisons check for all non-None attributes, two instances cannot possibly be equal while having a different hash).

In the second case (the new one), however, at least the ident or the host is missing, and so the hash cannot be calculated. This means that two instances may compare equal and hash to different values (since only non-None attributes are compared), so we need to run through the entire set no matter what to make sure that one - and only one - instance in that set compares equal with the new one. We can't know in advance whether or not there is an instance that compares equal to the new one in that set, nor can we know if there are multiple instances that are going to compare equal.

The two code paths are separated so that the difference in functionality is obvious (and this commit description, as well as the comment in the code, should help with that), and that the distinction remains clear.
2016-11-21 21:44:34 -05:00
Vgr E. Barry
ea51642240 Allow users.get(..., allow_multiple=True) to return an empty list 2016-11-21 21:12:27 -05:00
Vgr E. Barry
d590e7b727 Fix servers setting modes and !fsync breaking the bot 2016-11-21 10:29:14 -05:00
skizzerz
1f7b5ee6a3 Break infinite regain/release loops redux 2016-11-20 21:44:40 -06:00