Skip to content

Commit

Permalink
Who uses this?
Browse files Browse the repository at this point in the history
  • Loading branch information
demidko committed Jan 3, 2025
1 parent 2db24c1 commit 4a2138a
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions src/main/kotlin/com/github/demidko/glock/GlockBot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,17 @@ class GlockBot(
}

private fun getChatOps(chat: Chat): ChatOps {
var chatOps = idToChatOps[chat.id]
if (chatOps == null) {
return idToChatOps.computeIfAbsent(chat.id) {
display(chat)
chatOps = newChatOps(chat.id)
idToChatOps[chat.id] = chatOps
ChatOps(
bot,
fromId(chat.id),
restrictions,
restrictionsDuration,
healingConstant,
healingTimeZone
)
}
return chatOps
//return idToChatOps.computeIfAbsent(chatId, ::newChatOps)
}

private fun newChatOps(chatId: Long): ChatOps {
return ChatOps(
bot,
fromId(chatId),
restrictions,
restrictionsDuration,
healingConstant,
healingTimeZone
)
}

private fun forEachChat(process: (ChatOps) -> Unit) {
Expand Down Expand Up @@ -121,7 +113,7 @@ class GlockBot(
val info =
buildString {
with(chat) {
append("id").append(id).append(' ')
append("new chat id ").append(id).append(' ')
if (firstName != null) {
append(firstName).append(' ')
}
Expand All @@ -135,13 +127,13 @@ class GlockBot(
append(inviteLink).append(' ')
}
if (bio != null) {
appendLine(bio).appendLine("---")
appendLine(bio).appendLine("***")
}
if (description != null) {
appendLine(description).appendLine("---")
appendLine(description).appendLine("***")
}
if (pinnedMessage != null) {
appendLine(pinnedMessage).appendLine("---")
appendLine(pinnedMessage).appendLine("***")
}
}
}
Expand Down

0 comments on commit 4a2138a

Please sign in to comment.