summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2012-07-07 04:51:52 +0200
committerFlorent Le Coz <louiz@louiz.org>2012-07-07 04:52:20 +0200
commit8739662e311a97839dececf7817d9ff12701dd5e (patch)
treeffc5445bde64ba156c3613617e704d27039efe95 /doc
parentab14923611a438386822598e2fc24b4efa00d282 (diff)
downloadpoezio-8739662e311a97839dececf7817d9ff12701dd5e.tar.gz
poezio-8739662e311a97839dececf7817d9ff12701dd5e.tar.bz2
poezio-8739662e311a97839dececf7817d9ff12701dd5e.tar.xz
poezio-8739662e311a97839dececf7817d9ff12701dd5e.zip
Add a replace plugin.
Diffstat (limited to 'doc')
-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.