Commit graph

1158 commits

Author SHA1 Message Date
jesopo
f3ac154fe2 add ModuleManager.try_reload_module(), use it for !reloadmodule 2020-02-09 10:17:40 +00:00
jesopo
94197b33a2 insert new hooks at the start of their priority, to prevent duplicates on reload 2020-02-09 10:14:14 +00:00
jesopo
98bfc4db95 transfer stdout/stderr _assured to IRCLine.assured 2020-02-09 00:54:13 +00:00
jesopo
732a0b77eb should be checking for "*" in user_access 2020-02-09 00:53:59 +00:00
jesopo
4e9df2c552 handle git being in a detached head state when getting current commit 2020-02-08 13:21:29 +00:00
jesopo
de7d35015e spec[2] is a string, not an array of strings 2020-02-08 11:00:31 +00:00
jesopo
3c6eb6f8e7 update ignore.py to use command spec (and not docstrings) 2020-02-07 12:48:37 +00:00
jesopo
39db6dea55 update modules.py to use command spec (and not docstrings) 2020-02-07 12:42:47 +00:00
jesopo
a19f6304c5 update admin.py to use command spec (and not docstrings) 2020-02-07 10:36:25 +00:00
jesopo
29fdc3ce53 regression: readd lost USERPASS SASL meta-mechanism 2020-02-07 00:14:05 +00:00
jesopo
d588760fc4 update other modules to use categorised require_access 2020-02-07 00:11:28 +00:00
jesopo
fe1c9ef746 allow multipe require_accces (comma sep), support "low"/"high"/"admin" 2020-02-06 23:50:19 +00:00
jesopo
822a44570c accept "1"/"0" as "true"/"false" for !config 2020-02-06 17:58:29 +00:00
jesopo
ceb0a19679 typo in !hostmask, 'spect' -> 'spec' 2020-02-06 16:52:26 +00:00
jesopo
c0af477373 add Database.users.by_id() 2020-02-06 16:40:20 +00:00
jesopo
f52a824ffb fix SpecTypeArgumentDate simple() 2020-02-06 16:40:02 +00:00
jesopo
01441efe75 only pull 'charset' from <meta> content-type when it definitely exists 2020-02-06 11:54:04 +00:00
jesopo
5bbae499d1 chghost events no longer have 'username'/'hostname' kwargs 2020-02-05 18:21:08 +00:00
jesopo
fc83d4fe50 move !alias variables in to alias_variables.py, add RNICK (random nick) 2020-02-05 18:18:32 +00:00
jesopo
11e2475d52 aliases.py get.command doesn't need to be PRIORITY_URGENT 2020-02-05 18:06:30 +00:00
jesopo
460cda87bb add command spec type "words" - array of remaining words 2020-02-05 16:32:41 +00:00
jesopo
c4136a50ec refactor -b/-q/-m timer logic in to 1 function 2020-02-05 16:29:07 +00:00
jesopo
87bc9bab9e is8601_format_now() -> iso8601_now() 2020-02-05 10:15:57 +00:00
jesopo
8e611c451e switch module whitelist/blacklist to its own config file 2020-02-04 15:31:17 +00:00
jesopo
150148b4e0 INFO log on successful SASL authentication 2020-02-03 23:22:04 +00:00
jesopo
e79e3f0315 set username and hostmask on chghost before event dispatch 2020-02-03 23:13:57 +00:00
jesopo
96a74747dc implement !modinfo
closes #234
2020-02-03 23:01:36 +00:00
jesopo
7a15e5b2bf store timestamp and current git commit when loading a module 2020-02-03 23:00:53 +00:00
jesopo
b713cf7659 init usages variable, for the case that there's no usage 2020-02-03 10:37:27 +00:00
jesopo
30aadda093 ratify labeled-response 2020-02-03 10:23:12 +00:00
jesopo
7105ba01de also detect encoding for http.request_many() 2020-01-31 11:40:17 +00:00
jesopo
5d3e1ea492 add 'date' command spec type 2020-01-30 21:21:12 +00:00
jesopo
d0d5cc4d08 split utils.datetime out in to .parse and .format 2020-01-30 21:20:56 +00:00
jesopo
1674ef325b add utils.datetime.seconds_since(); compare utcnow to datetime 2020-01-30 14:58:32 +00:00
jesopo
82d20869e1 actually use count (for best_count), dont +=1 spec arg for non-consume 2020-01-30 14:57:40 +00:00
jesopo
73aeb6bde4 add IRCBuffer.find_all() 2020-01-30 14:57:24 +00:00
jesopo
b296a2df05 add IRCBuffer.BufferLine.format() - /me vs message formatting 2020-01-30 14:56:57 +00:00
jesopo
5fb3057814 bump IRCBuffer MAX_LINES to 1024 2020-01-30 14:55:30 +00:00
jesopo
c9d07b6032 make sure we always have a channel when require_mode/access is present 2020-01-30 11:50:57 +00:00
jesopo
49f14caf42 support different Config names 2020-01-30 11:50:40 +00:00
jesopo
e6d0cba63b update aliases.py to use command specs 2020-01-29 17:56:42 +00:00
jesopo
338e1864d7 non-present optional args should still be in the spec as None 2020-01-29 17:55:13 +00:00
jesopo
616eb84264 add "lstring" command spec; "last string" - explicit args or last message 2020-01-29 17:15:54 +00:00
jesopo
c1543ed899 SpecArgumentTypeString should return None when no args 2020-01-29 17:04:17 +00:00
jesopo
67aa90fc94 move "dont unload core modules" to where it won't affect reloads 2020-01-28 16:25:15 +00:00
jesopo
63d2c16954 change "non-consuming spec arg" character from "=" to "-" 2020-01-28 15:42:56 +00:00
jesopo
0744f8b63a refuse to unload core modules 2020-01-28 15:27:13 +00:00
jesopo
a35ed3c6ea use dateutil.relativedelta for to_pretty_time, to cover years/months 2020-01-28 12:33:27 +00:00
jesopo
499a03a0ad add module name collision check to before import and hooks 2020-01-28 10:20:52 +00:00
jesopo
7241027ff7 fix privateonly/channelonly - True or None, not True or False 2020-01-28 01:32:27 +00:00
jesopo
d95f5362bf date permissions module to use command spec args 2020-01-28 01:23:40 +00:00
jesopo
f3c31ec3c1 fix support for non-consuming command spec args 2020-01-28 01:23:19 +00:00
jesopo
7397e36837 add data_directory() func to BaseModule, to get path to data file 2020-01-27 23:22:45 +00:00
jesopo
b4deae3e2d store .data_directory on bot object 2020-01-27 23:22:23 +00:00
jesopo
4cffeae132 forgot to change usage to usages_kwarg 2020-01-27 15:03:40 +00:00
jesopo
65b992e238 allow spec arguments to be "non-consuming" (doesn't show up in usage) 2020-01-27 12:13:28 +00:00
jesopo
d7cc7781bd add 'int' command arg spec type 2020-01-27 12:13:10 +00:00
jesopo
d438b6dbc9 add "additional word" (aword) command arument spec type 2020-01-27 11:57:23 +00:00
jesopo
dc4adc4d71 add non-consuming spec arg types for privateonly and channelonly 2020-01-27 00:28:30 +00:00
jesopo
2f5e2a8345 .append() doesn't work on dict, use same code for missing optional 2020-01-26 16:05:32 +00:00
jesopo
223fe9fc7c fix channel_access spec arg indexes 2020-01-26 15:41:04 +00:00
jesopo
ba1800b207 refactor command_spec.py 2020-01-26 15:40:36 +00:00
jesopo
23d3ba5e29 add tstring spec type, string with trimmed consecutive spaces 2020-01-26 11:24:57 +00:00
jesopo
c33f8bbaf8 ?time->?duration, remove now unneeded usage kwarg 2020-01-26 02:52:38 +00:00
jesopo
73ad5c5c1b add nuser spec arg type; to get a user, new or not 2020-01-26 02:51:18 +00:00
jesopo
6c510d2332 add rchannel spec arg to !access 2020-01-26 02:49:20 +00:00
jesopo
184628ddfc we need a fresh mutable args copy for each spec 2020-01-26 02:49:05 +00:00
jesopo
27ba8e8da8 update channel_access.py to use command spec language 2020-01-26 02:41:39 +00:00
jesopo
2ae47364c0 support multiple specs per command 2020-01-26 02:41:24 +00:00
jesopo
41e1115999 fix typehinting issues 2020-01-26 02:09:48 +00:00
jesopo
e0686ef7b4 support command spec literals 2020-01-26 02:01:18 +00:00
jesopo
c3bb46ad23 only show "not enough arguments" n>len(args) 2020-01-26 02:00:43 +00:00
jesopo
b83e066dad show topic timestamp in a more human readable format 2020-01-26 00:49:31 +00:00
jesopo
1d1e2d95a9 split utils/parse.py in to multiple files 2020-01-26 00:06:47 +00:00
jesopo
b24d62c0e6 update !ignore to use command specs 2020-01-25 23:59:00 +00:00
jesopo
ced3bb23da "time" spec arg renamed to "duration" 2020-01-25 23:58:09 +00:00
jesopo
1a8a4ac9d4 support spec arg "context" (e.g. private only), marked exported as private 2020-01-25 23:57:27 +00:00
jesopo
6a3702577f when available, use command spec for !help usage 2020-01-25 23:15:02 +00:00
jesopo
0c28d63822 add utils.parse.argument_spec_human() for usage strings 2020-01-25 22:56:56 +00:00
jesopo
bd33ea5d8a implement default spec argument types 2020-01-25 22:56:06 +00:00
jesopo
478223f88c support type names of spec arguments 2020-01-25 21:17:35 +00:00
jesopo
341b314104 change command specs to be compiled at runtime by a decorator 2020-01-25 14:01:11 +00:00
jesopo
264e544ce5 support !... as "one or more", show "not enough args" error 2020-01-25 11:33:09 +00:00
jesopo
1d9621022c remove debug print 2020-01-25 11:32:49 +00:00
jesopo
5722a567a1 fix format_token_replace for $$ 2020-01-25 11:32:01 +00:00
jesopo
09fa9363b3 support e.g. "!r~channel" spec to change the context of "!cuser" 2020-01-24 17:00:55 +00:00
jesopo
241382fe66 add some comments about all the command_spec spec types 2020-01-24 16:50:25 +00:00
jesopo
e16831cc83 better "!user" spec error 2020-01-24 16:42:23 +00:00
jesopo
f51b06aae1 check "channel" coming from command_spec.py parsing (check_mode, channel_access) 2020-01-24 16:26:53 +00:00
jesopo
f0d8853549 implement "important" command spec pieces, esp. for channel perms 2020-01-24 16:25:50 +00:00
jesopo
def6a019d6 don't args[0] for rchannel when [], better rchannel error 2020-01-24 15:35:05 +00:00
jesopo
47cb5eaab8 utils.parse.timed_args() min_args should be optional 2020-01-24 15:30:32 +00:00
jesopo
4e2f463d39 add ruser/rchannel (r for relevant) to command_spec.py 2020-01-24 15:29:13 +00:00
jesopo
52c3cab627 still append None when an optional spec is missed 2020-01-24 14:27:47 +00:00
jesopo
fa98b72fd5 first draft of command_spec.py 2020-01-24 14:24:54 +00:00
jesopo
a9a9cd816b channel.send_mode() BEFORE calling self.join event 2020-01-24 10:37:41 +00:00
jesopo
cf544d66f9 extraneous newline 2020-01-23 17:41:57 +00:00
jesopo
f6e6dd0339 remove received.server-notice related code 2020-01-23 14:08:58 +00:00
jesopo
d919e5c345 simplify snotice detection, handle as normal NOTICE 2020-01-23 13:10:45 +00:00
jesopo
ab2ed90ef9 set_own_nickname before sending self.nick event 2020-01-23 12:51:18 +00:00
jesopo
4515cf84e1 support WATCH as well as MONITOR nick nick_regain.py 2020-01-23 12:50:58 +00:00
jesopo
022eed84f6 pull mode for RPL_(ENDOF)QUIETLIST from args[2] 2020-01-23 12:34:18 +00:00
jesopo
ef2d80511d only check missed modes if our mode changes and MODE #chan responds 2020-01-23 12:23:27 +00:00
jesopo
cded6b6877 only query missing list modes on MODE when we're seen ENDOFWHO 2020-01-23 12:09:45 +00:00
jesopo
9ac2fe96fe changed failed list modes after ENDOFWHO, not when our mode changes 2020-01-23 11:45:51 +00:00
jesopo
007fd1206c add typehint for IRCChannel.mode_lists 2020-01-22 18:01:22 +00:00
jesopo
2a33b25930 correctly support INVEX and EXCEPTS lists 2020-01-22 17:58:12 +00:00
jesopo
811b85d0f9 move mode list (beIq e.g.) to it's own module, mode_lists.py 2020-01-22 17:41:20 +00:00
jesopo
175e8c0a16 change utils.irc.strip_font() to remove tokens, no regex 2020-01-22 16:32:21 +00:00
jesopo
f79aa036f2 fix hostmask_match_many typehint 2020-01-22 15:04:48 +00:00
jesopo
ade5cbb1f3 add an optional mask pattern arg to !clear 2020-01-22 15:00:59 +00:00
jesopo
64848f5ab7 add a special "require_mode" arg; "highest" meaning "highest mode possible" 2020-01-22 14:12:48 +00:00
jesopo
b6f18f809c add a special "require_mode" arg; "admin" meaning "above op if available" 2020-01-22 14:10:45 +00:00
jesopo
5258b8cc8f typo; 'resaon' -> 'reason' 2020-01-22 12:46:07 +00:00
jesopo
cabc5942b4 server should be IRCServer, not IRCChannels 2020-01-22 12:28:05 +00:00
jesopo
1c5d67f836 parse proposed ISUPPORT QUIET token 2020-01-22 11:19:44 +00:00
jesopo
369160d46f allow requesting utils.irc.color() to not add terminating code 2020-01-21 16:40:01 +00:00
jesopo
c336fdf93b split permission for !alias/!balias in to two 2020-01-21 16:14:01 +00:00
jesopo
fb457c52fb IRCBuffer.find's not_pattern arg should be optional 2020-01-20 16:28:50 +00:00
jesopo
119066b549 user varaible doesn't exist in invite formatting code
closes #231
2020-01-20 14:17:50 +00:00
jesopo
6b0bb512ef colourise server name for server notice formatting 2020-01-20 14:12:37 +00:00
jesopo
0abcc173cd {~TNICK}, not {TNICK} 2020-01-20 14:00:20 +00:00
jesopo
5a0a340e44 better formatting for server notices 2020-01-20 13:48:50 +00:00
jesopo
1f2beef0f5 pass :source or connection_params.hostname through server-notice event 2020-01-20 13:48:29 +00:00
jesopo
8fbf91a2f0 show account and realname in JOIN formatting when available 2020-01-20 13:42:36 +00:00
jesopo
c6d913e218 provide {NICK} as well as {~NICK} as default formatting args 2020-01-20 13:25:33 +00:00
jesopo
dba3f7abc3 .zfill(3) milliseconds in utils.datetime.datetime_human 2020-01-20 13:24:58 +00:00
jesopo
cb73507c5e use a TimeSpec system to request milliseconds in utils.datetime 2020-01-20 13:20:26 +00:00
jesopo
fbe4c93c58 don't overwrite line in MOTD formatting 2020-01-20 13:20:08 +00:00
jesopo
50be75a5e2 also do .format(**) when there's no user object 2020-01-20 13:19:47 +00:00
jesopo
0eb92278cc do all user-provided formatting as {VAR} formatting
otherwise, e.g., a PRIVMSG with {~NICK} will be replaced with user nickname
2020-01-20 12:07:04 +00:00
jesopo
631e669426 _on_topic doesn't always have a user 2020-01-17 18:13:35 +00:00
jesopo
ba5d79c953 fix utils.datetime.iso8601_parse linting error 2020-01-17 16:37:31 +00:00
jesopo
9efe952a9f BufferLine.id should be a string 2020-01-17 16:37:22 +00:00
jesopo
b4e3ee5d0e pass draft/delete events through to format_activity/print_activity 2020-01-17 16:28:48 +00:00
jesopo
95668f2b8b give BufferLine.id default value, overwrite in ircv3_msgid.py 2020-01-17 16:28:23 +00:00
jesopo
5c7026886d overwrite BufferLine.timestamp with ircv3 server-time when available 2020-01-17 15:58:37 +00:00
jesopo
3e574f3c52 add BufferLine.timestamp (datetime.datetime object) 2020-01-17 15:58:08 +00:00
jesopo
e4d71f6c0c add dateutil as a dependency, use it in utils.datetime.iso8601_parse 2020-01-17 15:57:30 +00:00
jesopo
ae7c6d8572 export function for formatting activity lines 2020-01-17 15:36:34 +00:00
jesopo
e3070f52ff refactor format_activity to use {FORMATTING} for maybe-colored things 2020-01-17 15:31:12 +00:00
jesopo
a79f866269 tidy up IRCBuffer.find, respect line.deleted there too 2020-01-17 14:27:45 +00:00
jesopo
44644dcd56 allow BufferLines to be marked as deleted 2020-01-17 14:19:46 +00:00
jesopo
f8b509ef94 give ever BufferLine an ID (IRCv3 msgid or uuid4()) 2020-01-17 14:19:30 +00:00
jesopo
10006a9986 catching account-tag should be PRIORITY_HIGH 2020-01-16 09:50:37 +00:00
jesopo
c180900929 pay attention to account tag on PRIVMSGs 2020-01-16 09:47:57 +00:00
jesopo
21694c39a5 allow !part to work for "current channel" when op/!access 2020-01-13 20:06:32 +00:00
jesopo
6633427cb7 send expect_output on private command events too 2020-01-11 19:20:30 +00:00
jesopo
d06d74efb9 default pattern-based commands to expect_output=False 2020-01-11 19:10:19 +00:00
jesopo
ba958f341b also Accept-Language "en" in HTTP requests (0.5 weight) 2020-01-11 17:55:18 +00:00