Method: Codebot::Sanitizers#valid_channel_name

Defined in:
lib/codebot/sanitizers.rb

#valid_channel_name(channel) ⇒ String?

Sanitizes a channel name.

Parameters:

  • channel (String, nil)

    the channel name to sanitize

Returns:

  • (String, nil)

    the sanitized value or nil on error



71
72
73
74
75
# File 'lib/codebot/sanitizers.rb', line 71

def valid_channel_name(channel)
  # Colons are currently not considered valid characters because some IRCds
  # use them to delimit channel masks. This might change in the future.
  channel if /\A[&#\+!][[:graph:]&&[^:,]]{,49}\z/ =~ channel
end