From 5e02d154de506af7014316de86893bb1d015fa70 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:40:02 +0000 Subject: [PATCH 01/13] started writing documentation file --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a69235d --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# Depressionbot IRC Bot + +## Introduction + +Depressionbot is an IRC bot which aims to be the fanciest IRC bot around - On +the general standard of software fanciness, dbot is rated as being '75% the same +as bathing in fine, fine grape juice.' + +Requirements: + - Node JS + - JSbot, the Javascript library I wrote to handle the IRC protocol and event + listeners etc. + - Various modules have their own requirements also. + +## Modules: + +### Quotes + +### Admin + +Various administration functionality such as banning users, hot-reloading the +code and ordering him to talk. Note that commands added here are handled with +their own listener, rather than being part of the command logic which is handled +by the Command module. + +### JS - Run Javascript code + +This module provides two commands which allow the execution of Javascript code. +For regular users, there is the *~js* command, which is completely sandboxed, +but can still be used for calculation and the like. + +Example: + > ~js Array(16).join('wat'-1) + " Batman!"; + 'NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!' + +This feature is fairly safe as the user doesn't have access to anything +dangerous, and is safe from infinite loops or locking DBot up because the code +which is run is killed if it does not finish within a short amount of time. + +For administrators, the incredibly useful *~ajs* command is also available. The +input for this command is simply 'eval'-ed and therefore has full access to +DBot's memory. Of course, this is incredibly unsafe, but I find it rather fun. +It's useful for administrative activity for which there isn't an in-built +command. For example, you could hot-add a new administrator like this: + + > ~ajs dbot.admin.push('batman'); + 2 + +You can also use this for debugging, or even adding new commands while DBot is +running. From 6c154869892ef842da02f888428268665a0776ee Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:40:46 +0000 Subject: [PATCH 02/13] format fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a69235d..76d2775 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ For regular users, there is the *~js* command, which is completely sandboxed, but can still be used for calculation and the like. Example: - > ~js Array(16).join('wat'-1) + " Batman!"; + ~js Array(16).join('wat'-1) + " Batman!"; 'NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!' This feature is fairly safe as the user doesn't have access to anything From 8a1047e42780f193900aad901012dac8a7bb07e6 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:41:19 +0000 Subject: [PATCH 03/13] format fix --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 76d2775..a5dbbf0 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,7 @@ This module provides two commands which allow the execution of Javascript code. For regular users, there is the *~js* command, which is completely sandboxed, but can still be used for calculation and the like. -Example: - ~js Array(16).join('wat'-1) + " Batman!"; + > ~js Array(16).join('wat'-1) + " Batman!"; 'NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN Batman!' This feature is fairly safe as the user doesn't have access to anything From b5b51c6828425f1793ae7f1cb12cf7bee6272b3c Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:45:08 +0000 Subject: [PATCH 04/13] additions to readme --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a5dbbf0..be7b602 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,18 @@ Requirements: ### Quotes +This is the original reason that DBot was created. + +Commands: + - ~qadd category=newquote - Add a new quote to the database. + ### Admin Various administration functionality such as banning users, hot-reloading the code and ordering him to talk. Note that commands added here are handled with their own listener, rather than being part of the command logic which is handled -by the Command module. +by the Command module. Functionality in this module can be slightly unsafe as +not much error checking on the input is performed. ### JS - Run Javascript code @@ -38,9 +44,14 @@ which is run is killed if it does not finish within a short amount of time. For administrators, the incredibly useful *~ajs* command is also available. The input for this command is simply 'eval'-ed and therefore has full access to -DBot's memory. Of course, this is incredibly unsafe, but I find it rather fun. -It's useful for administrative activity for which there isn't an in-built -command. For example, you could hot-add a new administrator like this: +DBot's memory. Of course, this is incredibly unsafe, but I find it rather fun; +remember to only give extremely trusted friends administrator access to DBot, as +there's nothing to stop them wiping the database or something similar - if +you're worried about that kind of thing, do not load this module. + +However, it's useful for many things, such as administrative activity for +which there isn't a command in the admin module. For example, you could hot-add +a new administrator like this: > ~ajs dbot.admin.push('batman'); 2 From 3a55069cf1d9321e037962b541419ed4a01aa484 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:46:23 +0000 Subject: [PATCH 05/13] additions to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index be7b602..2cd0df5 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Requirements: This is the original reason that DBot was created. Commands: + - ~qadd category=newquote - Add a new quote to the database. ### Admin From 813488db5775fa71990f10c7c3882ebc9fb8df5b Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:46:51 +0000 Subject: [PATCH 06/13] additions to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cd0df5..402b38b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is the original reason that DBot was created. Commands: - - ~qadd category=newquote - Add a new quote to the database. +- ~qadd category=newquote - Add a new quote to the database. ### Admin From 90b95fae439451fdf60ca534f3259d75627513e7 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:53:11 +0000 Subject: [PATCH 07/13] quote command --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 402b38b..00c2a93 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,19 @@ This is the original reason that DBot was created. Commands: -- ~qadd category=newquote - Add a new quote to the database. +- _~q category_ - Display a random quote from a given category. +- _~qadd category=newquote_ - Add a new quote to the database. +- _~qstats_ - Show a list of the biggest quote categories. +- _~qsearch category needle_ - Search for a quote in a given category. +- _~rmlast [category]_ - Remove the last quote added to a given category, or the + last quote added. +- _~rm category quote_ - Remove a given quote from the given category. +- _~qcount category_ - Show the number of quotes stored in the given category. +- _~rq_ - Show a random quote from a random category. +- _~d_ - Show a quote from the category which matches the bot's name. +- _~link category_ - Create a link to the page on the web interface which displays the + given category's quotes. +- _~qprune_ - Delete empty quote categories. ### Admin From 4067368fba0f26f7fa8874948d9ab3a62c69f554 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 19:58:13 +0000 Subject: [PATCH 08/13] command docs --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00c2a93..34163a4 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,22 @@ Requirements: ## Modules: +### Command + +This handles the command execution logic for DBot. + +1. Does the input match a command key in *dbot.commands* ? +2. Is there a quote category which matches the first part of the input + (*~category*)? +3. Is there a command name similar to to the first part of the input (*~name*) + in *dbot.commands*? + +This is the only module which is force loaded, even if it's not in the +configuration. + ### Quotes -This is the original reason that DBot was created. +This is the original reason that DBot was created, stores and displays quotes. Commands: @@ -34,6 +47,11 @@ Commands: given category's quotes. - _~qprune_ - Delete empty quote categories. +Unfortunately, this module is fairly highly coupled with certain other areas of +the program. I am working on this, but note, for example, that one can still +access quotes with the *~category* syntax even if the quotes module isn't +loaded. + ### Admin Various administration functionality such as banning users, hot-reloading the From c6d767ccdf5926a9ae3236fb1707e04d757cbd07 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 20:04:03 +0000 Subject: [PATCH 09/13] spelling docs --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 34163a4..f524f16 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ the general standard of software fanciness, dbot is rated as being '75% the same as bathing in fine, fine grape juice.' Requirements: - - Node JS - - JSbot, the Javascript library I wrote to handle the IRC protocol and event - listeners etc. - - Various modules have their own requirements also. +- Node JS +- JSbot, the Javascript library I wrote to handle the IRC protocol and event + listeners etc. +- Various modules have their own requirements also. ## Modules: @@ -60,7 +60,28 @@ their own listener, rather than being part of the command logic which is handled by the Command module. Functionality in this module can be slightly unsafe as not much error checking on the input is performed. -### JS - Run Javascript code +TODO: Add summaries for each command in this module. + +### Spelling + +Will attempt to correct a users' spelling by using the levenshtein distance +algorithm. One corrects the spelling of their previous message by simply posting +a message with their correction and an asterisk: + + > user: I am a tutrle. + > user: *turtle + user meant: I am a turtle. + +The regular expression for this module also accepts two asterisks at the +beginning of the correction, or at the end, and also accepts several words as +corrections, and deals with these fairly intelligently. Users may also attempt +to correct another users like so: + + > userone: I am a tutrle. + > usertwo: userone: *turtle + > usertwo thinks userone meant: I am a turtle. + +### JS This module provides two commands which allow the execution of Javascript code. For regular users, there is the *~js* command, which is completely sandboxed, From 41763580af684247f87bed92b7d7e16609dc94ac Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 20:10:49 +0000 Subject: [PATCH 10/13] format requirements properly --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f524f16..6526788 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ the general standard of software fanciness, dbot is rated as being '75% the same as bathing in fine, fine grape juice.' Requirements: + - Node JS - JSbot, the Javascript library I wrote to handle the IRC protocol and event listeners etc. @@ -73,8 +74,8 @@ a message with their correction and an asterisk: user meant: I am a turtle. The regular expression for this module also accepts two asterisks at the -beginning of the correction, or at the end, and also accepts several words as -corrections, and deals with these fairly intelligently. Users may also attempt +beginning of the correction, or at the end; it also accepts several words as the +correction and deals with these fairly intelligently. Users may also attempt to correct another users like so: > userone: I am a tutrle. From 7f9eb8d0cf4c8f660b538488b2f3675019049bfd Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 20:12:21 +0000 Subject: [PATCH 11/13] link to jsbot --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6526788..50426be 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ as bathing in fine, fine grape juice.' Requirements: - Node JS -- JSbot, the Javascript library I wrote to handle the IRC protocol and event - listeners etc. +- [JSBot](http://github.com/reality/JSBot "JSBot"), the Javascript library I + wrote to handle the IRC protocol and event listeners etc. - Various modules have their own requirements also. ## Modules: From 6171e31a64054bf73a32e81748ebe17bc9a4be0d Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 20:14:47 +0000 Subject: [PATCH 12/13] disclaimer --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 50426be..4557dd7 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ Depressionbot is an IRC bot which aims to be the fanciest IRC bot around - On the general standard of software fanciness, dbot is rated as being '75% the same as bathing in fine, fine grape juice.' +Please note that this documentation is not complete, given I started it rather a +long time after I began development of the project. Please don't judge me too +harshly for this as I am, in fact, mildly allergic to writing documentation. + Requirements: - Node JS From 7e0d6b05cd83d5bf54523844355d581d97c0d64b Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 10 Mar 2012 20:15:13 +0000 Subject: [PATCH 13/13] disclaimer --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4557dd7..7383937 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ Depressionbot is an IRC bot which aims to be the fanciest IRC bot around - On the general standard of software fanciness, dbot is rated as being '75% the same as bathing in fine, fine grape juice.' -Please note that this documentation is not complete, given I started it rather a -long time after I began development of the project. Please don't judge me too -harshly for this as I am, in fact, mildly allergic to writing documentation. +Please note that this documentation is not complete and is a work in progress, +given I started it rather a long time after I began development of the project. +Please don't judge me too harshly for this as I am, in fact, mildly allergic to +writing documentation. Requirements: