Cleaned up and added more tests.
This commit is contained in:
parent
af9546e3d1
commit
04e88264cd
9 changed files with 76 additions and 17 deletions
|
@ -106,7 +106,7 @@ object Utils {
|
|||
*/
|
||||
@JvmStatic
|
||||
fun colorize(s: String?, color: String): String {
|
||||
return if (s.isNullOrEmpty()) {
|
||||
return if (s.isNullOrBlank()) {
|
||||
Colors.NORMAL
|
||||
} else if (Colors.BOLD == color || Colors.REVERSE == color) {
|
||||
color + s + color
|
||||
|
|
|
@ -198,8 +198,8 @@ class StockQuote(bot: Mobibot) : ThreadedModule(bot) {
|
|||
data.forEach {
|
||||
add(
|
||||
NoticeMessage(
|
||||
"${it.first}:".padEnd(pad).prependIndent(),
|
||||
unescapeXml(quote.getString(it.second))
|
||||
"${it.first}:".padEnd(pad).prependIndent()
|
||||
+ unescapeXml(quote.getString(it.second))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -72,4 +72,8 @@ open class Message {
|
|||
this.isError = isError
|
||||
this.isPrivate = isPrivate
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Message(color='$color', isError=$isError, isNotice=$isNotice, isPrivate=$isPrivate, msg='$msg')"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue