Cleanup.
This commit is contained in:
parent
19894dce1f
commit
d33210c594
4 changed files with 8 additions and 6 deletions
|
@ -399,7 +399,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert
|
||||||
* Sends a notice to the channel.
|
* Sends a notice to the channel.
|
||||||
*/
|
*/
|
||||||
fun send(notice: String?) {
|
fun send(notice: String?) {
|
||||||
if (notice != null) send(channel, notice, false)
|
notice?.let { send(channel, it, false) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -419,6 +419,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert
|
||||||
/**
|
/**
|
||||||
* Send a formatted commands/modules, etc. list.
|
* Send a formatted commands/modules, etc. list.
|
||||||
*/
|
*/
|
||||||
|
@JvmOverloads
|
||||||
fun sendList(
|
fun sendList(
|
||||||
nick: String,
|
nick: String,
|
||||||
list: List<String>,
|
list: List<String>,
|
||||||
|
@ -600,6 +601,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert
|
||||||
init {
|
init {
|
||||||
System.getProperties().setProperty("sun.net.client.defaultConnectTimeout", Constants.CONNECT_TIMEOUT.toString())
|
System.getProperties().setProperty("sun.net.client.defaultConnectTimeout", Constants.CONNECT_TIMEOUT.toString())
|
||||||
System.getProperties().setProperty("sun.net.client.defaultReadTimeout", Constants.CONNECT_TIMEOUT.toString())
|
System.getProperties().setProperty("sun.net.client.defaultReadTimeout", Constants.CONNECT_TIMEOUT.toString())
|
||||||
|
|
||||||
name = nickname
|
name = nickname
|
||||||
ircServer = p.getProperty("server", Constants.DEFAULT_SERVER)
|
ircServer = p.getProperty("server", Constants.DEFAULT_SERVER)
|
||||||
ircPort = getIntProperty(p.getProperty("port"), Constants.DEFAULT_PORT)
|
ircPort = getIntProperty(p.getProperty("port"), Constants.DEFAULT_PORT)
|
||||||
|
|
|
@ -156,7 +156,7 @@ object Utils {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun helpFormat(help: String, isBold: Boolean = true, isIndent: Boolean = true): String {
|
fun helpFormat(help: String, isBold: Boolean = true, isIndent: Boolean = true): String {
|
||||||
return (if (isIndent) " " else "").plus(if (isBold) bold(help) else help)
|
return (if (isIndent) " " else "").plus(if (isBold) bold(help) else help)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class Info extends AbstractCommand {
|
||||||
@NotNull final String args,
|
@NotNull final String args,
|
||||||
final boolean isOp,
|
final boolean isOp,
|
||||||
final boolean isPrivate) {
|
final boolean isPrivate) {
|
||||||
getBot().sendList(sender, allVersions, 1, isPrivate, false, false);
|
getBot().sendList(sender, allVersions, 1, isPrivate);
|
||||||
|
|
||||||
final StringBuilder info = new StringBuilder("Uptime: ");
|
final StringBuilder info = new StringBuilder("Uptime: ");
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,10 @@ import java.util.List;
|
||||||
|
|
||||||
public class Versions extends AbstractCommand {
|
public class Versions extends AbstractCommand {
|
||||||
private final List<String> allVersions =
|
private final List<String> allVersions =
|
||||||
List.of("Version: " + ReleaseInfo.VERSION + " (" + Utils.isoLocalDate(ReleaseInfo.BUILDDATE) + ')',
|
List.of("Version: " + ReleaseInfo.VERSION + " (" + Utils.isoLocalDate(ReleaseInfo.BUILDDATE) + ')',
|
||||||
"Platform: " + System.getProperty("os.name") + ' ' + System.getProperty("os.version")
|
"Platform: " + System.getProperty("os.name") + ' ' + System.getProperty("os.version")
|
||||||
+ " (" + System.getProperty("os.arch") + ')',
|
+ " (" + System.getProperty("os.arch") + ')',
|
||||||
"Runtime: " + System.getProperty("java.runtime.name")
|
"Runtime: " + System.getProperty("java.runtime.name")
|
||||||
+ ' ' + System.getProperty("java.runtime.version"));
|
+ ' ' + System.getProperty("java.runtime.version"));
|
||||||
|
|
||||||
public Versions(@NotNull final Mobibot bot) {
|
public Versions(@NotNull final Mobibot bot) {
|
||||||
|
@ -86,7 +86,7 @@ public class Versions extends AbstractCommand {
|
||||||
final boolean isOp,
|
final boolean isOp,
|
||||||
final boolean isPrivate) {
|
final boolean isPrivate) {
|
||||||
if (isOp) {
|
if (isOp) {
|
||||||
getBot().sendList(sender, allVersions, 1, isPrivate, false, false);
|
getBot().sendList(sender, allVersions, 1, isPrivate);
|
||||||
} else {
|
} else {
|
||||||
getBot().helpDefault(sender, false, isPrivate);
|
getBot().helpDefault(sender, false, isPrivate);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue