Commit graph

688 commits

Author SHA1 Message Date
jesopo
b6844303cb add set_throttle(lines, seconds) function to tweak throttle per-server 2019-07-23 17:46:22 +01:00
jesopo
4babce5357 Only fill throttle when buffer is empty 2019-07-22 13:14:07 +01:00
jesopo
304fcdaebb gotta str()-ify kwargs before logging it 2019-07-15 14:27:55 +01:00
jesopo
4815c1612c don't silently truncate at newline in IRCLine.ParsedLine.truncate() 2019-07-15 14:26:45 +01:00
Mikaela Suomalainen
2f18414cb7
src/EventManager.py: fix typo defualt -> default 2019-07-13 13:04:37 +03:00
jesopo
89c12e845a add --remove-server/-R cli arg 2019-07-12 09:30:22 +01:00
jesopo
ab45c65fb4 'self.channels' -> 'self._channels' 2019-07-11 14:22:33 +01:00
jesopo
02838e4802 Return new Timers 2019-07-09 11:16:34 +01:00
jesopo
32fa999c78 Allow Timer objects to be cancelled 2019-07-09 11:14:05 +01:00
jesopo
c19c6c0e14 asyncio.gather -> asyncio.wait (with timeout) 2019-07-08 14:50:11 +01:00
jesopo
469c725675 tell asyncio.gather which loop to use 2019-07-08 14:41:12 +01:00
jesopo
a1438abf66 close event loop when we're done with it (request_many()) 2019-07-08 13:59:48 +01:00
jesopo
81c7af8ab5 Don't try/except async http exceptions 2019-07-08 13:51:02 +01:00
jesopo
ee0ec0eca1 switch request_many() to use asyncio.gather 2019-07-08 13:46:27 +01:00
jesopo
b62ba469d7 catch async exceptions in utils.http.request_many() 2019-07-08 13:18:59 +01:00
jesopo
078681eddf add missing schema in utils.http.sanitise_url, use in rss.py 2019-07-08 12:54:06 +01:00
jesopo
ecb8364d0d switch to using asyncio's event loop 2019-07-08 12:45:10 +01:00
jesopo
15e143fcff implement utils.http.request_many as a tonado ioloop yield 2019-07-08 11:43:09 +01:00
jesopo
f9d5271762 "paramatered" -> "parametered" 2019-07-04 17:23:36 +01:00
jesopo
43c8ad0ff6 Add !editserver command 2019-07-04 13:15:51 +01:00
jesopo
3afbe5fd82 threading.Lock() around any access to _write_buffer 2019-07-04 06:56:05 +01:00
jesopo
76ab7935a0 return parsed modes from IRCChannel.parse_modes, pass through mode events 2019-07-03 08:13:28 +01:00
jesopo
637067c62c url_validate() -> url_sanitise() 2019-07-02 14:15:49 +01:00
jesopo
534854127b Add utils.http.url_validate() for best-effort url tidying 2019-07-02 14:10:18 +01:00
jan6
b6e9713a14 fixed capabilities 2019-07-01 14:41:47 +03:00
jesopo
19f716ab4c Implemnt _options_factory for OptionsSetting to have dynamic options 2019-06-29 22:26:28 +01:00
jesopo
b4c762eb4e Automatically format example text for OptionsSetting (showing options) 2019-06-29 21:33:26 +01:00
jesopo
7091860e54 Setting.__init__ call in OptionsSetting ctor needs self param 2019-06-28 23:27:56 +01:00
jesopo
756396d758 Implement utils.OptionsSetting 2019-06-28 23:26:42 +01:00
jesopo
ae9d099a41 Refactor set/channelset/serverset/botset in to 'utils.Setting' objects 2019-06-28 23:16:05 +01:00
jesopo
f9eb017466 message arg for HTTPWrongContentTypeException/HTTPParsingException 2019-06-28 23:01:21 +01:00
jesopo
97810db8df Give descriptions to utils.http.HTTPException subclasses 2019-06-27 18:28:08 +01:00
jesopo
3c3f0449b6 add CaseInsensitiveDict.__contains__ 2019-06-26 17:57:49 +01:00
jesopo
16d331dd43 add allow_redirects kwarg to utils.http.request() 2019-06-26 17:53:16 +01:00
jesopo
c5785a2d14 implement @utils.kwarg() magic, use it for command.regex hooks 2019-06-26 14:37:41 +01:00
jesopo
7060a0ac67 Update IRCBot except queue.Empty comment 2019-06-26 13:43:00 +01:00
jesopo
4bf5c4783b Re-add EventManager check to prevent _call() outside main thread 2019-06-26 11:42:23 +01:00
jesopo
bb749b111f Refactor EventManager to only hold hooks on a root object 2019-06-26 11:01:09 +01:00
jesopo
12181bfec6 Add system to have multiple url shorteners and chose which to use 2019-06-25 17:53:00 +01:00
jesopo
a1cc2e778c Return 0 seconds if timeout seconds is negative 2019-06-24 17:22:08 +01:00
jesopo
ef0b3ec64c move _check() after timeouted queue.get() so deadlines are met accurately 2019-06-23 20:50:40 +01:00
jesopo
dd1df4dc05 move get_poll_timeout() to event loop now that it is the one calling _check 2019-06-23 19:00:37 +01:00
jesopo
9673963a8d shift _check() call to event loop function so read_loop needn't call trigger() 2019-06-23 18:53:25 +01:00
jesopo
102aa1dce1 v1.10.0 release 2019-06-23 14:45:56 +01:00
jesopo
afc287f020 Don't print BitBotPanic stacks when we don't need to 2019-06-23 10:01:15 +01:00
jesopo
7861210495 v1.10.0-rc2 2019-06-23 09:45:47 +01:00
jesopo
22574448da until_read_timeout is a func - read_timed_out has always been returning false 2019-06-22 23:31:06 +01:00
jesopo
01bad3a76e Don't needlessly call time.monotonic() when checking cache expirations 2019-06-22 23:30:15 +01:00
jesopo
7d49826b1a v1.10.0-rc1 2019-06-22 22:41:17 +01:00
jesopo
f1abc5f10c remove remove_own_mode( check - deferred_read.py better solves the issue.
the issue was getting a MODE line on irc.com prior to 001, thus we didn't know
what our nickname was thus we didn't know that the MODE was for us. not dying
when we saw +x was easy to do with this check but I think it's more correct to
actually parse that MODE after 001 so we know we have +x.
2019-06-22 22:23:05 +01:00
jesopo
3eac36d0f5 Restrict EventManager calls to the main thread 2019-06-22 12:21:44 +01:00
jesopo
a783e71ad4 return generated SentLine objects from IRCChannel.send_* functions 2019-06-21 18:25:21 +01:00
jesopo
90c90e5bbd Implement dependency system for CAPs 2019-06-21 18:05:11 +01:00
jesopo
8a0d99f969 Adda system of aliases for CAPs, mostly for changeable draft specs and creating
dependence between moving specs
2019-06-21 17:15:46 +01:00
jesopo
bffc5b0ec4 WARN log when we try to remove a mode from ourselves that we didn't have 2019-06-21 11:16:53 +01:00
jesopo
01438f28f6 check we have a mode before trying to remove it 2019-06-21 11:14:10 +01:00
jesopo
e7b17f2ccd give every ParsedLine a uuid4 .id for tracking purposes 2019-06-21 10:33:59 +01:00
jesopo
01ddc04bb9 fix hostmask_match_many type hinting 2019-06-20 17:58:49 +01:00
jesopo
b6e194a450 Implement hostmask_match_any, for more efficient matching of multiple hostmasks 2019-06-20 14:21:11 +01:00
jesopo
792a42be6e Implement utils.irc.hostmask_match() as regex 2019-06-20 14:10:10 +01:00
jesopo
612c26ff7e Differentiate between module "not found" and "not loaded" 2019-06-19 23:11:42 +01:00
jesopo
928f2f304d Raise ModuleNotFoundException on failure to find_module() 2019-06-19 23:05:22 +01:00
jesopo
dc9cd2869f Give requested module name to ModuleNotFoundException 2019-06-19 23:03:27 +01:00
jesopo
9457430c15 Add MessageTag.present, to see if a tag is present (even without value) 2019-06-19 22:36:42 +01:00
jesopo
938e1db963 add margin arg to ParsedLine.truncate so commands/outs.py doesn't do it
manually and cause potential issues with multi-byte chars
2019-06-19 10:34:42 +01:00
jesopo
c463fa20a4 line_formatted -> valid so tags don't cause us to subvert truncation 2019-06-18 18:14:04 +01:00
jesopo
1cbc2ce31b Tags should not be appended to pieces now that they're counted separately 2019-06-18 17:56:20 +01:00
jesopo
aa4a15a6dc Add IRCBot.URL (https://bitbot.dev) 2019-06-18 17:33:54 +01:00
jesopo
51cac7d9b5 add has_tag() and get_tag() to IRCLine.ParsedLine 2019-06-18 15:18:44 +01:00
jesopo
31be78db81 message-tags count for a different character limit than the rest of the line 2019-06-18 14:33:51 +01:00
jesopo
621830c360 Simplify SentLine by shifting truncation to ParsedLine (and commands.outs) 2019-06-18 14:14:37 +01:00
jesopo
133ff1c0f6 only count "\n"s (not "\r\n") that hit the wire, incase \r\n gets cut in half 2019-06-17 18:23:38 +01:00
jesopo
d4391cc6c5 Fix Database.ChannelSettings.find SQL 2019-06-17 17:51:27 +01:00
jesopo
5c325d9b23 'break' instead of 'continue' so that things in the event queue get discarded 2019-06-17 16:19:20 +01:00
jesopo
72ce880478 Only panic() when a server connection is part of bot init. closes #69 2019-06-17 14:20:11 +01:00
jesopo
9121a868a8 Make sure we exit event loop when there's no servers left 2019-06-17 14:07:06 +01:00
jesopo
dbe0b1f43b Tell servers objects when they are the result of a reconnection 2019-06-17 13:53:17 +01:00
jesopo
ec733e200c Default IRCBot.running to false, set to true at the top of .run() 2019-06-17 11:35:45 +01:00
jesopo
da5d48400d Change panic() reason log from ERROR to CRITICAL 2019-06-17 11:12:04 +01:00
jesopo
9ea356bc49 Raise a BitBotPanic() exception in panic() 2019-06-17 11:11:35 +01:00
jesopo
f8fa529ca5 Add IRCBot.panic() - a nicer interface for killing the whole application 2019-06-17 11:06:03 +01:00
jesopo
ced59a0f74 Allow channel-access and channel-mode check for channels people are not in 2019-06-16 20:48:31 +01:00
jesopo
18004c23e1 Don't fail get_kwarg when self.kwarg[name] is falsey 2019-06-16 18:39:56 +01:00
jesopo
5fa3d66a39 Return all caps through received.cap.ls|new and check if valid in line_handler,
remove server.cap_started
2019-06-16 15:33:20 +01:00
jesopo
919a488e86 Implement client-to-server BATCHes 2019-06-16 09:52:54 +01:00
jesopo
055eed24fd Type annotate ParsedLine.tags, add ParsedLine.add_tag() 2019-06-16 09:52:25 +01:00
jesopo
8ab4880c5c Change from yield checks to a func in events that pass up EventErrors 2019-06-15 18:42:14 +01:00
jesopo
b5a467552f CRITICAL log exceptions caught in _loop_catch() 2019-06-15 00:39:52 +01:00
jesopo
e0d99fe8b1 Fix utils.Check args type hinting 2019-06-14 12:12:38 +01:00
jesopo
f05fc209b0 Add a way to __or__ utils.Checks, as a "if one of these passes" thing 2019-06-14 12:01:55 +01:00
jesopo
d7fa2cfa24 Catch yields in command callbacks for e.g. permission checks 2019-06-14 11:42:12 +01:00
jesopo
0e5ba747a9 Wrap _read_loop() and _write_loop() in a try that kills the main thread 2019-06-13 17:11:46 +01:00
jesopo
795f6afbeb Mode mode (and mode arg) parsing to IRCChannel.py, add IRCChannel.mode_str 2019-06-13 11:53:47 +01:00
jesopo
8135f871c3 Change send_*() function return hints to be typing.Optional 2019-06-10 15:02:03 +01:00
jesopo
6c5dc958d0 Add .assure() to ParsedLine, to make it immune from .valid() 2019-06-10 10:45:02 +01:00
jesopo
0fc03fd592 Allow preprocess.send callbacks to request a line not be sent at all 2019-06-10 10:11:31 +01:00
jesopo
512d844a5a Update CHANGELOG, v1.9.2 release 2019-06-09 17:34:45 +01:00
jesopo
a31793c851 Put responsbility of self.running = False on to the event loop 2019-06-09 14:59:28 +01:00
jesopo
e28a8d91ab IRCServer.statusmsg type hint 2019-06-08 12:10:14 +01:00
jesopo
55fb9cee3b v1.9.1 release 2019-06-08 11:03:18 +01:00