summaryrefslogtreecommitdiff
path: root/doc/en/plugins/replace.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/en/plugins/replace.txt')
-rw-r--r--doc/en/plugins/replace.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/doc/en/plugins/replace.txt b/doc/en/plugins/replace.txt
new file mode 100644
index 00000000..3a17ff20
--- /dev/null
+++ b/doc/en/plugins/replace.txt
@@ -0,0 +1,71 @@
+Replace
+=======
+
+Replace some patterns in a message before sending it.
+
+
+Installation
+------------
+You only have to load the plugin.
+
+==============
+
+ /load replace
+
+==============
+
+Usage
+-----
+Insert a pattern in the form
+
+=========
+
+%pattern%
+
+=========
+
+in your message, and it will be replaced by the corresponding text.
+
+The list of provided patterns is:
+
+- _time_: Insert the current time
+- _date_: Insert the current date
+- _datetime_: Insert the current date and time
+- _random_nick_: Insert a random nick from the current MUC
+- _dice_: Insert a random number between 1 and 6
+
+
+Add your own pattern
+--------------------
+
+You can easily edit this plugin to add your own patterns. For example if
+don’t want to search for an insult everytime you’re angry, you can create a
+curse pattern this way:
+
+- In the init(self) method of the Plugin class, add something like
+
+================
+[source,python]
+ self.patterns['curse'] = replace_curse
+================
+
+- then define a function (not a method of the Plugin class) at the bottom
+of the file. For example:
+
+
+==========================================================
+[source,python]
+def replace_curse(message, tab):
+ return random.choice(['dumb shit', 'idiot', 'moron'])
+==========================================================
+
+and you can now use something like
+
+====================
+Shut up, %curse%!
+====================
+
+in your everyday-conversations.
+
+For more conveniance, you can read your nice words from a file, do whatever
+you want in that function, as long as it returns a string.