diff --git a/.gitignore b/.gitignore
index f9ff432..f02e4e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
#build
/build/
/bin/
+/out/
.metals/
.bloop/
.project
diff --git a/gradle.properties b/gradle.properties
index 1a9ee69..f7385a5 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s
-VERSION = 1.0.0-RC4
+VERSION = 1.0.0-RC5
USE_DELTA = true
VERSION_DELTA = scalaport4
diff --git a/src/main/scala/cc/sukazyo/cono/morny/MornySystem.scala b/src/main/scala/cc/sukazyo/cono/morny/MornySystem.scala
index 7e052eb..b355595 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/MornySystem.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/MornySystem.scala
@@ -17,6 +17,7 @@ object MornySystem {
@BuildConfigField val VERSION_DELTA: String = BuildConfig.VERSION_DELTA
@BuildConfigField val CODENAME: String = BuildConfig.CODENAME
@BuildConfigField val CODE_STORE: String = BuildConfig.CODE_STORE
+ //noinspection ScalaWeakerAccess
@BuildConfigField val COMMIT_PATH: String = BuildConfig.COMMIT_PATH
@BuildConfigField
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.scala
index 7971d95..fb01c86 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.scala
@@ -25,6 +25,10 @@ object DirectMsgClear extends ISimpleCommand {
logger trace "message is not outdated(48 hrs ago)"
val isTrusted = MornyCoeur.trusted isTrusted event.message.from.id
+ // todo:
+ // it does not work. due to the Telegram Bot API doesn't provide
+ // nested replyToMessage, so currently the trusted check by
+ // replyToMessage.replyToMessage will not work!
def _isReplyTrusted: Boolean =
if (event.message.replyToMessage.replyToMessage == null) false
else if (event.message.replyToMessage.replyToMessage.from.id == event.message.from.id) true
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyInformation.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyInformation.scala
index 516ddd7..8a55bc7 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyInformation.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyInformation.scala
@@ -14,6 +14,7 @@ import java.net.InetAddress
import java.rmi.UnknownHostException
import scala.language.postfixOps
+// todo: maybe move some utils method outside
object MornyInformation extends ITelegramCommand {
private case object Subs {
@@ -46,6 +47,7 @@ object MornyInformation extends ITelegramCommand {
}
+ //noinspection ScalaWeakerAccess
def getVersionGitTagHTML: String = {
if (!MornySystem.isGitBuild) return ""
val g = StringBuilder()
@@ -61,11 +63,12 @@ object MornyInformation extends ITelegramCommand {
val v = StringBuilder()
v ++= s"${MornySystem VERSION_BASE}
"
if (MornySystem isUseDelta) v++=s"-δ${MornySystem VERSION_DELTA}
"
- if (MornySystem isGitBuild) v++="+"++=getVersionGitTagHTML
+ if (MornySystem isGitBuild) v++="+git."++=getVersionGitTagHTML
v ++= s"*${MornySystem.CODENAME toUpperCase}
"
v toString
}
+ //noinspection ScalaWeakerAccess
def getRuntimeHostname: String|Null = {
try InetAddress.getLocalHost.getHostName
catch case _:UnknownHostException => null
@@ -154,13 +157,13 @@ object MornyInformation extends ITelegramCommand {
event.message.chat.id,
/* language=html */
s"""system:
- |- Morny ${h(if (getRuntimeHostname == null) "" else getRuntimeHostname)}
+ |- ${h(if (getRuntimeHostname == null) "" else getRuntimeHostname)}
|- ${h(sysprop("os.name"))}
${h(sysprop("os.arch"))}
${h(sysprop("os.version"))}
|java runtime:
|- ${h(sysprop("java.vm.vendor"))}.${h(sysprop("java.vm.name"))}
|- ${h(sysprop("java.vm.version"))}
|vm memory:
- |- ${Runtime.getRuntime.totalMemory/1024/1024}
/ ${Runtime.getRuntime.maxMemory/1024/1024}
+ |- ${Runtime.getRuntime.totalMemory/1024/1024}
/ ${Runtime.getRuntime.maxMemory/1024/1024}
MB
|- ${Runtime.getRuntime.availableProcessors}
cores
|coeur version:
|- $getVersionAllFullTagHTML
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyOldJrrp.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyOldJrrp.scala
index 327d7df..c859f14 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyOldJrrp.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/command/MornyOldJrrp.scala
@@ -28,7 +28,7 @@ object MornyOldJrrp extends ITelegramCommand {
MornyCoeur.extra exec SendMessage(
event.message.chat.id,
// language=html
- f"${user.fullnameRefHTML} 在(utc的)今天的运气指数是———— $jrrp%.2f%%
${h(ending)}"
+ f"${user.fullnameRefHTML} 在(utc的)今天的运气指数是———— $jrrp%.2f%%
${h(ending)}"
).replyToMessageId(event.message.messageId).parseMode(ParseMode HTML)
}
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/command/Nbnhhsh.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/command/Nbnhhsh.scala
index 4d7e343..32e6819 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/command/Nbnhhsh.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/command/Nbnhhsh.scala
@@ -25,10 +25,10 @@ object Nbnhhsh extends ITelegramCommand {
override def execute (using command: InputCommand, event: Update): Unit = {
val queryTarget: String|Null =
- if (event.message.replyToMessage != null && event.message.replyToMessage.text != null)
- event.message.replyToMessage.text
- else if command.args nonEmpty then
+ if command.args nonEmpty then
command.args mkString " "
+ else if (event.message.replyToMessage != null && event.message.replyToMessage.text != null)
+ event.message.replyToMessage.text
else null
if (queryTarget == null)
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/command/喵呜.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/command/喵呜.scala
index bf36bab..109077e 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/command/喵呜.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/command/喵呜.scala
@@ -3,15 +3,15 @@ package cc.sukazyo.cono.morny.bot.command
import cc.sukazyo.cono.morny.MornyCoeur
import cc.sukazyo.cono.morny.data.TelegramStickers
import cc.sukazyo.cono.morny.util.tgapi.InputCommand
-import com.pengrad.telegrambot.model.request.ParseMode
import com.pengrad.telegrambot.model.{Message, Update}
+import com.pengrad.telegrambot.model.request.ParseMode
import com.pengrad.telegrambot.request.{SendMessage, SendSticker}
import javax.swing.text.html.HTML
import scala.annotation.unused
import scala.language.postfixOps
-@SuppressWarnings(Array("NonAsciiCharacters"))
+//noinspection NonAsciiCharacters
object 喵呜 {
object 抱抱 extends ISimpleCommand {
@@ -56,7 +56,7 @@ object 喵呜 {
}
private def replyingSet (whileRec: String, whileNew: String)(using event: Update): Unit = {
- val isNew = event.message.replyToMessage == null;
+ val isNew = event.message.replyToMessage == null
val target = if (isNew) event.message else event.message.replyToMessage
MornyCoeur.extra exec new SendMessage(
event.message.chat.id,
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/command/私わね.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/command/私わね.scala
index 8696bb8..5321657 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/command/私わね.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/command/私わね.scala
@@ -7,6 +7,7 @@ import cc.sukazyo.cono.morny.util.UseRandom.*
import com.pengrad.telegrambot.model.Update
import com.pengrad.telegrambot.request.SendMessage
+//noinspection NonAsciiCharacters
object 私わね extends ISimpleCommand {
override val name: String = "me"
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnCallMe.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnCallMe.scala
index a8d16b3..07f4d96 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnCallMe.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnCallMe.scala
@@ -52,6 +52,8 @@ object OnCallMe extends EventListener {
var isAllowed = false
var lastDinnerData: Message|Null = null
if (MornyCoeur.trusted isTrusted_dinnerReader req.from.id) {
+ // todo: have issues
+ // i dont want to test it anymore... it might be deprecated soon
lastDinnerData = (MornyCoeur.extra exec GetChat(MornyCoeur.config.dinnerChatId)).chat.pinnedMessage
val sendResp = MornyCoeur.extra exec ForwardMessage(
req.from.id,
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnEventHackHandle.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnEventHackHandle.scala
index 121b3ef..f42d9e9 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnEventHackHandle.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnEventHackHandle.scala
@@ -52,9 +52,9 @@ object OnEventHackHandle extends EventListener {
override def onEditedMessage (using update: Update): Boolean =
onEventHacked(update.editedMessage.chat.id, update.editedMessage.from.id)
override def onChannelPost (using update: Update): Boolean =
- onEventHacked(update.channelPost.chat.id, update.channelPost.from.id)
+ onEventHacked(update.channelPost.chat.id, 0)
override def onEditedChannelPost (using update: Update): Boolean =
- onEventHacked(update.editedChannelPost.chat.id, update.editedChannelPost.from.id)
+ onEventHacked(update.editedChannelPost.chat.id, 0)
override def onInlineQuery (using update: Update): Boolean =
onEventHacked(0, update.inlineQuery.from.id)
override def onChosenInlineResult (using update: Update): Boolean =
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnQuestionMarkReply.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnQuestionMarkReply.scala
index 601cafc..3d73a09 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnQuestionMarkReply.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnQuestionMarkReply.scala
@@ -9,7 +9,14 @@ import scala.language.postfixOps
object OnQuestionMarkReply extends EventListener {
- private def QUESTION_MARKS = Set('?', '?', '¿', '⁈', '⁇', '‽', '❔', '❓')
+ private val QUESTION_MARKS = Set('?', '?', '¿', '⁈', '⁇', '‽', '❔', '❓')
+
+ def isAllMessageMark (using text: String): Boolean = {
+ var isAll = true
+ for (c <- text)
+ if !(QUESTION_MARKS contains c) then isAll = false
+ isAll
+ }
override def onMessage (using event: Update): Boolean = {
@@ -18,8 +25,7 @@ object OnQuestionMarkReply extends EventListener {
import cc.sukazyo.cono.morny.util.UseMath.over
import cc.sukazyo.cono.morny.util.UseRandom.chance_is
if (1 over 8) chance_is false then return false
- for (c <- event.message.text toCharArray)
- if !(QUESTION_MARKS contains c) then return false
+ if !isAllMessageMark(using event.message.text) then return false
MornyCoeur.extra exec SendMessage(
event.message.chat.id, event.message.text
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnTelegramCommand.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnTelegramCommand.scala
index a2ef6ea..a850f21 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnTelegramCommand.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnTelegramCommand.scala
@@ -22,7 +22,7 @@ object OnTelegramCommand extends EventListener {
if (!(inputCommand.command matches "^\\w+$"))
logger debug "not command"
false
- else if ((inputCommand.target ne null) && (inputCommand.target ne MornyCoeur.username))
+ else if ((inputCommand.target ne null) && (inputCommand.target != MornyCoeur.username))
logger debug "not morny command"
false
else
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala
index df18cb7..e47f3ce 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserRandom.scala
@@ -9,13 +9,13 @@ import scala.language.postfixOps
object OnUserRandom extends EventListener {
- private val USER_OR_QUERY = "(.+)(?:还是|or)(.+)"r
- private val USER_IF_QUERY = "(.+)[吗?|?]+$"r
+ private val USER_OR_QUERY = "^(.+)(?:还是|or)(.+)$"r
+ private val USER_IF_QUERY = "^(.+)(?:吗\\?|?|\\?|吗?)$"r
override def onMessage(using update: Update): Boolean = {
if update.message.text == null then return false
- if update.message.text startsWith "/" then return false
+ if !(update.message.text startsWith "/") then return false
import cc.sukazyo.cono.morny.util.UseRandom.rand_half
val query = update.message.text substring 1
@@ -23,6 +23,8 @@ object OnUserRandom extends EventListener {
case USER_OR_QUERY(_con1, _con2) =>
if rand_half then _con1 else _con2
case USER_IF_QUERY(_con) =>
+ // for capability with [[OnQuestionMarkReply]]
+ if OnQuestionMarkReply.isAllMessageMark(using _con) then return false
(if rand_half then "不" else "") + _con
case _ => null
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.scala
index 1778dfc..db80040 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.scala
@@ -22,14 +22,24 @@ object OnUserSlashAction extends EventListener {
if (text startsWith "/") {
+ // there has to be some special conditions for DP7
+ // due to I have left DP7, I closed those special
+ // conditions.
+ // that is 2022, May 28th
+ // when one year goes, These code have rewrite with
+ // scala, those commented code is removed permanently.
+ // these message, here to remember the old DP7.
+
val actions = UniversalCommand(text)
actions(0) = actions(0) substring 1
actions(0)
actions(0) match
+ // ignore Telegram command like
case TG_FORMAT(_) =>
return false
+ // ignore Path link
case x if x contains "/" => return false
case _ =>
@@ -55,7 +65,7 @@ object OnUserSlashAction extends EventListener {
h(v_verb), if hasObject then "" else "了",
if (origin == target)
s"自己"
- else origin.sender_firstnameRefHTML,
+ else target.sender_firstnameRefHTML,
if hasObject then h(v_object+" ") else ""
)
).parseMode(ParseMode HTML).replyToMessageId(update.message.messageId)
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/query/MyInformation.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/query/MyInformation.scala
index b6066e0..2c8aa58 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/query/MyInformation.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/query/MyInformation.scala
@@ -14,7 +14,7 @@ object MyInformation extends ITelegramQuery {
override def query (event: Update): List[InlineQueryUnit[_]] | Null = {
- if ((event.inlineQuery.query ne null) || (event.inlineQuery.query nonEmpty)) return null
+ if !((event.inlineQuery.query eq null) || (event.inlineQuery.query isEmpty)) then return null
List(
InlineQueryUnit(InlineQueryResultArticle(
diff --git a/src/main/scala/cc/sukazyo/cono/morny/bot/query/ShareToolTwitter.scala b/src/main/scala/cc/sukazyo/cono/morny/bot/query/ShareToolTwitter.scala
index 572c32e..baff446 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/bot/query/ShareToolTwitter.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/bot/query/ShareToolTwitter.scala
@@ -9,11 +9,11 @@ import scala.util.matching.Regex
object ShareToolTwitter extends ITelegramQuery {
- val TITLE_VX = "[tweet] Share as VxTwitter"
- val TITLE_VX_COMBINED = "[tweet] Share as VxTwitter(combination)"
- val ID_PREFIX_VX = "[morny/share/twitter/vxtwi]"
- val ID_PREFIX_VX_COMBINED = "[morny/share/twitter/vxtwi_combine]"
- val REGEX_TWEET_LINK: Regex = "^(?:https?://)?((?:(?:c\\.)?vx|fx|www\\.)?twitter\\.com)/((\\w+)/status/(\\d+)(?:/photo/(\\d+))?)/?(\\?[\\w&=-]+)?$"r
+ private val TITLE_VX = "[tweet] Share as VxTwitter"
+ private val TITLE_VX_COMBINED = "[tweet] Share as VxTwitter(combination)"
+ private val ID_PREFIX_VX = "[morny/share/twitter/vxtwi]"
+ private val ID_PREFIX_VX_COMBINED = "[morny/share/twitter/vxtwi_combine]"
+ private val REGEX_TWEET_LINK: Regex = "^(?:https?://)?((?:(?:c\\.)?vx|fx|www\\.)?twitter\\.com)/((\\w+)/status/(\\d+)(?:/photo/(\\d+))?)/?(\\?[\\w&=-]+)?$"r
override def query (event: Update): List[InlineQueryUnit[_]] | Null = {
@@ -21,7 +21,7 @@ object ShareToolTwitter extends ITelegramQuery {
event.inlineQuery.query match
- case REGEX_TWEET_LINK(_1, _2, _) =>
+ case REGEX_TWEET_LINK(_, _2, _, _, _, _) =>
List(
InlineQueryUnit(InlineQueryResultArticle(
inlineQueryId(ID_PREFIX_VX+event.inlineQuery.query), TITLE_VX,
diff --git a/src/main/scala/cc/sukazyo/cono/morny/daemon/MornyReport.scala b/src/main/scala/cc/sukazyo/cono/morny/daemon/MornyReport.scala
index 9591fb1..7d39431 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/daemon/MornyReport.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/daemon/MornyReport.scala
@@ -74,6 +74,7 @@ object MornyReport {
).parseMode(ParseMode HTML))
}
+ //noinspection ScalaWeakerAccess
def sectionConfigFields (config: MornyConfig): String = {
val echo = StringBuilder()
for (field <- config.getClass.getFields) {
diff --git a/src/main/scala/cc/sukazyo/cono/morny/data/MornyJrrp.scala b/src/main/scala/cc/sukazyo/cono/morny/data/MornyJrrp.scala
index d6ec709..b707576 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/data/MornyJrrp.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/data/MornyJrrp.scala
@@ -12,6 +12,6 @@ object MornyJrrp {
private def jrrp_v_xmomi (identifier: Long, dayStamp: Long): Double =
import cc.sukazyo.cono.morny.util.CommonEncrypt.MD5
import cc.sukazyo.cono.morny.util.ConvertByteHex.toHex
- (java.lang.Long parseLong MD5(s"$identifier@$dayStamp").toHex.substring(0, 4)) / (0xffff toDouble)
+ java.lang.Long.parseLong(MD5(s"$identifier@$dayStamp").toHex.substring(0, 4), 16) / (0xffff toDouble)
}
diff --git a/src/main/scala/cc/sukazyo/cono/morny/data/ip186/IP186QueryHandler.scala b/src/main/scala/cc/sukazyo/cono/morny/data/ip186/IP186QueryHandler.scala
index f9dc533..d045cc5 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/data/ip186/IP186QueryHandler.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/data/ip186/IP186QueryHandler.scala
@@ -19,6 +19,7 @@ object IP186QueryHandler {
commonQuery(SITE_URL + ip, QUERY_PARAM_IP)
@throws[IOException]
+ //noinspection ScalaWeakerAccess
def query_whois (domain: String): IP186Response =
commonQuery(SITE_URL+"whois/"+domain, QUERY_PARAM_WHOIS)
diff --git a/src/main/scala/cc/sukazyo/cono/morny/internal/ScalaJavaConv.scala b/src/main/scala/cc/sukazyo/cono/morny/internal/ScalaJavaConv.scala
deleted file mode 100644
index 3547a2b..0000000
--- a/src/main/scala/cc/sukazyo/cono/morny/internal/ScalaJavaConv.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package cc.sukazyo.cono.morny.internal
-
-import scala.jdk.CollectionConverters._
-import scala.collection.immutable as simm
-import java.util as j
-
-object ScalaJavaConv {
-
- def jSetInteger2simm (data: j.Set[Integer]): simm.Set[Int] =
- data.asScala.toSet.map(_.intValue)
-
-}
diff --git a/src/main/scala/cc/sukazyo/cono/morny/util/UniversalCommand.scala b/src/main/scala/cc/sukazyo/cono/morny/util/UniversalCommand.scala
index 65a1e87..9aa6e5c 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/util/UniversalCommand.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/util/UniversalCommand.scala
@@ -36,8 +36,7 @@ object UniversalCommand {
arg = arg.empty
} else if (input(i) isQuote) {
val _inside_tag = input(i)
- var _inside = true
- boundary { while (_inside) {
+ boundary { while (true) {
i=i+1
if (i >= input.length) throw IllegalArgumentException("UniversalCommand: unclosed quoted text")
if (input(i) == _inside_tag)
diff --git a/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/ExtraAction.java b/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/ExtraAction.java
index 784e6c6..b7f19ee 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/ExtraAction.java
+++ b/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/ExtraAction.java
@@ -32,7 +32,7 @@ public class ExtraAction {
public , R extends BaseResponse> R exec (T req, String errorMessage) {
final R resp = bot.execute(req);
if (!resp.isOk()) throw new EventRuntimeException.ActionFailed(
- (errorMessage.equals("") ? String.valueOf(resp.errorCode()) : errorMessage),
+ (errorMessage.isEmpty() ? String.valueOf(resp.errorCode()) : errorMessage),
resp
);
return resp;
diff --git a/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramFormatter.scala b/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramFormatter.scala
index acc0d49..48fd6ef 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramFormatter.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramFormatter.scala
@@ -22,6 +22,7 @@ object TelegramFormatter {
case _ => s"@[c/${chat.id}]"
else s"@${h(chat.username)}"
+ //noinspection ScalaWeakerAccess
def safe_firstnameRefHTML: String =
chat.`type` match
// language=html
@@ -29,6 +30,7 @@ object TelegramFormatter {
// language=html
case _ => s"${h(chat.title)}"
+ //noinspection ScalaWeakerAccess
def id_tdLib: Long =
if chat.id < 0 then (chat.id - MASK_BOTAPI_ID)abs else chat.id
@@ -42,12 +44,14 @@ object TelegramFormatter {
extension (user: User) {
+ //noinspection ScalaWeakerAccess
def fullname: String = _connectName(user.firstName, user.lastName)
def fullnameRefHTML: String =
// language=html
s"${h(user.fullname)}"
+ //noinspection ScalaWeakerAccess
def firstnameRefHTML: String =
// language=html
s"${h(user.firstName)}"
diff --git a/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramUserInformation.scala b/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramUserInformation.scala
index 81d87ee..88a9501 100644
--- a/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramUserInformation.scala
+++ b/src/main/scala/cc/sukazyo/cono/morny/util/tgapi/formatting/TelegramUserInformation.scala
@@ -9,8 +9,8 @@ import scala.util.Using
object TelegramUserInformation {
- val DC_QUERY_SOURCE_SITE = "https://t.me/"
- val DC_QUERY_PROCESSOR_REGEX: Regex = "(cdn[1-9]).tele(sco.pe|gram-cdn.org)"r
+ private val DC_QUERY_SOURCE_SITE = "https://t.me/"
+ private val DC_QUERY_PROCESSOR_REGEX: Regex = "(cdn[1-9]).tele(sco.pe|gram-cdn.org)"r
private val httpClient = OkHttpClient()