Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
b57fe1bb
Commit
b57fe1bb
authored
Feb 23, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConfigSectionList
parent
125bfd32
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
8 deletions
+30
-8
mirai-console/src/main/kotlin/net/mamoe/mirai/console/Setu.kt
...i-console/src/main/kotlin/net/mamoe/mirai/console/Setu.kt
+16
-0
mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/DefaultCommands.kt
...kotlin/net/mamoe/mirai/console/command/DefaultCommands.kt
+0
-8
mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugins/ConfigSection.kt
...n/kotlin/net/mamoe/mirai/console/plugins/ConfigSection.kt
+11
-0
mirai-core/src/jvmTest/kotlin/mirai/test/setu.kt
mirai-core/src/jvmTest/kotlin/mirai/test/setu.kt
+3
-0
No files found.
mirai-console/src/main/kotlin/net/mamoe/mirai/console/Setu.kt
0 → 100644
View file @
b57fe1bb
package
net.mamoe.mirai.console
import
net.mamoe.mirai.console.plugins.Config
import
net.mamoe.mirai.console.plugins.loadAsConfig
import
net.mamoe.mirai.console.plugins.withDefaultWriteSave
import
java.io.File
object
Data
{
val
section
=
(
File
(
System
.
getProperty
(
"user.dir"
)
+
"/setu.yml"
)).
loadAsConfig
()
val
R18
=
section
.
getList
}
fun
main
()
{
}
\ No newline at end of file
mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/DefaultCommands.kt
View file @
b57fe1bb
...
...
@@ -131,13 +131,6 @@ object DefaultCommands {
}
bot
.
login
()
bot
.
subscribeMessages
{
contains
(
"test"
)
{
if
(
this
is
GroupMessage
)
{
quoteReply
(
"Hello $senderName"
)
}
else
{
reply
(
"Hello!"
)
}
}
this
.
startsWith
(
"/"
)
{
if
(
bot
.
checkManager
(
this
.
sender
.
id
))
{
val
sender
=
ContactCommandSender
(
this
.
subject
)
...
...
@@ -149,7 +142,6 @@ object DefaultCommands {
}
sendMessage
(
"$qqNumber login successes"
)
MiraiConsole
.
frontEnd
.
pushBot
(
bot
)
}
catch
(
e
:
Exception
)
{
sendMessage
(
"$qqNumber login failed -> "
+
e
.
message
)
}
...
...
mirai-console/src/main/kotlin/net/mamoe/mirai/console/plugins/ConfigSection.kt
View file @
b57fe1bb
...
...
@@ -48,6 +48,7 @@ interface Config {
fun
getFloatList
(
key
:
String
):
List
<
Float
>
fun
getDoubleList
(
key
:
String
):
List
<
Double
>
fun
getLongList
(
key
:
String
):
List
<
Long
>
fun
getConfigSectionList
(
key
:
String
):
List
<
ConfigSection
>
operator
fun
set
(
key
:
String
,
value
:
Any
)
operator
fun
get
(
key
:
String
):
Any
?
operator
fun
contains
(
key
:
String
):
Boolean
...
...
@@ -271,6 +272,16 @@ interface ConfigSection : Config, MutableMap<String, Any> {
return
((
get
(
key
)
?:
error
(
"ConfigSection does not contain $key "
))
as
List
<
*
>).
map
{
it
.
toString
().
toLong
()
}
}
override
fun
getConfigSectionList
(
key
:
String
):
List
<
ConfigSection
>
{
return
((
get
(
key
)
?:
error
(
"ConfigSection does not contain $key "
))
as
List
<
*
>).
map
{
if
(
it
is
ConfigSection
)
{
it
}
else
{
ConfigSectionDelegation
(
it
as
MutableMap
<
String
,
Any
>)
}
}
}
override
fun
exist
(
key
:
String
):
Boolean
{
return
get
(
key
)
!=
null
}
...
...
mirai-core/src/jvmTest/kotlin/mirai/test/setu.kt
0 → 100644
View file @
b57fe1bb
package
mirai.test
import
java.io.File
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment