Commit Graph

212 Commits

Author SHA1 Message Date
3cfbfd96b0 Let main thread manage consumer threads 2015-09-28 11:59:37 +02:00
a4f4bb799c Extract atom from networking module to core 2015-09-28 11:53:29 +02:00
4cb8b0f1a6 Improve help
On hook declaration, we can now add a help and/or a help_usage argument
	to provide a simple way to the user to be informed.

	For example:

	```python
	@hook("cmd_hook", "news", help_usage={"URL": "Display the latests news from a given URL"})
	def cmd_news(msg):
	    [...]
	```

	will be displayed on !help !news as:

	> Usage for command !news from module news: !news URL: Display the latests news from a given URL

	Or for module commands help:

	```python
	@hook("cmd_hook", "news", help="display latests news")
	def cmd_news(msg):
	    [...]
	```

	will be displayed on !help mymodule (assuming this hook is in the
	module named mymodule) as:

	> Available commands for module news: news: display latests news

	Obviously, both `help` and `help_usage` can be present. If `help_usage`
	doesn't exist, help on usage will display the content of help.
2015-09-24 11:29:51 +02:00
3c51b1f03b Add assertion on class initialization 2015-09-24 11:29:49 +02:00
ecd9457691 Help: display on the right place, not always to private conversation 2015-09-24 11:29:49 +02:00
d5f07ec338 Display a basic error to IM user on uncatched exception 2015-09-24 11:29:47 +02:00
760da8ef61 tools.web: don't try to striphtml content that is not str or buffer 2015-09-24 11:29:47 +02:00
9b2bc27374 tools.web: restore Python3.3 behavior: don't check server certificate 2015-09-24 11:29:46 +02:00
8988dd0d41 striphtml: also convert ´ and collapse multiple space, as HTML display do 2015-09-24 11:29:46 +02:00
9fa8902f1a Invalid fd are < 0, not only -1 2015-09-24 11:29:46 +02:00
beeb5573e1 Define class variables in __init__ 2015-09-24 11:29:45 +02:00
9686f36522 Add a function to guess the closest word for a miss input 2015-09-24 11:29:44 +02:00
e837f9c8e5 Improve formating of size function and test it 2015-09-24 11:29:43 +02:00
2b0593a51e Add tool to calculate string distance 2015-09-23 18:06:21 +02:00
c27540eb87 web: reduce timeout from 15 to 7 seconds 2015-08-26 12:18:23 +02:00
88a8e0fe59 web: can make POST request 2015-08-26 12:18:23 +02:00
0208a5d552 Allow socket to print messages 2015-08-26 12:18:23 +02:00
a00c354287 Add a factory to help connecting to servers 2015-08-26 12:18:22 +02:00
d269468287 Let consumer parse the message instead of server 2015-08-26 12:18:22 +02:00
a1ac7d480d Split server message parsing from message retrieving 2015-08-26 12:18:22 +02:00
787a5fd3da Web tool raise more IRCException 2015-08-26 12:17:21 +02:00
000c67e45e Can return Response in help_full function 2015-08-26 12:17:21 +02:00
ae4a303554 Fix #74 2015-08-26 12:17:21 +02:00
26515677b8 Don't add new event after main thread stop 2015-08-26 12:17:12 +02:00
92895a7b1d XML parser: perform atomic save by moving a temporary file after the serialization 2015-06-24 20:06:01 +02:00
c7706bfc97 XML datastore: load will now automatically try to load backup 2015-06-24 20:06:00 +02:00
ab2eb405ca XML datastore: add file rotation for backup purpose 2015-06-24 20:05:59 +02:00
9cf4b9becb Fix bot close
Tell consumer to stop their work
	Avoid error when select on closed fd
2015-06-24 20:05:56 +02:00
f4a80e0fda New function in ModuleContext: call_hook 2015-06-24 20:05:54 +02:00
c86031ea32 Can use print with non string 2015-06-24 20:05:53 +02:00
c1858fff3a Catch exception during module loading: just skip the module registration 2015-06-03 18:01:50 +02:00
fc500bc853 Tools.Web: fix charset detection on webpages 2015-06-03 15:30:26 +02:00
500e3a6e01 Compatibly with Python 3.4 2015-05-26 12:33:28 +02:00
fc1bc135df Importer: now compatible with Python 3.4 2015-05-26 12:33:16 +02:00
40ff3d6eda Socket connection can now be made in IPv6 2015-05-25 16:44:30 +02:00
0fb58f0ff2 Use expat parser instead of SAX to parse XML files 2015-05-25 16:44:30 +02:00
0f2f14ddda XML datastore: new directory locking procedure
This new procedure use fcntl functions to lock the file during the
	life of the datastore instance.

	Now, locked directory error is not displayed if if nemubot is not
	correctly closed.
2015-05-25 16:44:30 +02:00
2644d1bc02 [xmlparser] Fix date extraction when using old format 2015-05-25 16:44:29 +02:00
8bcceb641f Add a logger to module context on init 2015-05-25 16:44:29 +02:00
002f2463a3 Extract hooks 2015-05-25 16:44:28 +02:00
c8d495d508 Split messages class into multiple files 2015-05-25 16:44:27 +02:00
57bbca4e7a Raise an exception when unable to open datastore, instead of returning False 2015-05-25 16:44:27 +02:00
1b9395ca37 Doc 2015-05-25 16:44:27 +02:00
418ff4f519 Datastore: add a method to create a new empty tree 2015-05-25 16:44:26 +02:00
4d7d1ccab2 Add unittest for IRCMessage 2015-05-25 16:44:26 +02:00
c984493c79 Place events to a separate directory 2015-05-25 16:44:25 +02:00
06bc0a7693 IRC: allow empty host as ZNC seems to send empty one sometimes 2015-05-25 16:44:25 +02:00
806ff1d4a0 Move main code to __main__.py 2015-05-25 16:44:24 +02:00
e588c30044 Optimize imports 2015-05-25 16:44:16 +02:00
2e7a4ad132 Save timestamp in UTC format 2015-02-18 01:48:02 +01:00
dacb618069 Increasing version number due to significant changes 2015-02-13 12:58:45 +01:00
1f5364c387 Reduce importance of importer; new tiny context for each module, instead of having entire bot context 2015-02-11 18:11:57 +01:00
bafc14bd79 add_server can now be used before context start 2015-02-10 00:42:38 +01:00
f66d724d40 Introducing data stores 2015-02-10 00:30:04 +01:00
e7fd7c5ec4 Arrange IRC server construction
reorder constructor argument to a more logical order
	on_connect can be a simple string or a callable
2015-02-09 23:07:30 +01:00
55b1eb5075 Allow data_path to be None (don't load or save data) 2015-02-09 17:31:32 +01:00
e7d37991b3 Allow print and print_debug with multiple arguments 2015-01-22 17:18:49 +01:00
2b9c810e88 Fix quit 2015-01-05 03:07:41 +01:00
38aea5dd37 Lock the data directory to avoid concurent modification of XML files 2015-01-05 02:49:21 +01:00
06c85289e0 Don't import some nemubot module automatically 2015-01-05 02:49:06 +01:00
5a6230d844 [wip] changes import to reflect new directory structure 2015-01-05 02:48:49 +01:00
41f7dc2456 [wip] move files in order to have a clean directory structure 2015-01-04 15:14:35 +01:00