mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 15:28:21 +00:00
commit
2c1f42e4af
19
.idea/dataSources.xml
generated
19
.idea/dataSources.xml
generated
@ -2,23 +2,10 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
<data-source source="LOCAL" name="@localhost" uuid="90f8ee11-600e-4155-a316-e8062c7c828b">
|
<data-source source="LOCAL" name="@localhost" uuid="90f8ee11-600e-4155-a316-e8062c7c828b">
|
||||||
<driver-ref>mysql.8</driver-ref>
|
<driver-ref>mariadb</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
<jdbc-url>jdbc:mariadb://localhost:3306</jdbc-url>
|
||||||
<jdbc-additional-properties>
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
|
||||||
</jdbc-additional-properties>
|
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
|
||||||
</data-source>
|
|
||||||
<data-source source="LOCAL" name="@prod" uuid="ea495604-156c-4d96-9100-9074495ce007">
|
|
||||||
<driver-ref>mysql.8</driver-ref>
|
|
||||||
<synchronize>true</synchronize>
|
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
|
||||||
<jdbc-url>jdbc:mysql://localhost:3306/chzzk</jdbc-url>
|
|
||||||
<jdbc-additional-properties>
|
<jdbc-additional-properties>
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
- [x] \<counter:counter_name>
|
- [x] \<counter:counter_name>
|
||||||
- [x] \<personal_counter:counter_name>
|
- [x] \<personal_counter:counter_name>
|
||||||
- [x] \<daily_counter:counter_name>
|
- [x] \<daily_counter:counter_name>
|
||||||
|
- [x] \<days:yyyy-mm-dd>
|
||||||
|
|
||||||
### 관리 명령어 (on Discord)
|
### 관리 명령어 (on Discord)
|
||||||
- [x] /register chzzk_id: \[치지직 고유ID]
|
- [x] /register chzzk_id: \[치지직 고유ID]
|
||||||
@ -42,6 +43,8 @@
|
|||||||
- 바보
|
- 바보
|
||||||
- `/add label: 바보 content: 나 바보 아니다?`
|
- `/add label: 바보 content: 나 바보 아니다?`
|
||||||
- `/add label: 바보 content: <counter:fool> 번째 바보? 나 바보 아니다?`
|
- `/add label: 바보 content: <counter:fool> 번째 바보? 나 바보 아니다?`
|
||||||
|
- 첫방송
|
||||||
|
- `/add label: 첫방송 content: 24년 7월 23일부터 <days:2024-07-23>일 째 방송중!`
|
||||||
|
|
||||||
## 사용 기술스택
|
## 사용 기술스택
|
||||||
- [Exposed](https://github.com/JetBrains/Exposed)
|
- [Exposed](https://github.com/JetBrains/Exposed)
|
||||||
|
@ -25,6 +25,7 @@ class MessageHandler(
|
|||||||
private val dailyCounterPattern = Regex("<daily_counter:([^>]+)>")
|
private val dailyCounterPattern = Regex("<daily_counter:([^>]+)>")
|
||||||
private val namePattern = Regex("<name>")
|
private val namePattern = Regex("<name>")
|
||||||
private val followPattern = Regex("<following>")
|
private val followPattern = Regex("<following>")
|
||||||
|
private val daysPattern = """<days:(\d{4})-(\d{2})-(\d{2})>""".toRegex()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
reloadCommand()
|
reloadCommand()
|
||||||
@ -162,6 +163,16 @@ class MessageHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = daysPattern.replace(result) {
|
||||||
|
val (year, month, day) = it.destructured
|
||||||
|
val pastDate = LocalDateTime.of(year.toInt(), month.toInt(), day.toInt(), 0, 0, 0)
|
||||||
|
val today = LocalDateTime.now()
|
||||||
|
|
||||||
|
val daysBetween = ChronoUnit.DAYS.between(pastDate, today)
|
||||||
|
|
||||||
|
daysBetween.toString()
|
||||||
|
}
|
||||||
|
|
||||||
result = counterPattern.replace(result) {
|
result = counterPattern.replace(result) {
|
||||||
val name = it.groupValues[1]
|
val name = it.groupValues[1]
|
||||||
CounterService.updateCounterValue(name, 1, user).toString()
|
CounterService.updateCounterValue(name, 1, user).toString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user