1
1
package org.stg.verification.bot.command
2
2
3
3
import net.mamoe.mirai.event.events.GroupMessageEvent
4
- import net.mamoe.mirai.message.data.Message
5
- import net.mamoe.mirai.message.data.PlainText
4
+ import net.mamoe.mirai.message.data.*
6
5
import org.stg.verification.bot.CommandHandler
7
6
import org.stg.verification.bot.storage.RandOperationHistory
8
7
import org.stg.verification.bot.storage.TRVGConfig
9
- import java.text.DateFormat
10
8
import java.util.*
11
9
import kotlin.random.Random
12
10
@@ -32,11 +30,12 @@ object RandOperation : CommandHandler {
32
30
val record = StringBuilder ()
33
31
for (i in 1 .. TRVGConfig .randOperation.number)
34
32
record.append(randOperations[Random .nextInt(randOperations.size)])
33
+ val message = MessageChainBuilder ()
35
34
val text = record.toString()
36
- val now = Calendar .getInstance()
37
- val time = DateFormat .getDateTimeInstance( DateFormat . SHORT , DateFormat . MEDIUM , Locale . CHINA )
38
- time.timeZone = TimeZone .getTimeZone( " GMT+8:00 " )
39
- record.append(" \n ${ time.format(now.time)} " )
35
+ val now = Calendar .getInstance(TimeZone .getTimeZone( " GMT+8:00 " ) )
36
+ val time = " ${now.get( Calendar . YEAR )} / ${now.get( Calendar . MONTH )} / ${now.get( Calendar . DATE )} - " +
37
+ " ${now.get( Calendar . HOUR_OF_DAY )} : ${now.get( Calendar . MINUTE )} : ${now.get( Calendar . SECOND )} "
38
+ record.append(" \n $time " )
40
39
RandOperationHistory .addRecord(
41
40
event.sender.id,
42
41
if (content.split(" " , limit= 2 )[0 ].length > TRVGConfig .randOperation.tagLimit)
@@ -45,7 +44,8 @@ object RandOperation : CommandHandler {
45
44
content.split(" " , limit= 2 )[0 ],
46
45
record.toString()
47
46
)
48
- return PlainText (text)
47
+ message.addAll(arrayOf(QuoteReply (event.source), PlainText (text)))
48
+ return message.build()
49
49
}
50
50
51
51
private val randOperations = arrayOf(" ↑" , " ↓" , " ←" , " →" )
0 commit comments