Compare commits
3 commits
db931f1f23
...
d9e5016689
Author | SHA1 | Date | |
---|---|---|---|
d9e5016689 | |||
b20783a18e | |||
7f7fd43b8d |
8 changed files with 27 additions and 21 deletions
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
|
@ -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.7.22" />
|
<option name="version" value="1.8.0" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
11
build.gradle
11
build.gradle
|
@ -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.7.22'
|
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
|
||||||
id 'org.jetbrains.kotlin.kapt' version '1.7.22'
|
id 'org.jetbrains.kotlin.kapt' version '1.8.0'
|
||||||
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:-SNAPSHOT'
|
implementation 'com.github.pircbotx:pircbotx:master-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.5'
|
implementation 'org.slf4j:slf4j-api:2.0.6'
|
||||||
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,11 +82,12 @@ 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.6.1'
|
testImplementation 'org.testng:testng:7.7.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|
|
@ -33,6 +33,7 @@ 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
|
||||||
|
@ -46,7 +47,6 @@ 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,10 +152,7 @@ object Utils {
|
||||||
* URL encodes the given string.
|
* URL encodes the given string.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun String.encodeUrl(): String = URLEncoder.encode(this, StandardCharsets.UTF_8)
|
fun String.encodeUrl(): String = UrlEncoder.encode(this)
|
||||||
.replace("+", "%20")
|
|
||||||
.replace("*", "%2A")
|
|
||||||
.replace("%7E", "~")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a property as an int.
|
* Returns a property as an int.
|
||||||
|
|
|
@ -91,6 +91,7 @@ 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.
|
||||||
|
@ -140,8 +141,9 @@ class Mastodon : SocialModule() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
commands.add(MASTODON_CMD)
|
commands.add(MASTODON_CMD)
|
||||||
help.add("To post to Mastodon:")
|
commands.add(TOOT_CMD)
|
||||||
help.add(Utils.helpFormat("%c $MASTODON_CMD <message>"))
|
help.add("To toot on Mastodon:")
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ 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.
|
||||||
|
@ -124,8 +125,9 @@ class Twitter : SocialModule() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
commands.add(TWITTER_CMD)
|
commands.add(TWITTER_CMD)
|
||||||
help.add("To post to Twitter:")
|
commands.add(TWEET_CMD)
|
||||||
help.add(helpFormat("%c $TWITTER_CMD <message>"))
|
help.add("To tweet on Twitter:")
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.17.9")
|
result = nslookup("204.122.16.136")
|
||||||
assertThat(result, "lookup(204.122.17.9)").contains("nix3.thauvin.us")
|
assertThat(result, "lookup(204.122.16.136)").contains("nix3.thauvin.us")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = ["modules"])
|
@Test(groups = ["modules"])
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Tue Dec 13 01:22:17 PST 2022
|
#Wed Jan 04 02:59:39 PST 2023
|
||||||
version.buildmeta=876
|
version.buildmeta=939
|
||||||
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+876
|
version.semver=0.8.0-rc+939
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<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
|
||||||
|
@ -122,7 +123,10 @@
|
||||||
<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>
|
<li>Posting to <a href="https://twitter.com/mobitopia">Twitter</a> and <a href="https://joinmastodon.org/">Mastodon</a>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue