Utility#
sopel.irc.utils
contains low-level tools for IRC protocol handling.
Warning
This is all internal code, not intended for direct use by plugins. It is subject to change between versions, even patch releases, without any advance notice.
- class sopel.irc.utils.MyInfo#
Store client, servername, and version from
RPL_MYINFO
events.
- sopel.irc.utils.safe(string)#
Remove newlines from a string.
- Parameters:
string (str) – input text to process
- Returns:
the string without newlines
- Return type:
- Raises:
TypeError – when
string
isNone
This function removes newlines from a string and always returns a unicode string (
str
), but doesn’t strip or alter it in any other way:>>> safe('some text\r\n') 'some text'
This is useful to ensure a string can be used in a IRC message.
Changed in version 7.1: This function now raises a
TypeError
instead of an unpredictable behaviour when givenNone
.