Commit graph

315 commits

Author SHA1 Message Date
jesopo
1297901dca We do indeed need to see "\x03" even when there's no foreground/background
(color reset)
2018-11-14 22:50:04 +00:00
jesopo
2fc948ab24 Don't eat commas when there's no background color or when a comma directly
follows a background color
2018-11-14 22:35:13 +00:00
jesopo
81e1f11872 Missed a 'message' -> 'ctcp_message' 2018-11-14 22:13:31 +00:00
jesopo
1380f6c534 Typo in utils.irc, 'message' -> 'ctcp_message' 2018-11-14 22:10:45 +00:00
jesopo
19b195eb1d Stop supporting using ansi bold for brightening colors, support ansi background
colors
2018-11-14 22:07:34 +00:00
jesopo
378f4b1f93 Better parsing of CTCP messages, support raw.send.privmsg/raw.send.notice in
modules/line_handler.py
2018-11-14 21:28:27 +00:00
jesopo
ed838193aa Better support passing "send" events through the parsers already present in
modules/line_handler.py
2018-11-14 14:41:28 +00:00
jesopo
f7872fac43 Typo in src/utils/irc.py, 'resplace' -> 'replace' 2018-11-14 13:16:11 +00:00
jesopo
99c2147512 Don't assume a reconnect timer event will always have connection_params 2018-11-14 13:08:57 +00:00
jesopo
76d9face44 You can join color and bold in to one \033 ansi sequence 2018-11-14 12:19:31 +00:00
jesopo
0e499a4078 Support irc format full reset (\x0F) as ansi reset (\033[0m) 2018-11-14 12:13:08 +00:00
jesopo
bbcde2d1d5 Use extended ANSI colors to avoid using bold to make colors lighter 2018-11-14 11:47:15 +00:00
jesopo
2fcde64bfd 'ANSI_RESET' -> 'ANSI_BOLD_RESET' typo, 'ansi_bold' -> 'color_bold'
clarification, fix issue in color tokenizing that caused bolds to be put in the
wrong place
2018-11-14 11:44:56 +00:00
jesopo
bcdbb3640c Add type annotions to irc->ansi color functions 2018-11-14 10:28:38 +00:00
jesopo
00eb4027ec Only reset ansi bolding when both color-bold and bold are false 2018-11-14 08:09:01 +00:00
jesopo
e5f068f660 Bold reset is 22, not 21 2018-11-13 18:19:37 +00:00
jesopo
5c6aa87470 Fix bolding/unbolding code in utils.irc 2018-11-13 18:05:25 +00:00
jesopo
d18d28f0a2 Apparently '39' is 'font reset' for ansi colors 2018-11-13 17:53:37 +00:00
jesopo
f1b54efe77 Visual tweak; align "="s in utils.consts 2018-11-13 17:43:00 +00:00
jesopo
765ae0fcf9 Add code to tokenize and ansi-replace IRC colors; use this in
modules/print_activity.py
2018-11-13 17:23:28 +00:00
jesopo
7918f9cc4e Better constifying of COLORs 2018-11-13 17:23:18 +00:00
jesopo
8b9062b942 Better constifying of color/font chars 2018-11-13 16:02:26 +00:00
jesopo
16c4e1bfc6 I was accidentally removing two characters from the start of :nick!user@host 2018-11-13 15:04:11 +00:00
jesopo
555e8faa03 Print MOTD in modules/print_activity.py (after caching it in
modules/line_handler.py)
2018-11-13 14:59:47 +00:00
jesopo
e9c9ec778c Add .keys()/.values()/.items to src/IRCChannels.py 2018-11-13 11:36:44 +00:00
jesopo
36048be2fb That shouldn't be there 2018-11-13 11:36:28 +00:00
jesopo
66643a1bd8 Return new user's id in Database.users.add 2018-11-13 11:19:43 +00:00
jesopo
8fc7a7652a Return new server_id from Database.servers.add 2018-11-13 11:13:04 +00:00
jesopo
73c0c911d4 Move logic for adding a server to the database out to utils.cli and add a
--add-server flag for start.py, to add new server
2018-11-13 10:40:49 +00:00
jesopo
20b1e8b800 Remove unneeded const 2018-11-12 17:14:38 +00:00
jesopo
2747999ca6 We don't need utils.irc.remove_colon anymore! 2018-11-12 17:13:49 +00:00
jesopo
8b135d8310 Add type annotionations to src/Timers.py and src/IRCBuffer.py 2018-11-11 19:12:59 +00:00
jesopo
db1e2ea406 Add missing imports and Channel namespacing to src/IRCChannel.py 2018-11-11 16:11:45 +00:00
jesopo
a9b6086c70 Split out Channels in to IRCChannels.Channels, not IRCChannel.Channels 2018-11-11 14:53:16 +00:00
jesopo
0f53d2e828 Fix type annotations for utils.parse.keyvalue 2018-11-11 14:43:31 +00:00
jesopo
6bb03c4519 Don't implicitly create channels, explicitly create channels when we join one 2018-11-11 13:03:54 +00:00
jesopo
e29cc1c52c Implement __len__ on src/IRCChannel.py.Channels 2018-11-11 12:52:30 +00:00
jesopo
4e06a52bd9 Copypaste fail in src/IRCChannel.py, 'self.id' -> 'self._server.id' 2018-11-11 12:49:34 +00:00
jesopo
f6a997e3b9 Copypaste fail in src/IRCChannel.py, 'self.bot' -> 'self._bot' 2018-11-11 12:48:30 +00:00
jesopo
e133401ed9 Copypaste fail in src/IRCChannel, 'get_channel_id' -> '_get_id' 2018-11-11 12:47:02 +00:00
jesopo
32dccc65e0 Typin in src/IRCChannel.py, 'self._add' -> 'self.add' 2018-11-11 12:46:14 +00:00
jesopo
8eef9a612d Readd line I accidentally removed in src/Database.py 2018-11-11 12:45:10 +00:00
jesopo
245c4599dd Typo in src/IRCChannel.py, 'Iterable' -> 'typing.Iterable' 2018-11-11 12:43:39 +00:00
jesopo
0248c7503a Forgot to import EventManager in src/IRCChannel.py 2018-11-11 12:43:11 +00:00
jesopo
44393a3170 Add missing ":" in src/IRCChannel.py 2018-11-11 12:41:31 +00:00
jesopo
c84205ed9b Add a threading.Lock() around cursor.execute(...) in Database.py 2018-11-11 12:40:24 +00:00
jesopo
2816fe67bb Move channel tracking data/functions to src/IRCChannel.Channels 2018-11-11 12:34:22 +00:00
jesopo
4bab1aea30 Add a way to more explicitly denote when a CAP handshake has ended early 2018-11-09 10:43:05 +00:00
jesopo
a2292eb439 Filter out empty items in utils.parse.keyvalue 2018-11-08 22:41:30 +00:00
jesopo
3ff68dc427 Support passing unrestricted args between connections 2018-11-08 17:09:07 +00:00
jesopo
6bf6905262 Keep a track of bytes written and read per server 2018-11-08 13:31:05 +00:00
jesopo
26a16a7762 Keep a dict of isupport key:values on IRCServer.Server 2018-11-08 12:34:30 +00:00
jesopo
03cae696c1 Technically, we only need to unescape non-json message-tag *values* 2018-11-08 11:52:53 +00:00
jesopo
0c6d54f5fd Only mesage-tag unescape non-json tags after we split on ";" 2018-11-08 11:43:32 +00:00
jesopo
729d1424ed Unescape message-tags as per spec Escaping Rules 2018-11-08 11:37:23 +00:00
jesopo
5e7b335d04 Fix issues that were introduced in message-tag parsing when I added support for
JSON message tags
2018-11-08 11:13:24 +00:00
jesopo
3d00a1e15a Explicitly denote when an :arbitrary arg is present in an IRCLine 2018-11-08 10:36:40 +00:00
jesopo
dccb460e5c 'rename_channel' -> 'rename' in src/Database.channels 2018-11-05 21:39:00 +00:00
jesopo
0a70fda6dc Don't pass connection_params through to reconnect in normal circumstances 2018-11-05 20:51:51 +00:00
jesopo
ce3b319bee Only automatically reconnect to a server when we don't already have a server
with the same ID (to make reconnection work)
2018-11-05 20:33:45 +00:00
jesopo
3cb9baeec3 Cache a server fileno from connect onwards, like we used to 2018-11-05 20:33:30 +00:00
jesopo
e2c806ffe4 Typo in IRCServer, 'nicknamme' -> 'nickname' 2018-11-05 20:18:22 +00:00
jesopo
9571c3f9fa Update IRCServer.__repr__ to use connection_params 2018-11-05 20:18:06 +00:00
jesopo
afce01d0f8 Fall back to nickname for username/realname, as it used to be 2018-11-05 20:08:55 +00:00
jesopo
8b1e1fbb2e Clarify typing of .nickname/.nickname_lower/.name in IRCUser 2018-11-05 18:37:15 +00:00
jesopo
d63115440d Fix the order of some connection params, add alias as a seperate argument to
IRCServer.Server
2018-11-05 18:30:39 +00:00
jesopo
6b8593a09b Pass connection parameters around in their own object (IRCConnectionParameters) 2018-11-05 18:23:02 +00:00
jesopo
d92fc7f6b8 Add missing import of json in utils.irc 2018-11-05 17:44:21 +00:00
jesopo
0676b7b0db Call Database.channels.rename in IRCServer.Server.rename_channel 2018-11-05 16:47:47 +00:00
jesopo
055390e220 Add Database.channels.rename, as part of support for IRCv3's RENAME 2018-11-05 16:46:24 +00:00
jesopo
4936b91273 Support JSON messages tags, as per IRCv'3 message-tags-0.3 #318 pull request 2018-11-05 15:15:08 +00:00
jesopo
aaf0c8cf2a Reschedule STS expiration on disconnect 2018-11-05 14:12:21 +00:00
jesopo
6ca8017966 Give Logging.Log object to modules 2018-11-05 12:38:40 +00:00
jesopo
10130d7288 I forgot the "normal" event hook syntax! 2018-11-05 12:34:18 +00:00
jesopo
86bbd370fb 'self.events' -> 'self._events' in IRCBot 2018-11-05 12:29:13 +00:00
jesopo
c3f654673a Cache socket fileno in IRCServer.Server just before disconnecting 2018-11-05 12:27:30 +00:00
jesopo
fa3fc7e3fb @utils.hook doesn't work outside of modules! 2018-11-05 12:27:11 +00:00
jesopo
fcedc434f2 it should be self.bindhost, now that we've moved the logic to .connect() instead
of __init__
2018-11-05 12:18:30 +00:00
jesopo
1065bba3ef Typo in src/IRCServer.py; 'self.AF_INET' -> 'socket.AF_INET' 2018-11-05 12:16:30 +00:00
jesopo
7cc6b559be Clarify items and var_items typing in src.utils.parse 2018-11-05 11:56:52 +00:00
jesopo
9c233cd4dd Add src.utils.parse.keyvalue, mostly for IRCv3 CAP negotiation 2018-11-05 11:56:28 +00:00
jesopo
c2ebc7b5e4 Refactor IRCServer .connect() logic 2018-11-05 11:53:33 +00:00
jesopo
66ee3ce5f1 Add __repr__ to utils.irc.IRCArgs 2018-11-05 10:03:20 +00:00
jesopo
c1e9825a33 Don't set args to a split of the data left over when parsing out a command if
there's not a space after the command
2018-11-04 17:23:34 +00:00
jesopo
1610cfb499 Implement utils.irc.IRCArgs.__len__ 2018-11-04 17:06:50 +00:00
jesopo
b8e3cdb075 Fix typo in utils.irc, 'self_args' -> 'self._args' 2018-11-04 17:04:16 +00:00
jesopo
52aa8a51a6 Move definition of IRCArgs above IRCLine 2018-11-04 17:03:01 +00:00
jesopo
e1d261bda0 Fix typo in utils.irc 2018-11-04 17:01:50 +00:00
jesopo
58363895f1 Change line parsing to put arbitrary-length args on the end of
`args` so we can get rid of `last`/`arbitrary` and add IRCArgs (with .get())
to help only getting an arg index if it exists
2018-11-04 15:37:06 +00:00
jesopo
6d742f6a74 Implement IRCv3's draft/rename 2018-11-04 14:48:55 +00:00
jesopo
9fe7815c17 utils.irc.color should take int for foreground/background, not str 2018-11-02 13:14:42 +00:00
jesopo
5b27ccb551 Add src/__init__.py to allow mypy to see src/ as a module 2018-11-02 11:51:13 +00:00
jesopo
a4d8d1f855 Fix some non-explicit None returns, add type hints to important variables 2018-10-31 15:12:46 +00:00
jesopo
7d54bd6ad0 Move setting BitBotFormatter's converter (to time.gmtime) to class definition as
it's not technically correct to overwrite a funcion on an existing object
2018-10-30 18:03:44 +00:00
jesopo
b543e31cd2 Fix/refactor issues brought up by type hint linting 2018-10-30 17:49:35 +00:00
jesopo
d0e3574227 Typo in src/Exports; 'self_exports' -> 'self.exports' 2018-10-30 16:28:39 +00:00
jesopo
e07553c362 Add type/return hints throughout src/ and, in doing so, fix some cyclical
references.
2018-10-30 14:58:48 +00:00
jesopo
50e7aa40b9 Typo in utils.parse_docstring, 'multiple_items' -> 'var_items' 2018-10-28 11:53:44 +00:00
jesopo
857761a653 Support multiple items for docstring kwargs in utils.parse_docstring 2018-10-28 11:43:41 +00:00
jesopo
3094bb7748 Specifically handle OSError (e.g. Network is unreachable) as a disconnect 2018-10-26 11:30:16 +01:00
jesopo
d3231e3282 signal.signal timer callback takes 2 args 2018-10-25 14:09:19 +01:00
jesopo
4d3ff60205 Update src/IRCUser.py.send_notice to take a prefix kwarg 2018-10-25 12:15:12 +01:00
jesopo
8ea6db9422 Standardise "Failed to load results" errors! 2018-10-20 20:53:24 +01:00
jesopo
6bcfcb60ea Some networks allow you to remove user modes that don't exist e.g. removing +o
from someone that doesn't have it. wtf.
2018-10-18 21:07:08 +01:00
jesopo
751aaa3365 Add missing return in src/IRCServer.py.get_user_setting 2018-10-18 17:16:23 +01:00
jesopo
4796d4264c Print lines not [lines] in src/IRCBot.py 2018-10-17 17:36:01 +01:00
jesopo
c48574a3d6 "Cannot" -> "can't" in IRCServer encoding fallback 2018-10-17 17:04:56 +01:00
jesopo
a4bfae9557 TRACE log when we have to use fallback encoding 2018-10-17 16:54:33 +01:00
jesopo
6c6d593e6d Only log exceptions when they're not unsafe 2018-10-16 14:53:37 +01:00
jesopo
ba3cd00c78 Add utils.EventError, utilise it for stderr in commands.py/coins.py 2018-10-16 14:47:01 +01:00
jesopo
743b3bc754 event["args"] is an array already, args_split does not exist. Also send raw
events from src/IRCServer.py as call_unsafe to make errors like that more
apparent.
2018-10-15 14:29:16 +01:00
jesopo
40ffb6ce0e Typo in src/IRCServer.py, 'defau;t' -> 'default' 2018-10-14 14:31:30 +01:00
jesopo
0ed0b235e9 Work directly from users in modules/coins.py.interest(), so as to not give
double-interest to two "users" online at the same time sharing the same identity
2018-10-14 14:30:19 +01:00
jesopo
43d026cc9d Typo in src/Timers.py, 'conteext' -> 'context' 2018-10-13 09:16:53 +01:00
jesopo
5e3399f73e Actually, don't give contexts to timers that aren't contextual. (e.g. pesistent
timers)
2018-10-13 09:10:26 +01:00
jesopo
33921a8912 Timers._add takes a "context" param 2018-10-13 09:09:51 +01:00
jesopo
64cc1bf16c a Timer object can have a context yet not be a contextual timer 2018-10-13 09:09:24 +01:00
jesopo
561d686643 Correctly remove contextual timers from src/Timers.py 2018-10-13 01:13:14 +01:00
jesopo
0a93e76333 Use Timers.get_timers() instead of Timers.timers 2018-10-12 18:15:22 +01:00
jesopo
819f4e0680 Pass context-wrapped timers to each module, add ModuleManager.BaseModule.on_load 2018-10-12 18:07:23 +01:00
jesopo
cb94fa9ae4 Add TimersContext, to be able to purge timers when modules are unloaded 2018-10-12 17:54:15 +01:00
jesopo
d460375629 Use decimal.Decimal in utils.parse_number 2018-10-12 11:28:14 +01:00
jesopo
d427e29936 Actually pass format args to ValueErrors in utils.parse_number 2018-10-12 11:21:57 +01:00
jesopo
a810d273d1 int(number) after we've checked .isdigit() in utils.parse_number 2018-10-12 11:19:04 +01:00
jesopo
9771fc9f7a Add utils.parse_number, to turn 1k/1m/1b in to 1_000/1_000_000/1_000_000_000 2018-10-12 11:16:39 +01:00
jesopo
e6a55b2b22 Improve "non-complete line" TRACE log 2018-10-11 18:07:11 +01:00
jesopo
dceed3d439 TRACE log when we receive and buffer a non-complete line 2018-10-11 17:56:19 +01:00
jesopo
23b7223fae Add !syncmodes in modules/auto_mode.py, fire internal.identified in
modules/permissions.py and catch it in modules/auto_mode.py to give users modes
when they identify using the internal identity mechanism
2018-10-11 11:20:53 +01:00
jesopo
c655668bbe Add fallback_encoding to utils.http.get_url, in case a page has no implicit
encoding
2018-10-10 23:49:59 +01:00
jesopo
f286f3bf48 .decode data prior to json.loads in utils.http.get_url 2018-10-10 15:25:08 +01:00
jesopo
951c315cec Fix syntax error for throwing a timeout when signal.alarm fires 2018-10-10 15:07:04 +01:00
jesopo
015fa8ddff .decode plaintext returns from utils.http.get_url 2018-10-10 15:06:30 +01:00
jesopo
5b9ffe013d Use signal.alarm to Deadline utils.http.get_url and throw useful exceptions 2018-10-10 14:25:44 +01:00
jesopo
be75f72356 Set a max size of 100mb for utils.http.get_url 2018-10-10 14:05:15 +01:00
jesopo
68f5626189 Change utils.http to use requests 2018-10-10 13:41:58 +01:00
jesopo
c28a41ad21 Remove debug print in src.utils.http 2018-10-09 22:39:34 +01:00
jesopo
f69a1ce7c1 Return response code from utils.http.get_url when code=True and soup=True 2018-10-09 22:16:04 +01:00
jesopo
b144d5e37e Don't continue trying to use None data 2018-10-08 23:03:49 +01:00
jesopo
383767c7fb Support post_data in utils.http.get_url 2018-10-08 12:43:31 +01:00
jesopo
681866339c Support multiple types of comments in utils.get_hashflags 2018-10-07 11:24:13 +01:00
jesopo
29d8549da1 clear _trigger_functions after we've called all the waiting functions 2018-10-07 08:06:41 +01:00
jesopo
a77a985d5d Optionally take a function in IRCBot.trigger, a function to be called on the
main thread
2018-10-07 08:01:54 +01:00
jesopo
472d745401 Socket on_read functions take 2 args (socket, string) 2018-10-07 07:56:11 +01:00
jesopo
bb533ab9e8 This is a far less complicated way of triggering epoll.poll 2018-10-07 07:54:10 +01:00
Evelyn
661199aa54 Research suggests _config and config are not synonymous 2018-10-06 22:58:59 +01:00
jesopo
825fb15c87 Add control-socket to bot.conf.example, only start up control socket is a unix
domain socket location is provided
2018-10-06 18:31:00 +01:00
jesopo
9458d9fee2 'control_socket_client' -> '_control_client' in src/IRCBot.py 2018-10-06 16:42:38 +01:00
jesopo
90680c11ef Remove debug print in src/ControlSocket.py 2018-10-06 15:46:58 +01:00
jesopo
79aff93b5d Add a ControlSocket client to IRCBot.py, use it to trigger the epoll loop when a
github webhook has been caught!
2018-10-06 15:45:56 +01:00
jesopo
0794a5173a Add a way to track non-IRC sockets within the main epoll loop; use this for a
unix domain control socket!
2018-10-06 15:37:05 +01:00