Commit graph

1150 commits

Author SHA1 Message Date
jesopo
f2eba715b4 i should shift righwards also when finding double sigil 2019-12-27 13:50:12 +00:00
jesopo
a9c5b1dd83 remove extraneous space in "MONITOR -" command 2019-12-25 01:42:21 +00:00
jesopo
a5e7767f80 refactor nick_regain, also look for NICK/QUIT for regain 2019-12-25 01:41:01 +00:00
jesopo
b2c5ad041c simplify token replace, catch one-char end-of-string tokens 2019-12-21 21:40:44 +00:00
jesopo
2218d4a888 use utils.parse.format_token_replace() in aliases.py 2019-12-21 21:17:08 +00:00
jesopo
bc1c77d8a8 implement standardised $token replacement in utils.parse 2019-12-21 21:16:50 +00:00
jesopo
b0a71f8bb2 don't have [''] as args_split when there's no args (for alias) 2019-12-21 21:16:14 +00:00
jesopo
3c77793490 only look at 329 when it's a channel we know we are in 2019-12-20 22:03:40 +00:00
jesopo
a2ac26c072 use +=timedelta(minutes=1) when calculating next minute
closes #223
2019-12-19 14:02:55 +00:00
jesopo
e458127fb5 move --database/data-dir/log-dir to bot.conf, do some work for diff db engines 2019-12-19 13:56:58 +00:00
jesopo
cfcccdd37b we no longer use DECODE_CONTENT_TYPES 2019-12-18 20:04:14 +00:00
jesopo
1fedaf02bd 'hostmaks' -> 'hostmask' typo in code for !hostmask add 2019-12-18 19:36:52 +00:00
jesopo
ddcf54e751 add kwarg name replacements to aliases.py, use it for $NICK$ 2019-12-17 14:30:14 +00:00
jesopo
00a8129634 pass user on get.command events, so e.g. aliases know user nicknames 2019-12-17 14:29:37 +00:00
jesopo
cc02595056 move internal.identified event call to _has_identified (covers hostmasks and
nickserv)
2019-12-14 21:40:49 +00:00
jesopo
f6273a5a67 "_match" -> "_schedule_match_part" typo 2019-12-13 17:16:02 +00:00
jesopo
8bf6db7fe5 use zip() instead of enumerate() and indexing 2019-12-12 12:10:08 +00:00
jesopo
e58e5e0691 more brackets in blob of math, just in case 2019-12-12 12:07:42 +00:00
jesopo
2084285480 support cron schedule range values 2019-12-12 12:06:02 +00:00
jesopo
48bab203bf comma-separated cron schedule check should be first 2019-12-12 12:02:27 +00:00
jesopo
80f0a3d94c refector cron.py and support comma-separated schedule pieces 2019-12-12 12:00:27 +00:00
jesopo
60db9ff389 first draft on cron module 2019-12-11 15:43:17 +00:00
jesopo
ff050b3583 send.stdout should default to thinking it is in-channel 2019-12-11 11:19:42 +00:00
jesopo
5a2905de01 allow Request objects to specify their timeout 2019-12-11 11:18:19 +00:00
jesopo
6f8338b7b5 allow users to set command-method for PMs with them 2019-12-10 17:11:44 +00:00
jesopo
b4b998b7d4 default command responses in PM to use NOTICE 2019-12-10 16:59:00 +00:00
jesopo
cffbcad430 support bot-wide aliases with !balias
closes #212
2019-12-10 11:28:09 +00:00
jesopo
734aec179f move aliases.py to core_modules 2019-12-10 11:23:34 +00:00
jesopo
a3bde5e682 fix ModuleManager.find_module() - don't set path until it's actually found 2019-12-10 11:08:44 +00:00
jesopo
58c09f7342 fix typos, type hinting and missed changes in ModuleManager 2019-12-10 05:32:55 +00:00
jesopo
638eee0d68 move core modules to src/core_modules, make them uneffected by white/black list 2019-12-10 05:27:35 +00:00
jesopo
9d16f7d523 move sys.exit() codes to an enum in utils.consts 2019-12-10 05:26:16 +00:00
jesopo
3028759c86 use get_list and set_list to move dynamic module en/disabling to bot.conf 2019-12-07 11:07:43 +00:00
jesopo
3bf2f86702 added get_list() and set_list() to src/Config.py 2019-12-07 11:05:32 +00:00
jesopo
e08bac9312 add src/Config.py.__delitem__ 2019-12-07 11:05:13 +00:00
jesopo
a98dc6e0a6 add src/Config.py.__setitem__ 2019-12-07 10:51:04 +00:00
jesopo
fc069d6da2 fix src/Config.py type hinting 2019-12-07 10:50:50 +00:00
jesopo
7274d1bf28 add ability to save config file 2019-12-07 10:42:43 +00:00
jesopo
374cc307b1 remove -m/-M and BaseModule.command_line - it doesn't work any more 2019-12-07 10:23:17 +00:00
jesopo
b212714561 Revert "add utils.parse.shortencode() and utils.parse.shortdecode - effectively base62"
This reverts commit e71f3bbc36.
2019-12-06 14:29:26 +00:00
jesopo
e71f3bbc36 add utils.parse.shortencode() and utils.parse.shortdecode - effectively base62 2019-12-06 12:10:41 +00:00
jesopo
b889a9f841 add utils.http.Session object, to preserve cookies across requests 2019-12-03 13:00:43 +00:00
jesopo
499e83a1cb refactor karma to be per-user. added data migration script for this 2019-12-01 07:07:28 +00:00
jesopo
3ce947bb77 add database.users.get_nickname, to get nickname from ID 2019-12-01 07:05:17 +00:00
jesopo
b385323386 fix database.user_settings.find logic 2019-12-01 07:05:01 +00:00
jesopo
91c3688018 only add BufferLine to buffer *after* received.message.* callback 2019-11-30 20:25:52 +00:00
jesopo
d688636909 rework permissions module to precompile hostmasks 2019-11-30 19:32:38 +00:00
jesopo
411f66324d use ANSI_RESET in utils.irc.parse_format, not all the different resets 2019-11-28 15:42:12 +00:00
jesopo
c79bd6d0ba utils.http.Response.decode() should default to detected encoding 2019-11-28 07:35:16 +00:00
jesopo
747ba5c646 add IRCLine.parse_human() to allow for "!raw /msg jesopo hello" 2019-11-27 17:38:17 +00:00
jesopo
40a459a83c add Buffer.get_all 2019-11-27 12:59:50 +00:00
jesopo
2139c99562 fix BufferLine.notes definition 2019-11-27 12:59:36 +00:00
jesopo
710b711c70 dataclass-ify IRCBuffer.BufferLine, add .notes={} 2019-11-27 12:07:15 +00:00
jesopo
9972125b24 remove IRCBuffer.skip_next (not used), pass buffer lines on message events 2019-11-27 12:06:57 +00:00
jesopo
e4a5bd01e9 explicitly use "lxml" for finding page encoding 2019-11-26 14:34:48 +00:00
jesopo
8e9da0d681 _find_encoding takes bytes and soupifies now 2019-11-26 13:58:37 +00:00
jesopo
c898bc4be1 utils.http.request_many() shouldn't decode data for Response 2019-11-26 13:54:17 +00:00
jesopo
2d21dfa229 utils.http.Response.data should always be bytes - add .decode and .soup 2019-11-26 13:42:01 +00:00
jesopo
ed775ddbe3 remove parser from utils.http.Request, add Request.soup() 2019-11-26 11:35:56 +00:00
jesopo
93aea08818 utils.datetime.datetime_utcnow() -> utils.datetime.utcnow() 2019-11-25 18:18:09 +00:00
jesopo
6a6e789ec9 add cookies and .json() to utils.http.Response objects 2019-11-25 18:17:30 +00:00
jesopo
ab8bc65cc9 change utils.http.Request to be a dataclass 2019-11-25 13:42:10 +00:00
jesopo
5730d6fe59 refactor commands (mostly stdout/stderr) and split typing/reply out
closes #208
2019-11-22 16:23:30 +00:00
jesopo
2dfc55fb9f refactor permissions and allow hostmasks to be assigned to accounts 2019-11-21 15:49:08 +00:00
jesopo
9f8c5acf52 add a way to execute commands through bitbotd (use for master-password) 2019-11-21 10:39:26 +00:00
jesopo
4d30263315 give bitbot a unique User-Agent
closes #206
2019-11-20 14:42:34 +00:00
jesopo
11c3104d02 move things like IRCBot.VERSION to before imports (for utils.http) 2019-11-20 14:41:14 +00:00
jesopo
bd176240d6 consecutive HASH_STOP chars at start shouldn't count as a stop 2019-11-19 14:45:47 +00:00
jesopo
554f21a84c HASH_STOP should still be respected if last character 2019-11-19 14:43:24 +00:00
jesopo
bc6b1dda47 chance src/Cache.py from time.monotonic() to time.time() 2019-11-19 11:41:50 +00:00
jesopo
65023dc84b move "+5m" syntax parsing out to utils.parse 2019-11-18 15:57:23 +00:00
jesopo
fe25c6bc26 switch some utils.irc functions to use f-strings 2019-11-18 14:16:30 +00:00
jesopo
d89a3125ab truncate nickname hash operations to 64bit 2019-11-18 14:09:47 +00:00
jesopo
a8b1bd95f7 implement weechat-style djb2 colour hashing 2019-11-18 13:51:55 +00:00
jesopo
a7e21abfad import missing comma, 'Events'->'Event' 2019-11-18 12:10:20 +00:00
jesopo
06161b326c remove unused imports in src/utils/__init__.py 2019-11-18 12:09:18 +00:00
jesopo
9c4902dcfe "EventsResultsError"->"EventResultsError", move errors to utils.error 2019-11-18 12:06:59 +00:00
jesopo
5d55086847 move utils.consts.BITBOT_MAGIC to utils.decorators 2019-11-15 14:09:35 +00:00
jesopo
5d01db8514 move all datetime-related code from utils/__init__ to utils.datetime 2019-11-15 13:59:09 +00:00
jesopo
5e8cf06a45 dont expose has_magic/get_magic in utils/__init__.py, ref directly 2019-11-15 13:41:03 +00:00
jesopo
bfcf40edd7 split some stuff out of utils/__init__.py 2019-11-15 13:39:24 +00:00
jesopo
2cb55306c3 show first-words datestamp on !words output 2019-11-15 12:13:16 +00:00
jesopo
c9cb8c8805 set info log rolling backup count to 1 (0 means "keep all backups") 2019-11-14 13:35:23 +00:00
jesopo
a1e9aabb84 add typehinting for foreground/background 2019-11-13 10:47:58 +00:00
jesopo
5d2dd9178f only set color_finished=True when is_background, otherwise next char sets it 2019-11-13 10:43:15 +00:00
jesopo
8a8bd8a77e colorize nicks on JOIN formatting 2019-11-11 12:49:45 +00:00
jesopo
b7bfd414be hash_colorize code should first be looked up in HASH_COLORS 2019-11-11 12:48:37 +00:00
jesopo
727fb3427d .lower() strings when hash-colorizing them 2019-11-11 12:40:36 +00:00
jesopo
ac30f8d4cc don't use hash() for hashed colorising as it's not stable through restarts 2019-11-11 12:13:46 +00:00
jesopo
2ad8623eb3 add utils.irc.hash_colorize() to color a string by the string's hash 2019-11-11 12:06:16 +00:00
jesopo
98183fe4b9 add IRCArgs.append func 2019-11-08 17:41:18 +00:00
jesopo
5fcf18313e silently eat Control socket .send() failures 2019-11-08 13:38:07 +00:00
jesopo
09fe1c5a70 don't stop parsing colors at comma 2019-11-04 13:33:10 +00:00
jesopo
bcdffacab5 add on_pause() and on_resume() for module - use in rest_api.py 2019-11-04 10:52:41 +00:00
jesopo
2b001e1ec6 ' ' -> " " 2019-10-31 13:06:26 +00:00
Valentin Lorentz
fbf8cd1a16 Fix type errors detected by 'mypy --ignore-missing-imports src'. 2019-10-30 22:26:59 +01:00
jesopo
9958c9169d fix _line() related type hinting issues in IRCServer.py 2019-10-30 13:46:29 +00:00
jesopo
3634b72622 add utils.date_human() - use it in badges.py 2019-10-30 10:25:07 +00:00
jesopo
4d85c3d1e0 utils.parse doesn't need to import utils 2019-10-29 18:03:03 +00:00
jesopo
080bcef3a0 'from src.utils import' -> 'from . import' 2019-10-29 18:02:50 +00:00
jesopo
9b349f8cc0 move typing.Callable def so Event doesn't have to be in " " 2019-10-29 18:00:59 +00:00
jesopo
40a340e94f utils.cli shouldn't know about Database 2019-10-29 18:00:38 +00:00
jesopo
46e4b75f6b utils.irc doesn't need to know about the whole of utils 2019-10-29 18:00:19 +00:00
jesopo
9f48dfb1f1 send_mode() args is already a list 2019-10-29 10:23:47 +00:00
jesopo
8983338680 move src/utils/irc/__init__.py to src/utils/irc.py 2019-10-28 10:57:19 +00:00
jesopo
7ee65f8f8c remove src/utils/irc/protocol.py 2019-10-28 10:56:33 +00:00
jesopo
1bddc3b37f Revert "remove unneeded import"
This reverts commit 8425c11c97.
2019-10-27 10:32:13 +00:00
jesopo
8425c11c97 remove unneeded import 2019-10-27 10:25:37 +00:00
jesopo
8f4b5a0e70 move IRCLine related code from utils.irc to IRCLine.py 2019-10-27 10:19:00 +00:00
jesopo
3a755bb15f don't consume past 2nd digit in e.g. "\03033,123" 2019-10-25 17:12:24 +01:00
jesopo
877287291a reason arg of panic() shouldn't be optional, detect current exception 2019-10-25 14:31:09 +01:00
jesopo
b3f43a6721 remove bot.panic() throw kwarg 2019-10-25 14:27:12 +01:00
jesopo
226ebe1f1f DEBUG log IRCBot.connect failure stacktrace 2019-10-25 14:18:22 +01:00
jesopo
7d4c6b6941 bot.panic() should just call sys.exit() 2019-10-25 14:14:30 +01:00
jesopo
9d1b640db4 re-add list moving CAP objects from capability_queue to capabilities_requested 2019-10-25 11:52:11 +01:00
Valentin Lorentz
d8c48fa98f Make send_capability_queue split 'CAP REQ' message based on string length.
Instead of sending caps by groups of 10.
2019-10-23 21:20:56 +02:00
jesopo
062290704c explicitly break event loop on Kill 2019-10-22 14:26:40 +01:00
jesopo
00e85c7573 bitbotctl stop should be keepalive so it exits when bitbotd exits 2019-10-18 11:29:59 +01:00
jesopo
f64131a10f support utf8 hostnames by punycode (idna) encoding 2019-10-18 10:58:24 +01:00
jesopo
a1b8a4033a hook_handler should be catching TRACE logging 2019-10-17 17:49:49 +01:00
jesopo
aa2511baaa add IRCBot.stop() - use it for !shutdown and './bitbotctl stop' 2019-10-17 16:53:48 +01:00
jesopo
417c4f302e default to using a "data directory" for bitbot (~/.bitbot/) 2019-10-17 12:39:56 +01:00
jesopo
b895958f09 remove debug prints from IRCBot 2019-10-15 16:16:29 +01:00
jesopo
aa3906dfa3 fix type linting issues for client in Control.is_readable 2019-10-14 18:17:15 +01:00
jesopo
88ffa421c1 add bitbotctl reload command to reload all modules 2019-10-14 14:52:58 +01:00
jesopo
99b4663ce7 run Control callbacks on main thread
closes #180
2019-10-14 14:51:53 +01:00
jesopo
e50290046a remove safe arg from ModuleManager.load_modules() - try_reload_modules covers this now 2019-10-14 13:02:16 +01:00
jesopo
a9111c7241 add ModuleManager.try_reload_modules(), to try reloading in a transaction
if any of the modules fails to reload, rollback and use the already loaded modules. closes #179
2019-10-14 12:56:04 +01:00
jesopo
4940aff877 refactor out chosing loadable modules in to _list_valid_modules() 2019-10-14 11:37:04 +01:00
jesopo
2ca702b787 don't have version 'v' prefix in VERSION 2019-10-11 17:27:36 +01:00
jesopo
82f77472c6 'test_handler' -> 'hook_handler' 2019-10-11 17:17:43 +01:00
jesopo
14f5ec38ed hold current version in it's own file: VERSION 2019-10-11 17:03:14 +01:00
jesopo
85a8ddf2d1 kill bitbotctl connection after rehash 2019-10-11 15:58:47 +01:00
jesopo
6a4cdabc93 add "rehash" bitbotctl command 2019-10-11 15:54:43 +01:00
jesopo
22b6a19054 try/except Control socket writes 2019-10-11 15:16:39 +01:00
jesopo
de389b34b8 add first real cli functionality: showing log 2019-10-11 15:12:26 +01:00
jesopo
cefde48e42 first draft of infrastructure for unix domain control socket 2019-10-11 14:00:26 +01:00
jesopo
daeb37226a LockFile doesn't need to hold on to _database_location 2019-10-11 14:00:02 +01:00
jesopo
175f90f6a2 add "poll sources" - objects that can provide additional filenos for polling 2019-10-11 13:59:28 +01:00
jesopo
b7b045eadb Don't exit when there are no connected servers
closes #175
2019-10-11 13:06:52 +01:00
jesopo
fd0baff093 only .call() PollHooks when they're "due" 2019-10-10 14:12:58 +01:00
jesopo
1c792f0194 move PoolHook registrations to start.py 2019-10-10 13:58:45 +01:00
jesopo
e624292608 v1.12.0 release 2019-10-10 13:36:55 +01:00
jesopo
a2b73469e6 v1.12.0-rc2 release 2019-10-10 12:43:19 +01:00
jesopo
5be01a45c4 'server.conncect_time' -> 'server.connect_time' 2019-10-10 12:31:24 +01:00
jesopo
2c19bdb949 add a fairly basic file locking mechanism with src/LockFile.py
closes #96
2019-10-10 12:11:03 +01:00
jesopo
0331b763ff refactor multi-line-to-line normalisation to utils.parse.line_normalise(), use it in rss.py
closes #174
2019-10-10 10:33:18 +01:00
jesopo
51a4a4253c -V command line arg should still effect stdout 2019-10-09 17:54:12 +01:00
jesopo
f721cf848a stdout output should just be WARN - put INFO in to a daily file
this is because stdout, in something like systemd, will mess up journalctl output.
2019-10-09 17:36:17 +01:00
jesopo
ab2701837c we should be catching timer as the output of self._timers.add 2019-10-09 12:47:03 +01:00
jesopo
a0870ad118 v1.12.0-rc1 release 2019-10-09 12:42:22 +01:00
jesopo
6ee2b6cf27 self.timers -> self._timers 2019-10-08 21:51:58 +01:00
jesopo
f8662ad6e1 fix IRCChannel.topic_setter type hint 2019-10-08 14:55:46 +01:00
jesopo
7a5edccb98 transient timers shouldn't use the event system 2019-10-08 13:49:55 +01:00
jesopo
4c02c7c86a refactor anything that effects event poll timeout in to PollHook objects 2019-10-08 12:20:08 +01:00
jesopo
68aa89f16f commit FunctionSetting changes i forgot to commit yesterday 2019-10-08 11:38:56 +01:00
jesopo
257042ac2c combine find_user_settings() and find_user_settings_prefix() 2019-10-07 12:51:44 +01:00
jesopo
50d1eb6b8c combine find_setting() and find_setting_prefix() on user/channel/server/bot 2019-10-07 12:46:52 +01:00
jesopo
9ab817ca58 parse out content_type in Response ctor 2019-10-05 22:56:56 +01:00
jesopo
b2473a4ac4 parse content-type out in utils.http.request, put it on Response object 2019-10-04 13:07:09 +01:00
jesopo
3466a3c43e Allow utils.Setting_ parse functions to throw detailed errors 2019-10-04 10:25:48 +01:00
jesopo
f306213cb8 'is_localhost()' -> 'host_permitted()' 2019-09-30 15:15:20 +01:00
jesopo
b9c64b7cf1 use ipaddress is_loopback etc to do better forbidden ranges
closes #87
2019-09-30 15:12:01 +01:00
jesopo
8480309db2 only _kill() when there's no servers *and* the event queue is empty
this is so that bitbot doesn't exit when you !reconnect but only have 1 server
2019-09-30 11:52:07 +01:00
jesopo
a42a196720 only return IRCUser.hostmask() when all needed pieces are available 2019-09-27 16:21:59 +01:00
jesopo
82173a7d94 add external_modules directory 2019-09-27 16:03:06 +01:00
jesopo
16ba52f5dc forgot to commit kwargs for get_user() 2019-09-27 15:52:25 +01:00
jesopo
7db17c0962 add utils.parse.try_int() because .isdigit() isnt good enough 2019-09-26 13:44:38 +01:00
jesopo
accd127ce5 add IRCBuffer.find_many_from() 2019-09-26 13:44:21 +01:00
jesopo
2f49fb99e9 assume http fallback_encoding by content-type (utf8 for json) 2019-09-25 15:32:09 +01:00
jesopo
47d38c7d18 refactor all checks for channel_type to server.is_channel() 2019-09-20 14:52:41 +01:00
jesopo
72649a90c2 only BeautifulSoup for finding encoding when it's a html-ish type 2019-09-20 13:38:00 +01:00
jesopo
d609bfb16d cache calculated "next expiration" time 2019-09-20 11:47:57 +01:00
jesopo
efc0e197e5 Allow passing source Hostmask to IRCBatch 2019-09-19 18:16:10 +01:00
jesopo
e34259f967 log call was replaced with Exception but [] on args remained 2019-09-19 15:30:27 +01:00
jesopo
88a69aaa66 give Requests, use them in utils.http.request_many() 2019-09-19 14:54:44 +01:00
jesopo
d8e3a1c7ee utils.http.request_() has no self, let alone self.log 2019-09-19 14:02:48 +01:00
jesopo
b69c9146b2 should be using pair_start/pair_end throughout for 2019-09-19 13:51:27 +01:00
jesopo
cd0d39ee5e also show "bad" data in HTTPParsingException when a message is provided 2019-09-18 14:20:59 +01:00
jesopo
312f8906ae show "bad" data in HTTPParsingException message 2019-09-18 10:52:05 +01:00
jesopo
a003c97fba move q.close() to where it will be called even if deadline is hit 2019-09-18 10:24:01 +01:00
jesopo
dce6eee8c9 move _raise_deadline() out of except block to clean up printed stacktrace 2019-09-18 10:21:40 +01:00
jesopo
ee6360be22 don't check already-read data when checking for too-large requests
this check was here because the first read will return empty if it was an
invalid byte sequence for e.g. gzip because we needed to receive more data. the
second read will always return data (not decoded) so regardless of what the
already-read data is, the second read is the only criteria we need.
2019-09-17 17:33:23 +01:00
jesopo
1ac7f2697e log which URL caused an error in request_many 2019-09-17 17:09:19 +01:00
jesopo
98545a9fb4 only decode content-types in DECODE_CONTENT_TYPES 2019-09-17 16:12:03 +01:00
jesopo
8ca0d30fef Response.__init__() needs encoding now 2019-09-17 14:11:12 +01:00
jesopo
b7dd78ef1a restore 5 second (instead of default 10) deadline for http.request 2019-09-17 13:44:14 +01:00
jesopo
94c3ff962b use utils.deadline_process() in utils.http._request() so background threads can
call _request()
2019-09-17 13:41:11 +01:00
jesopo
fa95eaa9eb add .get() to CaseInsensitiveDict 2019-09-17 13:40:37 +01:00
jesopo
d454f9b732 use Queue.get() with timeout, not Process.join() for timeout
this was because the threads spawned by multiprocessing.Queue seemed to be
making Process.join() believe the subprocess had not exited.
2019-09-17 13:39:23 +01:00
jesopo
1ed14f9a17 first draft of multiprocess.Process deadline system 2019-09-17 11:56:30 +01:00
jesopo
c23530be89 add missing IRCLine import to IRCChannel 2019-09-17 10:21:31 +01:00
jesopo
334d580c57 'seperate_hostmask()' -> 'parse_hostmask()' 2019-09-16 18:43:57 +01:00
jesopo
03892d0ae3 topic_setter should be stored as a Hostmask 2019-09-16 18:38:46 +01:00
jesopo
a48aececfd EventRoot._hook's kwarg should be a list of tuples 2019-09-16 15:34:34 +01:00
jesopo
47735421b8 add json_body arg to Request to json-encode body, only return from body if
not null
2019-09-16 10:57:18 +01:00
jesopo
f9d13dc373 support '0' as an IntSetting value 2019-09-15 22:22:30 +01:00
jesopo
60ced118a0 get_user_status() -> get_user_modes(), filter in format_activity.py 2019-09-12 22:39:21 +01:00
jesopo
d950eb3660 add utils.SensitiveSetting, to .format() hide value 2019-09-12 12:17:31 +01:00
jesopo
ba0911f2e7 add utils.Setting.format() so subtypes can format differently 2019-09-12 12:17:09 +01:00
jesopo
9d33354d16 translate INVITE from [channel_name, target] to [target, channel_name] 2019-09-12 11:24:25 +01:00
jesopo
540c7b8c44 Revert "INVITE should be [channel_name, target]"
This reverts commit f3d8ffad2c.
2019-09-12 11:23:29 +01:00
jesopo
f3d8ffad2c INVITE should be [channel_name, target] 2019-09-12 11:21:29 +01:00
jesopo
77f50187c5 allow Requests to specify a useragent 2019-09-12 10:41:50 +01:00
jesopo
2c5a2d9db3 add IRCChannel.send_invite() 2019-09-12 10:24:02 +01:00
jesopo
2bd7d591c3 Revert "add IRCBot.http_client(), to allow modules to override default http client"
This reverts commit 81347fbba0.
2019-09-11 18:08:44 +01:00
jesopo
81347fbba0 add IRCBot.http_client(), to allow modules to override default http client 2019-09-11 17:54:24 +01:00
jesopo
9d6a3982ed add a helper utils.http.Client static object 2019-09-11 17:53:49 +01:00
jesopo
51dc26d113 add proxy to Request objects 2019-09-11 17:53:37 +01:00
jesopo
4a97c9eb0d refactor utils.http.requests to support a Request object 2019-09-11 17:44:07 +01:00
jesopo
8f8cf92ae2 automatically decode certain http content types 2019-09-11 15:28:13 +01:00
jesopo
8d8d9219b8 don't return "+" when a channel has no modes 2019-09-10 15:10:14 +01:00
jesopo
a9b106c6be Don't try to .decode non-html things, default iso-lat-1 for non-html too 2019-09-09 16:17:26 +01:00
jesopo
b83f5d9e30 add flag to disable encoding detection 2019-09-09 14:59:08 +01:00
jesopo
5ef2b7af27 'str.split' -> 's.split' 2019-09-09 14:53:11 +01:00
jesopo
1df82c1cb2 still default to iso-latin-1 if no on-page or in-header content-type is present 2019-09-09 14:48:26 +01:00
jesopo
0a67659637 only look for <meta>-related tags when there are meta tags 2019-09-09 14:39:19 +01:00
jesopo
0a1077c5cd add explicit None return for _find_encoding (mypy) 2019-09-09 14:25:01 +01:00
jesopo
ff9c82bf67 change utils.http.request to best-effort detect on-page encoding
closes #113
2019-09-09 14:11:18 +01:00
jesopo
dadefeb8f3 remove try-rejoin (on 477) logic. will move to a module later 2019-09-07 15:21:35 +01:00
jesopo
d973b547e1 add a create flag to IRCChannels.get_id() to optionally not create new ids 2019-09-05 14:13:58 +01:00
jesopo
d7ae182428 cache when a setting isn't set but don't cache "default" value 2019-09-04 15:26:36 +01:00
jesopo
473c2723e7 only cache get_setting value when it's not the default value 2019-09-04 15:24:50 +01:00
jesopo
007bb78d30 make utils.from_pretty_time() format much stricter 2019-09-04 11:22:56 +01:00
jesopo
397cfa8e7e correctly qualify DeadlineExceededException namespace 2019-09-03 14:54:59 +01:00
jesopo
b7b2f31c1c use utils.deadline() in utils.http.request, not raw sigalrm 2019-09-02 15:50:21 +01:00
jesopo
d42d694e64 move deadline alarm time check inside try/finally 2019-09-02 15:50:12 +01:00
jesopo
a160148c2f actually prune non-loadable modules before doing dependency checks 2019-09-02 15:46:31 +01:00
jesopo
43a7b7d949 add basic caching logic for channel settings 2019-09-02 14:07:39 +01:00
jesopo
7959f1ab88 change Cache.py to be key:value 2019-09-02 14:07:26 +01:00
jesopo
9cc1ee98eb Pass the content of a webpage to HTTPParsingException 2019-09-02 13:27:44 +01:00
jesopo
408b89aeb7 use \S+ for url regex (for non-ascii chars), use url_sanitize to catch <> 2019-09-02 13:25:48 +01:00
jesopo
9e43ea1599 add per-user fediverse setting 2019-09-02 08:51:56 +01:00
jesopo
19d8f0b497 store and expose reconnection timers on IRCBot.reconnections 2019-09-01 08:38:22 +01:00
jesopo
6a068777d6 v1.11.1 release 2019-08-30 19:10:17 +01:00
jesopo
722d6418c8 switch to using signal.setitimer so we can restore previous timer 2019-08-30 18:36:48 +01:00
jesopo
a57a06b1cc switch utils.deadline to a context manager 2019-08-30 18:13:12 +01:00
jesopo
e97e3c8f30 add utils.deadline(func, seconds) to put hard limits on code exec time 2019-08-30 17:17:03 +01:00
jesopo
4bfb4c3200 Add IntRangeSetting, reorder OptionsSetting arg order 2019-08-30 14:40:54 +01:00
jesopo
2c812ccaaa Logging.BitBotFormatter no longer uses the format it's given (always iso8601) 2019-08-30 13:46:21 +01:00
jesopo
58a4fd7e74 round microseconds up to a whole number and zero-pad to 3 chars 2019-08-30 13:46:00 +01:00
jesopo
d3ed08e336 Don't use 'Z' for "utc timezone" - actually parse timezone out of datetimes 2019-08-30 13:25:19 +01:00
jesopo
b037c3076f v1.11.0 release 2019-08-15 13:45:54 +01:00
jesopo
61eeba0cb9 should only return a BufferLineMatch when we actually match 2019-08-15 13:45:04 +01:00
jesopo
195cb66e26 Update CHANGELOG.md, bump version to v1.11.0-rc3 2019-08-14 15:17:01 +01:00
jesopo
814236915b forgot to update IRCBot.VERSION to v1.11.0-rc2 2019-08-13 15:11:43 +01:00
jesopo
03c7e8f066 return matching string from buffer.find() as most uses were redundantly regexing 2019-08-13 13:48:03 +01:00
jesopo
0f4a4d04a1 v1.11.0-rc1 release 2019-08-09 15:02:10 +01:00
jesopo
b6361ba4e3 Remove extraneous space 2019-08-07 14:00:56 +01:00
jesopo
20042edfd9 Allow bypass of content-type check in utils.http.request 2019-08-05 15:41:02 +01:00
jesopo
d093027431 not all HTTP responses have content-type 2019-08-02 17:33:16 +01:00
jesopo
dd8b276b35 pull priority out of kwargs in _hook 2019-07-30 15:24:13 +01:00
jesopo
27a6078f20 Revert "hook priority position should default to 0, not end"
This reverts commit ff0cc59507.
2019-07-30 15:23:13 +01:00
jesopo
5ffe2941e8 Revert "we should be checking if the new hook has a higher priority"
This reverts commit b145e664e1.
2019-07-30 15:23:05 +01:00
jesopo
b145e664e1 we should be checking if the new hook has a higher priority 2019-07-30 15:12:29 +01:00
jesopo
ff0cc59507 hook priority position should default to 0, not end 2019-07-30 15:09:34 +01:00
jesopo
793fc94ea3 source should have ':' appended 2019-07-28 20:55:54 +01:00
jesopo
ad8f66c00e Remove debug print 2019-07-28 18:14:44 +01:00
jesopo
163e979f95 move socket creation to it's own function, send event just prior to .connect 2019-07-28 18:07:23 +01:00
jesopo
9827feeabd 'name' -> 'key' (copypaste fail) 2019-07-28 18:07:01 +01:00
jesopo
25b507e80c Refactor hook kwargs to be stored as a list of tuples to support key duplicates
closes #108
2019-07-28 12:35:04 +01:00
jesopo
77dfc76591 switch to function/module magic being a single object 2019-07-26 11:58:06 +01:00
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