Cleanup.
This commit is contained in:
parent
11a75a7179
commit
790bd3159e
23 changed files with 67 additions and 69 deletions
3
.idea/codeStyles/Project.xml
generated
3
.idea/codeStyles/Project.xml
generated
|
@ -14,6 +14,9 @@
|
||||||
<option name="JD_INDENT_ON_CONTINUATION" value="true" />
|
<option name="JD_INDENT_ON_CONTINUATION" value="true" />
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value />
|
||||||
|
</option>
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
|
1
.idea/codeStyles/codeStyleConfig.xml
generated
1
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,6 +1,5 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<state>
|
<state>
|
||||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
|
||||||
</state>
|
</state>
|
||||||
</component>
|
</component>
|
|
@ -116,12 +116,6 @@ detekt {
|
||||||
baseline = file("${projectDir}/config/detekt/baseline.xml")
|
baseline = file("${projectDir}/config/detekt/baseline.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
|
||||||
options.tags = ['created']
|
|
||||||
options.author = true
|
|
||||||
options.links('http://www.jibble.org/javadocs/pircbot/', 'http://docs.oracle.com/javase/8/docs/api/')
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest.attributes('Main-Class': mainClassName,
|
manifest.attributes('Main-Class': mainClassName,
|
||||||
'Class-Path': '. ./lib/' + configurations.runtimeClasspath.collect { it.getName() }.join(' ./lib/'))
|
'Class-Path': '. ./lib/' + configurations.runtimeClasspath.collect { it.getName() }.join(' ./lib/'))
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<ID>NestedBlockDepth:Tell.kt$Tell$ @JvmOverloads fun send(nickname: String, isMessage: Boolean = false)</ID>
|
<ID>NestedBlockDepth:Tell.kt$Tell$ @JvmOverloads fun send(nickname: String, isMessage: Boolean = false)</ID>
|
||||||
<ID>NestedBlockDepth:Tell.kt$Tell$// Delete message. private fun deleteMessage(sender: String, args: String, isOp: Boolean, isPrivate: Boolean)</ID>
|
<ID>NestedBlockDepth:Tell.kt$Tell$// Delete message. private fun deleteMessage(sender: String, args: String, isOp: Boolean, isPrivate: Boolean)</ID>
|
||||||
<ID>NestedBlockDepth:TellMessagesMgr.kt$TellMessagesMgr$ fun save(file: String, messages: List<TellMessage?>?, logger: Logger)</ID>
|
<ID>NestedBlockDepth:TellMessagesMgr.kt$TellMessagesMgr$ fun save(file: String, messages: List<TellMessage?>?, logger: Logger)</ID>
|
||||||
|
<ID>NestedBlockDepth:TwitterOAuth.kt$TwitterOAuth$ @Throws(TwitterException::class, IOException::class) @JvmStatic fun main(args: Array<String>)</ID>
|
||||||
<ID>NestedBlockDepth:Weather2.kt$Weather2$ override fun run(sender: String, cmd: String, args: String, isPrivate: Boolean)</ID>
|
<ID>NestedBlockDepth:Weather2.kt$Weather2$ override fun run(sender: String, cmd: String, args: String, isPrivate: Boolean)</ID>
|
||||||
<ID>NestedBlockDepth:Weather2.kt$Weather2.Companion$ @JvmStatic @Throws(ModuleException::class) fun getWeather(query: String, apiKey: String?): List<Message></ID>
|
<ID>NestedBlockDepth:Weather2.kt$Weather2.Companion$ @JvmStatic @Throws(ModuleException::class) fun getWeather(query: String, apiKey: String?): List<Message></ID>
|
||||||
<ID>NestedBlockDepth:WorldTime.kt$WorldTime$override fun commandResponse( sender: String, cmd: String, args: String, isPrivate: Boolean )</ID>
|
<ID>NestedBlockDepth:WorldTime.kt$WorldTime$override fun commandResponse( sender: String, cmd: String, args: String, isPrivate: Boolean )</ID>
|
||||||
|
|
|
@ -27,7 +27,7 @@ tell-max-size=50
|
||||||
#pinboard-api-token=user\:TOKEN
|
#pinboard-api-token=user\:TOKEN
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configure app at: https://apps.twitter.com/
|
# Configure app at: https://developer.twitter.com/en/apps
|
||||||
# and then: java -cp mobibot.jar net.thauvin.erik.mobibot.TwitterOAuth <consumerKey> <consumerSecret>
|
# and then: java -cp mobibot.jar net.thauvin.erik.mobibot.TwitterOAuth <consumerKey> <consumerSecret>
|
||||||
#
|
#
|
||||||
#twitter-consumerKey=
|
#twitter-consumerKey=
|
||||||
|
|
|
@ -48,6 +48,8 @@ import static net.thauvin.erik.mobibot.Utils.bold;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public final class War extends AbstractModule {
|
public final class War extends AbstractModule {
|
||||||
|
// Random
|
||||||
|
private static final SecureRandom RANDOM = new SecureRandom();
|
||||||
// War command
|
// War command
|
||||||
private static final String WAR_CMD = "war";
|
private static final String WAR_CMD = "war";
|
||||||
// Deck of card
|
// Deck of card
|
||||||
|
@ -55,8 +57,6 @@ public final class War extends AbstractModule {
|
||||||
new String[]{ "Ace", "King", "Queen", "Jack", "10", "9", "8", "7", "6", "5", "4", "3", "2" };
|
new String[]{ "Ace", "King", "Queen", "Jack", "10", "9", "8", "7", "6", "5", "4", "3", "2" };
|
||||||
// Suits for the deck of card
|
// Suits for the deck of card
|
||||||
private static final String[] WAR_SUITS = new String[]{ "Hearts", "Spades", "Diamonds", "Clubs" };
|
private static final String[] WAR_SUITS = new String[]{ "Hearts", "Spades", "Diamonds", "Clubs" };
|
||||||
// Random
|
|
||||||
private static final SecureRandom RANDOM = new SecureRandom();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default constructor.
|
* The default constructor.
|
||||||
|
|
|
@ -33,7 +33,7 @@ package net.thauvin.erik.mobibot
|
||||||
|
|
||||||
import net.thauvin.erik.mobibot.commands.AbstractCommand
|
import net.thauvin.erik.mobibot.commands.AbstractCommand
|
||||||
import net.thauvin.erik.mobibot.modules.AbstractModule
|
import net.thauvin.erik.mobibot.modules.AbstractModule
|
||||||
import java.util.*
|
import java.util.Properties
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modules and Commands addons.
|
* Modules and Commands addons.
|
||||||
|
@ -100,8 +100,8 @@ class Addons {
|
||||||
val mods = if (isPrivate) modules.filter { it.isPrivateMsgEnabled } else modules
|
val mods = if (isPrivate) modules.filter { it.isPrivateMsgEnabled } else modules
|
||||||
for (module in mods) {
|
for (module in mods) {
|
||||||
if (module.commands.contains(cmd)) {
|
if (module.commands.contains(cmd)) {
|
||||||
module.commandResponse(sender, cmd, args, isPrivate)
|
module.commandResponse(sender, cmd, args, isPrivate)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
*/
|
*/
|
||||||
package net.thauvin.erik.mobibot
|
package net.thauvin.erik.mobibot
|
||||||
|
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Constants`.
|
* The `Constants`.
|
||||||
|
|
|
@ -64,8 +64,8 @@ import net.thauvin.erik.mobibot.commands.links.View
|
||||||
import net.thauvin.erik.mobibot.commands.tell.Tell
|
import net.thauvin.erik.mobibot.commands.tell.Tell
|
||||||
import net.thauvin.erik.mobibot.entries.EntriesMgr
|
import net.thauvin.erik.mobibot.entries.EntriesMgr
|
||||||
import net.thauvin.erik.mobibot.entries.EntryLink
|
import net.thauvin.erik.mobibot.entries.EntryLink
|
||||||
import net.thauvin.erik.mobibot.modules.CryptoPrices
|
|
||||||
import net.thauvin.erik.mobibot.modules.Calc
|
import net.thauvin.erik.mobibot.modules.Calc
|
||||||
|
import net.thauvin.erik.mobibot.modules.CryptoPrices
|
||||||
import net.thauvin.erik.mobibot.modules.CurrencyConverter
|
import net.thauvin.erik.mobibot.modules.CurrencyConverter
|
||||||
import net.thauvin.erik.mobibot.modules.Dice
|
import net.thauvin.erik.mobibot.modules.Dice
|
||||||
import net.thauvin.erik.mobibot.modules.GoogleSearch
|
import net.thauvin.erik.mobibot.modules.GoogleSearch
|
||||||
|
@ -99,7 +99,8 @@ import java.io.IOException
|
||||||
import java.io.PrintStream
|
import java.io.PrintStream
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.*
|
import java.util.Properties
|
||||||
|
import java.util.Timer
|
||||||
import java.util.logging.ConsoleHandler
|
import java.util.logging.ConsoleHandler
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
@ -358,7 +359,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert
|
||||||
helpResponse(sender, args, true)
|
helpResponse(sender, args, true)
|
||||||
} else if (isOp && Constants.KILL_CMD == cmd) { // kill
|
} else if (isOp && Constants.KILL_CMD == cmd) { // kill
|
||||||
twitter.notification("$name killed by $sender on $channel")
|
twitter.notification("$name killed by $sender on $channel")
|
||||||
sendRawLine("QUIT : Poof!")
|
sendRawLine("QUIT :Poof!")
|
||||||
exitProcess(0)
|
exitProcess(0)
|
||||||
} else if (isOp && Constants.DIE_CMD == cmd) { // die
|
} else if (isOp && Constants.DIE_CMD == cmd) { // die
|
||||||
send("$sender has just signed my death sentence.")
|
send("$sender has just signed my death sentence.")
|
||||||
|
@ -492,8 +493,7 @@ class Mobibot(nickname: String, channel: String, logsDirPath: String, p: Propert
|
||||||
* Returns the bot's version.
|
* Returns the bot's version.
|
||||||
*/
|
*/
|
||||||
override fun onVersion(sourceNick: String, sourceLogin: String, sourceHostname: String, target: String) {
|
override fun onVersion(sourceNick: String, sourceLogin: String, sourceHostname: String, target: String) {
|
||||||
sendRawLine("NOTICE " + sourceNick + " :\u0001VERSION " + ReleaseInfo.PROJECT + ' ' + ReleaseInfo.VERSION
|
sendRawLine("NOTICE $sourceNick :\u0001VERSION ${ReleaseInfo.PROJECT} ${ReleaseInfo.VERSION}\u0001")
|
||||||
+ "\u0001")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
package net.thauvin.erik.mobibot
|
package net.thauvin.erik.mobibot
|
||||||
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import net.thauvin.erik.mobibot.entries.EntryLink
|
import net.thauvin.erik.mobibot.entries.EntryLink
|
||||||
|
@ -40,7 +39,7 @@ import net.thauvin.erik.pinboard.PinboardPoster
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.*
|
import java.util.Date
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles posts to pinboard.in.
|
* Handles posts to pinboard.in.
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
package net.thauvin.erik.mobibot
|
package net.thauvin.erik.mobibot
|
||||||
|
|
||||||
import java.util.*
|
import java.util.TimerTask
|
||||||
|
|
||||||
class TwitterTimer(var bot: Mobibot, private var index: Int) : TimerTask() {
|
class TwitterTimer(var bot: Mobibot, private var index: Int) : TimerTask() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
|
|
@ -44,7 +44,7 @@ import java.nio.charset.StandardCharsets
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.util.*
|
import java.util.Date
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.stream.Collectors
|
import java.util.stream.Collectors
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ class Tell(bot: Mobibot) : AbstractCommand(bot) {
|
||||||
const val MAX_DAYS_PROP = "tell-max-days"
|
const val MAX_DAYS_PROP = "tell-max-days"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max size proeprty.
|
* Max size property.
|
||||||
*/
|
*/
|
||||||
const val MAX_SIZE_PROP = "tell-max-size"
|
const val MAX_SIZE_PROP = "tell-max-size"
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ import java.io.OutputStreamWriter
|
||||||
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
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the feed entries.
|
* Manages the feed entries.
|
||||||
|
|
|
@ -36,7 +36,8 @@ import com.rometools.rome.feed.synd.SyndCategoryImpl
|
||||||
import net.thauvin.erik.mobibot.commands.links.LinksMgr
|
import net.thauvin.erik.mobibot.commands.links.LinksMgr
|
||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class used to store link entries.
|
* The class used to store link entries.
|
||||||
|
|
|
@ -52,10 +52,10 @@ class Calc(bot: Mobibot) : AbstractModule(bot) {
|
||||||
try {
|
try {
|
||||||
bot.send(calculate(args))
|
bot.send(calculate(args))
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
if (bot.logger.isWarnEnabled) bot.logger.warn("Failed to calcualte: $args", e)
|
if (bot.logger.isWarnEnabled) bot.logger.warn("Failed to calculate: $args", e)
|
||||||
bot.send("No idea. This is the kind of math I don't get.")
|
bot.send("No idea. This is the kind of math I don't get.")
|
||||||
} catch (e: UnknownFunctionOrVariableException) {
|
} catch (e: UnknownFunctionOrVariableException) {
|
||||||
if (bot.logger.isWarnEnabled) bot.logger.warn("Unable to calcualte: $args", e)
|
if (bot.logger.isWarnEnabled) bot.logger.warn("Unable to calculate: $args", e)
|
||||||
bot.send("No idea. I must've some form of Dyscalculia.")
|
bot.send("No idea. I must've some form of Dyscalculia.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -79,7 +79,7 @@ class StockQuote(bot: Mobibot) : ThreadedModule(bot) {
|
||||||
const val INVALID_SYMBOL = "Invalid symbol."
|
const val INVALID_SYMBOL = "Invalid symbol."
|
||||||
|
|
||||||
// Alpha Advantage URL
|
// Alpha Advantage URL
|
||||||
private const val ALAPHAVANTAGE_URL = "https://www.alphavantage.co/query?function="
|
private const val ALPHAVANTAGE_URL = "https://www.alphavantage.co/query?function="
|
||||||
|
|
||||||
// Quote command
|
// Quote command
|
||||||
private const val STOCK_CMD = "stock"
|
private const val STOCK_CMD = "stock"
|
||||||
|
@ -122,7 +122,8 @@ class StockQuote(bot: Mobibot) : ThreadedModule(bot) {
|
||||||
fun getQuote(symbol: String, apiKey: String?): List<Message> {
|
fun getQuote(symbol: String, apiKey: String?): List<Message> {
|
||||||
if (apiKey.isNullOrBlank()) {
|
if (apiKey.isNullOrBlank()) {
|
||||||
throw ModuleException(
|
throw ModuleException(
|
||||||
"${Utils.capitalize(STOCK_CMD)} is disabled. The API key is missing.")
|
"${Utils.capitalize(STOCK_CMD)} is disabled. The API key is missing."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return if (symbol.isNotBlank()) {
|
return if (symbol.isNotBlank()) {
|
||||||
val debugMessage = "getQuote($symbol)"
|
val debugMessage = "getQuote($symbol)"
|
||||||
|
@ -132,10 +133,10 @@ class StockQuote(bot: Mobibot) : ThreadedModule(bot) {
|
||||||
with(messages) {
|
with(messages) {
|
||||||
// Search for symbol/keywords
|
// Search for symbol/keywords
|
||||||
response = Utils.urlReader(
|
response = Utils.urlReader(
|
||||||
URL(
|
URL(
|
||||||
"${ALAPHAVANTAGE_URL}SYMBOL_SEARCH&keywords=" + Utils.encodeUrl(symbol)
|
"${ALPHAVANTAGE_URL}SYMBOL_SEARCH&keywords=" + Utils.encodeUrl(symbol)
|
||||||
+ "&apikey=" + Utils.encodeUrl(apiKey)
|
+ "&apikey=" + Utils.encodeUrl(apiKey)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
var json = getJsonResponse(response, debugMessage)
|
var json = getJsonResponse(response, debugMessage)
|
||||||
val symbols = json.getJSONArray("bestMatches")
|
val symbols = json.getJSONArray("bestMatches")
|
||||||
|
@ -146,11 +147,11 @@ class StockQuote(bot: Mobibot) : ThreadedModule(bot) {
|
||||||
|
|
||||||
// Get quote for symbol
|
// Get quote for symbol
|
||||||
response = Utils.urlReader(
|
response = Utils.urlReader(
|
||||||
URL(
|
URL(
|
||||||
"${ALAPHAVANTAGE_URL}GLOBAL_QUOTE&symbol="
|
"${ALPHAVANTAGE_URL}GLOBAL_QUOTE&symbol="
|
||||||
+ Utils.encodeUrl(symbolInfo.getString("1. symbol"))
|
+ Utils.encodeUrl(symbolInfo.getString("1. symbol"))
|
||||||
+ "&apikey=" + Utils.encodeUrl(apiKey)
|
+ "&apikey=" + Utils.encodeUrl(apiKey)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
json = getJsonResponse(response, debugMessage)
|
json = getJsonResponse(response, debugMessage)
|
||||||
val quote = json.getJSONObject("Global Quote")
|
val quote = json.getJSONObject("Global Quote")
|
||||||
|
@ -159,36 +160,36 @@ class StockQuote(bot: Mobibot) : ThreadedModule(bot) {
|
||||||
return messages
|
return messages
|
||||||
}
|
}
|
||||||
add(
|
add(
|
||||||
PublicMessage(
|
PublicMessage(
|
||||||
"Symbol: " + Utils.unescapeXml(quote.getString("01. symbol"))
|
"Symbol: " + Utils.unescapeXml(quote.getString("01. symbol"))
|
||||||
+ " [" + Utils.unescapeXml(symbolInfo.getString("2. name")) + ']'
|
+ " [" + Utils.unescapeXml(symbolInfo.getString("2. name")) + ']'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(PublicMessage(" Price: " + Utils.unescapeXml(quote.getString("05. price"))))
|
add(PublicMessage(" Price: " + Utils.unescapeXml(quote.getString("05. price"))))
|
||||||
add(
|
add(
|
||||||
PublicMessage(
|
PublicMessage(
|
||||||
" Previous: " + Utils.unescapeXml(quote.getString("08. previous close"))
|
" Previous: " + Utils.unescapeXml(quote.getString("08. previous close"))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(NoticeMessage(" Open: " + Utils.unescapeXml(quote.getString("02. open"))))
|
add(NoticeMessage(" Open: " + Utils.unescapeXml(quote.getString("02. open"))))
|
||||||
add(NoticeMessage(" High: " + Utils.unescapeXml(quote.getString("03. high"))))
|
add(NoticeMessage(" High: " + Utils.unescapeXml(quote.getString("03. high"))))
|
||||||
add(NoticeMessage(" Low: " + Utils.unescapeXml(quote.getString("04. low"))))
|
add(NoticeMessage(" Low: " + Utils.unescapeXml(quote.getString("04. low"))))
|
||||||
add(
|
add(
|
||||||
NoticeMessage(
|
NoticeMessage(
|
||||||
" Volume: " + Utils.unescapeXml(quote.getString("06. volume"))
|
" Volume: " + Utils.unescapeXml(quote.getString("06. volume"))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(
|
add(
|
||||||
NoticeMessage(
|
NoticeMessage(
|
||||||
" Latest: "
|
" Latest: "
|
||||||
+ Utils.unescapeXml(quote.getString("07. latest trading day"))
|
+ Utils.unescapeXml(quote.getString("07. latest trading day"))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(
|
add(
|
||||||
NoticeMessage(
|
NoticeMessage(
|
||||||
" Change: " + Utils.unescapeXml(quote.getString("09. change")) + " ["
|
" Change: " + Utils.unescapeXml(quote.getString("09. change")) + " ["
|
||||||
+ Utils.unescapeXml(quote.getString("10. change percent")) + ']'
|
+ Utils.unescapeXml(quote.getString("10. change percent")) + ']'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ import net.thauvin.erik.mobibot.msg.NoticeMessage
|
||||||
import twitter4j.TwitterException
|
import twitter4j.TwitterException
|
||||||
import twitter4j.TwitterFactory
|
import twitter4j.TwitterFactory
|
||||||
import twitter4j.conf.ConfigurationBuilder
|
import twitter4j.conf.ConfigurationBuilder
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Twitter module.
|
* The Twitter module.
|
||||||
|
|
|
@ -102,7 +102,8 @@ class Weather2(bot: Mobibot) : ThreadedModule(bot) {
|
||||||
fun getWeather(query: String, apiKey: String?): List<Message> {
|
fun getWeather(query: String, apiKey: String?): List<Message> {
|
||||||
if (apiKey.isNullOrBlank()) {
|
if (apiKey.isNullOrBlank()) {
|
||||||
throw ModuleException(
|
throw ModuleException(
|
||||||
"${Utils.capitalize(WEATHER_CMD)} is disabled. The API key is missing.")
|
"${Utils.capitalize(WEATHER_CMD)} is disabled. The API key is missing."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
val owm = OWM(apiKey)
|
val owm = OWM(apiKey)
|
||||||
val messages = mutableListOf<Message>()
|
val messages = mutableListOf<Message>()
|
||||||
|
|
|
@ -41,8 +41,8 @@ import java.time.ZoneId
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.time.temporal.ChronoField
|
import java.time.temporal.ChronoField
|
||||||
import java.util.*
|
import java.util.Collections
|
||||||
import kotlin.collections.ArrayList
|
import java.util.Locale
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WorldTime module.
|
* The WorldTime module.
|
||||||
|
@ -146,7 +146,7 @@ class WorldTime(bot: Mobibot) : AbstractModule(bot) {
|
||||||
countries["MX"] = "America/Mexico_City"
|
countries["MX"] = "America/Mexico_City"
|
||||||
countries["NL"] = "Europe/Amsterdam"
|
countries["NL"] = "Europe/Amsterdam"
|
||||||
countries["NO"] = "Europe/Oslo"
|
countries["NO"] = "Europe/Oslo"
|
||||||
countries["NP"] = "Asia/Katmandu"
|
countries["NP"] = "Asia/Kathmandu"
|
||||||
countries["NZ"] = "Pacific/Auckland"
|
countries["NZ"] = "Pacific/Auckland"
|
||||||
countries["PDT"] = "America/Los_Angeles"
|
countries["PDT"] = "America/Los_Angeles"
|
||||||
countries["PH"] = "Asia/Manila"
|
countries["PH"] = "Asia/Manila"
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.testng.annotations.BeforeSuite
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.*
|
import java.util.Properties
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to `local.properties`.
|
* Access to `local.properties`.
|
||||||
|
|
|
@ -56,7 +56,7 @@ import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
import java.util.Calendar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Utils Test` class.
|
* The `Utils Test` class.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Wed May 12 19:01:23 PDT 2021
|
#Thu May 13 21:34:31 PDT 2021
|
||||||
version.buildmeta=751
|
version.buildmeta=771
|
||||||
version.major=0
|
version.major=0
|
||||||
version.minor=8
|
version.minor=8
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
version.project=mobibot
|
version.project=mobibot
|
||||||
version.semver=0.8.0-beta+751
|
version.semver=0.8.0-beta+771
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue