From c1e2c7ff8a856bf606959a260023b815dcded3f6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 1 Nov 2009 09:52:30 +0100 Subject: [PATCH] IRC Framework: Channel.npname() Returns the unprefixed part of a channel name --- lib/rbot/irc.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index c893fc27..ebfbaed3 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -1323,6 +1323,13 @@ module Irc # class Channel + # Return the non-prefixed part of a channel name. + # Also works with ## channels found on some networks + # (e.g. FreeNode) + def self.npname(str) + return str.to_s.sub(/^[&#+!]+/,'') + end + include ServerOrCasemap attr_reader :name, :topic, :mode, :users alias :to_s :name -- 2.39.2