Compare commits

..

No commits in common. "d9e50166899696b31a2336dc90c0dd2070d07a86" and "db931f1f23a1dfd7c418b587aaf9b29c615383c7" have entirely different histories.

8 changed files with 21 additions and 27 deletions

2
.idea/kotlinc.xml generated
View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="KotlinJpsPluginSettings"> <component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.0" /> <option name="version" value="1.7.22" />
</component> </component>
</project> </project>

View file

@ -5,8 +5,8 @@ plugins {
id 'io.gitlab.arturbosch.detekt' version '1.22.0' id 'io.gitlab.arturbosch.detekt' version '1.22.0'
id 'java' id 'java'
id 'net.thauvin.erik.gradle.semver' version '1.0.4' id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.8.0' id 'org.jetbrains.kotlin.jvm' version '1.7.22'
id 'org.jetbrains.kotlin.kapt' version '1.8.0' id 'org.jetbrains.kotlin.kapt' version '1.7.22'
id 'org.jetbrains.kotlinx.kover' version '0.6.1' id 'org.jetbrains.kotlinx.kover' version '0.6.1'
id 'org.sonarqube' version '3.5.0.2730' id 'org.sonarqube' version '3.5.0.2730'
id 'pmd' id 'pmd'
@ -45,7 +45,7 @@ dependencies {
compileOnly(semverProcessor) compileOnly(semverProcessor)
// PircBotX // PircBotX
implementation 'com.github.pircbotx:pircbotx:master-SNAPSHOT' implementation 'com.github.pircbotx:pircbotx:-SNAPSHOT'
// implementation fileTree(dir: 'lib', include: '*.jar') // implementation fileTree(dir: 'lib', include: '*.jar')
// Commons (mostly for PircBotX) // Commons (mostly for PircBotX)
@ -65,7 +65,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.5' implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.5'
// Logging // Logging
implementation 'org.slf4j:slf4j-api:2.0.6' implementation 'org.slf4j:slf4j-api:2.0.5'
implementation "org.apache.logging.log4j:log4j-api:$versions.log4j" implementation "org.apache.logging.log4j:log4j-api:$versions.log4j"
implementation "org.apache.logging.log4j:log4j-core:$versions.log4j" implementation "org.apache.logging.log4j:log4j-core:$versions.log4j"
implementation "org.apache.logging.log4j:log4j-slf4j2-impl:$versions.log4j" implementation "org.apache.logging.log4j:log4j-slf4j2-impl:$versions.log4j"
@ -82,12 +82,11 @@ dependencies {
implementation 'net.thauvin.erik:cryptoprice:1.0.0' implementation 'net.thauvin.erik:cryptoprice:1.0.0'
implementation 'net.thauvin.erik:jokeapi:0.9-SNAPSHOT' implementation 'net.thauvin.erik:jokeapi:0.9-SNAPSHOT'
implementation 'net.thauvin.erik:pinboard-poster:1.0.3' 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 'com.willowtreeapps.assertk:assertk-jvm:0.25'
// testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0' // testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
// testImplementation "org.mockito:mockito-core:4.0.0" // testImplementation "org.mockito:mockito-core:4.0.0"
testImplementation 'org.testng:testng:7.7.1' testImplementation 'org.testng:testng:7.6.1'
} }
test { test {

View file

@ -33,7 +33,6 @@ package net.thauvin.erik.mobibot
import net.thauvin.erik.mobibot.msg.Message import net.thauvin.erik.mobibot.msg.Message
import net.thauvin.erik.mobibot.msg.Message.Companion.DEFAULT_COLOR import net.thauvin.erik.mobibot.msg.Message.Companion.DEFAULT_COLOR
import net.thauvin.erik.urlencoder.UrlEncoder
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.pircbotx.Colors import org.pircbotx.Colors
import org.pircbotx.PircBotX import org.pircbotx.PircBotX
@ -47,6 +46,7 @@ import java.io.ObjectInputStream
import java.io.ObjectOutputStream import java.io.ObjectOutputStream
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
import java.net.URLEncoder
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
@ -152,7 +152,10 @@ object Utils {
* URL encodes the given string. * URL encodes the given string.
*/ */
@JvmStatic @JvmStatic
fun String.encodeUrl(): String = UrlEncoder.encode(this) fun String.encodeUrl(): String = URLEncoder.encode(this, StandardCharsets.UTF_8)
.replace("+", "%20")
.replace("*", "%2A")
.replace("%7E", "~")
/** /**
* Returns a property as an int. * Returns a property as an int.

View file

@ -91,7 +91,6 @@ class Mastodon : SocialModule() {
const val INSTANCE_PROP = "mastodon-instance" const val INSTANCE_PROP = "mastodon-instance"
private const val MASTODON_CMD = "mastodon" private const val MASTODON_CMD = "mastodon"
private const val TOOT_CMD = "toot"
/** /**
* Post on Mastodon. * Post on Mastodon.
@ -141,9 +140,8 @@ class Mastodon : SocialModule() {
init { init {
commands.add(MASTODON_CMD) commands.add(MASTODON_CMD)
commands.add(TOOT_CMD) help.add("To post to Mastodon:")
help.add("To toot on Mastodon:") help.add(Utils.helpFormat("%c $MASTODON_CMD <message>"))
help.add(Utils.helpFormat("%c $TOOT_CMD <message>"))
properties[AUTO_POST_PROP] = "false" properties[AUTO_POST_PROP] = "false"
initProperties(ACCESS_TOKEN_PROP, HANDLE_PROP, INSTANCE_PROP) initProperties(ACCESS_TOKEN_PROP, HANDLE_PROP, INSTANCE_PROP)
} }

View file

@ -86,7 +86,6 @@ class Twitter : SocialModule() {
// Twitter command // Twitter command
private const val TWITTER_CMD = "twitter" private const val TWITTER_CMD = "twitter"
private const val TWEET_CMD = "tweet"
/** /**
* Post on Twitter. * Post on Twitter.
@ -125,9 +124,8 @@ class Twitter : SocialModule() {
init { init {
commands.add(TWITTER_CMD) commands.add(TWITTER_CMD)
commands.add(TWEET_CMD) help.add("To post to Twitter:")
help.add("To tweet on Twitter:") help.add(helpFormat("%c $TWITTER_CMD <message>"))
help.add(helpFormat("%c $TWEET_CMD <message>"))
properties[AUTO_POST_PROP] = "false" properties[AUTO_POST_PROP] = "false"
initProperties(CONSUMER_KEY_PROP, CONSUMER_SECRET_PROP, HANDLE_PROP, TOKEN_PROP, TOKEN_SECRET_PROP) initProperties(CONSUMER_KEY_PROP, CONSUMER_SECRET_PROP, HANDLE_PROP, TOKEN_PROP, TOKEN_SECRET_PROP)
} }

View file

@ -48,8 +48,8 @@ class LookupTest {
var result = nslookup("apple.com") var result = nslookup("apple.com")
assertThat(result, "lookup(apple.com)").contains("17.253.144.10") assertThat(result, "lookup(apple.com)").contains("17.253.144.10")
result = nslookup("204.122.16.136") result = nslookup("204.122.17.9")
assertThat(result, "lookup(204.122.16.136)").contains("nix3.thauvin.us") assertThat(result, "lookup(204.122.17.9)").contains("nix3.thauvin.us")
} }
@Test(groups = ["modules"]) @Test(groups = ["modules"])

View file

@ -1,9 +1,9 @@
#Generated by the Semver Plugin for Gradle #Generated by the Semver Plugin for Gradle
#Wed Jan 04 02:59:39 PST 2023 #Tue Dec 13 01:22:17 PST 2022
version.buildmeta=939 version.buildmeta=876
version.major=0 version.major=0
version.minor=8 version.minor=8
version.patch=0 version.patch=0
version.prerelease=rc version.prerelease=rc
version.project=mobibot version.project=mobibot
version.semver=0.8.0-rc+939 version.semver=0.8.0-rc+876

View file

@ -48,7 +48,6 @@
<li><a href="https://github.com/pircbotx/pircbotx">PircBotX</a></li> <li><a href="https://github.com/pircbotx/pircbotx">PircBotX</a></li>
<li><a href="https://rometools.github.io/rome/">Rome</a></li> <li><a href="https://rometools.github.io/rome/">Rome</a></li>
<li><a href="http://twitter4j.org/en/index.html">Twitter4J</a></li> <li><a href="http://twitter4j.org/en/index.html">Twitter4J</a></li>
<li><a href="https://github.com/ethauvin/urlencoder">UrlEncoder</a></li>
</ul> </ul>
<p>mobibot was written by <p>mobibot was written by
<a href="https://erik.thauvin.net/"><strong>Erik C. Thauvin</strong></a> as a replacement for the channel's <a href="https://erik.thauvin.net/"><strong>Erik C. Thauvin</strong></a> as a replacement for the channel's
@ -123,10 +122,7 @@
<div><code>mobibot: paper</code></div> <div><code>mobibot: paper</code></div>
<div><code>mobibot: rock</code></div> <div><code>mobibot: rock</code></div>
</li> </li>
<li>Posting to <a href="https://twitter.com/mobitopia">Twitter</a> and <a href="https://joinmastodon.org/">Mastodon</a> <li>Posting to <a href="https://twitter.com/mobitopia">Twitter</a> and <a href="https://joinmastodon.org/">Mastodon</a></li>
<div><code>mobibot: tweet hello twitter</code></div>
<div><code>mobibot: toot hello mastodon</code></div>
</li>
</ul> </ul>
<p>Some of the internal features include RSS feed backlogs, rolling logs, debugging toggle and much more.</p> <p>Some of the internal features include RSS feed backlogs, rolling logs, debugging toggle and much more.</p>