diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 4251b72..2b8a50f 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/build.gradle b/build.gradle index e3d2267..d05bf6e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,8 @@ plugins { id 'io.gitlab.arturbosch.detekt' version '1.22.0' id 'java' id 'net.thauvin.erik.gradle.semver' version '1.0.4' - id 'org.jetbrains.kotlin.jvm' version '1.7.22' - id 'org.jetbrains.kotlin.kapt' version '1.7.22' + id 'org.jetbrains.kotlin.jvm' version '1.8.0' + id 'org.jetbrains.kotlin.kapt' version '1.8.0' id 'org.jetbrains.kotlinx.kover' version '0.6.1' id 'org.sonarqube' version '3.5.0.2730' id 'pmd' @@ -45,7 +45,7 @@ dependencies { compileOnly(semverProcessor) // PircBotX - implementation 'com.github.pircbotx:pircbotx:-SNAPSHOT' + implementation 'com.github.pircbotx:pircbotx:master-SNAPSHOT' // implementation fileTree(dir: 'lib', include: '*.jar') // Commons (mostly for PircBotX) @@ -65,7 +65,7 @@ dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.5' // Logging - implementation 'org.slf4j:slf4j-api:2.0.5' + implementation 'org.slf4j:slf4j-api:2.0.6' implementation "org.apache.logging.log4j:log4j-api:$versions.log4j" implementation "org.apache.logging.log4j:log4j-core:$versions.log4j" implementation "org.apache.logging.log4j:log4j-slf4j2-impl:$versions.log4j" @@ -82,11 +82,12 @@ dependencies { implementation 'net.thauvin.erik:cryptoprice:1.0.0' implementation 'net.thauvin.erik:jokeapi:0.9-SNAPSHOT' implementation 'net.thauvin.erik:pinboard-poster:1.0.3' + implementation 'net.thauvin.erik:urlencoder:1.0.0' testImplementation 'com.willowtreeapps.assertk:assertk-jvm:0.25' // testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0' // testImplementation "org.mockito:mockito-core:4.0.0" - testImplementation 'org.testng:testng:7.6.1' + testImplementation 'org.testng:testng:7.7.1' } test { diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt index 113a0ab..bc9860d 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt @@ -33,6 +33,7 @@ package net.thauvin.erik.mobibot import net.thauvin.erik.mobibot.msg.Message import net.thauvin.erik.mobibot.msg.Message.Companion.DEFAULT_COLOR +import net.thauvin.erik.urlencoder.UrlEncoder import org.jsoup.Jsoup import org.pircbotx.Colors import org.pircbotx.PircBotX @@ -46,7 +47,6 @@ import java.io.ObjectInputStream import java.io.ObjectOutputStream import java.net.HttpURLConnection import java.net.URL -import java.net.URLEncoder import java.nio.charset.StandardCharsets import java.nio.file.Files import java.nio.file.Paths @@ -152,10 +152,7 @@ object Utils { * URL encodes the given string. */ @JvmStatic - fun String.encodeUrl(): String = URLEncoder.encode(this, StandardCharsets.UTF_8) - .replace("+", "%20") - .replace("*", "%2A") - .replace("%7E", "~") + fun String.encodeUrl(): String = UrlEncoder.encode(this) /** * Returns a property as an int. diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/modules/Mastodon.kt b/src/main/kotlin/net/thauvin/erik/mobibot/modules/Mastodon.kt index ae805cd..9a4e914 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/Mastodon.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/Mastodon.kt @@ -91,6 +91,7 @@ class Mastodon : SocialModule() { const val INSTANCE_PROP = "mastodon-instance" private const val MASTODON_CMD = "mastodon" + private const val TOOT_CMD = "toot" /** * Post on Mastodon. @@ -140,8 +141,9 @@ class Mastodon : SocialModule() { init { commands.add(MASTODON_CMD) - help.add("To post to Mastodon:") - help.add(Utils.helpFormat("%c $MASTODON_CMD ")) + commands.add(TOOT_CMD) + help.add("To toot on Mastodon:") + help.add(Utils.helpFormat("%c $TOOT_CMD ")) properties[AUTO_POST_PROP] = "false" initProperties(ACCESS_TOKEN_PROP, HANDLE_PROP, INSTANCE_PROP) } diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/modules/Twitter.kt b/src/main/kotlin/net/thauvin/erik/mobibot/modules/Twitter.kt index 28f9cde..4fc3770 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/Twitter.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/Twitter.kt @@ -86,6 +86,7 @@ class Twitter : SocialModule() { // Twitter command private const val TWITTER_CMD = "twitter" + private const val TWEET_CMD = "tweet" /** * Post on Twitter. @@ -124,8 +125,9 @@ class Twitter : SocialModule() { init { commands.add(TWITTER_CMD) - help.add("To post to Twitter:") - help.add(helpFormat("%c $TWITTER_CMD ")) + commands.add(TWEET_CMD) + help.add("To tweet on Twitter:") + help.add(helpFormat("%c $TWEET_CMD ")) properties[AUTO_POST_PROP] = "false" initProperties(CONSUMER_KEY_PROP, CONSUMER_SECRET_PROP, HANDLE_PROP, TOKEN_PROP, TOKEN_SECRET_PROP) } diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt index 734bcb3..5ab97d7 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt @@ -48,8 +48,8 @@ class LookupTest { var result = nslookup("apple.com") assertThat(result, "lookup(apple.com)").contains("17.253.144.10") - result = nslookup("204.122.17.9") - assertThat(result, "lookup(204.122.17.9)").contains("nix3.thauvin.us") + result = nslookup("204.122.16.136") + assertThat(result, "lookup(204.122.16.136)").contains("nix3.thauvin.us") } @Test(groups = ["modules"]) diff --git a/version.properties b/version.properties index 2090357..593b23f 100644 --- a/version.properties +++ b/version.properties @@ -1,9 +1,9 @@ #Generated by the Semver Plugin for Gradle -#Tue Dec 13 01:22:17 PST 2022 -version.buildmeta=876 +#Wed Jan 04 02:59:39 PST 2023 +version.buildmeta=939 version.major=0 version.minor=8 version.patch=0 version.prerelease=rc version.project=mobibot -version.semver=0.8.0-rc+876 +version.semver=0.8.0-rc+939 diff --git a/website/index.html b/website/index.html index 721e840..2d134f2 100644 --- a/website/index.html +++ b/website/index.html @@ -48,6 +48,7 @@
  • PircBotX
  • Rome
  • Twitter4J
  • +
  • UrlEncoder
  • mobibot was written by Erik C. Thauvin as a replacement for the channel's @@ -122,7 +123,10 @@

    mobibot: paper
    mobibot: rock
    -
  • Posting to Twitter and Mastodon
  • +
  • Posting to Twitter and Mastodon +
    mobibot: tweet hello twitter
    +
    mobibot: toot hello mastodon
    +
  • Some of the internal features include RSS feed backlogs, rolling logs, debugging toggle and much more.