summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorMatthias H <apoc@sixserv.org>2014-07-18 15:37:26 +0200
committerMatthias H <apoc@sixserv.org>2014-07-18 15:37:26 +0200
commit2fb24ad9834f0544ac0eef0b589a71fa7add63cf (patch)
treed295cc72bfdccd80b50c7e034973ef8dc228c973 /lib/rbot
parentec56d8a5c3dd91da1f9ec1d9daf0fca8d1669810 (diff)
add a first basic colorformat string function
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/core/utils/extends.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/rbot/core/utils/extends.rb b/lib/rbot/core/utils/extends.rb
index f3662395..11ebfc61 100644
--- a/lib/rbot/core/utils/extends.rb
+++ b/lib/rbot/core/utils/extends.rb
@@ -370,8 +370,17 @@ class ::String
"#{pre}#{self}#{post}"
end
end
-end
+ # Format a string using IRC colors
+ #
+ def colorformat
+ txt = self.dup
+
+ txt.gsub!(/\*([^\*]+)\*/, Bold + '\\1' + NormalText)
+
+ return txt
+ end
+end
# Extensions to the Regexp class, with some common and/or complex regular
# expressions.