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
ad04b0ae
Commit
ad04b0ae
authored
Nov 08, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unmodifiable properties
parent
c6eef97c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
.../src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
+21
-18
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
...rai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
+1
-0
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
View file @
ad04b0ae
...
@@ -118,6 +118,7 @@ inline fun <R> Contact.withSession(block: BotSession.() -> R): R = bot.withSessi
...
@@ -118,6 +118,7 @@ inline fun <R> Contact.withSession(block: BotSession.() -> R): R = bot.withSessi
* @author Him188moe
* @author Him188moe
*/
*/
open
class
QQ
internal
constructor
(
bot
:
Bot
,
id
:
UInt
)
:
Contact
(
bot
,
id
)
{
open
class
QQ
internal
constructor
(
bot
:
Bot
,
id
:
UInt
)
:
Contact
(
bot
,
id
)
{
// TODO: 2019/11/8 should be suspend val if kotlin supports
val
profile
:
Deferred
<
Profile
>
by
bot
.
network
.
SuspendLazy
{
updateProfile
()
}
val
profile
:
Deferred
<
Profile
>
by
bot
.
network
.
SuspendLazy
{
updateProfile
()
}
override
suspend
fun
sendMessage
(
message
:
MessageChain
)
{
override
suspend
fun
sendMessage
(
message
:
MessageChain
)
{
...
@@ -190,27 +191,29 @@ enum class MemberPermission {
...
@@ -190,27 +191,29 @@ enum class MemberPermission {
/**
/**
* 个人资料
* 个人资料
*/
*/
class
Profile
// inline class Date
// FIXME: 2019/11/8 should be `data class Profile`
(
qq
:
UInt
,
nickname
:
String
,
zipCode
:
String
?,
phone
:
String
?,
gender
:
Gender
,
var
birthday
:
Date
?)
{
@Suppress
(
"PropertyName"
)
class
Profile
(
qq
:
UInt
,
nickname
:
String
,
zipCode
:
String
?,
phone
:
String
?,
gender
:
Gender
,
var
birthday
:
Date
?)
{
var
qq
:
UInt
=
qq
internal
set
internal
var
_qq
:
UInt
=
qq
var
nickname
:
String
=
nickname
internal
var
_nickname
:
String
=
nickname
internal
set
internal
var
_zipCode
:
String
?
=
zipCode
var
zipCode
:
String
?
=
zipCode
internal
var
_phone
:
String
?
=
phone
internal
set
internal
var
_gender
:
Gender
=
gender
var
phone
:
String
?
=
phone
internal
set
val
qq
:
UInt
=
_qq
var
gender
:
Gender
=
gender
val
nickname
:
String
=
_nickname
internal
set
val
zipCode
:
String
?
=
_zipCode
val
phone
:
String
?
=
_phone
val
gender
:
Gender
=
_gender
}
}
fun
Profile
.
copyFrom
(
another
:
Profile
)
{
fun
Profile
.
copyFrom
(
another
:
Profile
)
{
this
.
qq
=
another
.
qq
this
.
_
qq
=
another
.
qq
this
.
nickname
=
another
.
nickname
this
.
_
nickname
=
another
.
nickname
this
.
zipCode
=
another
.
zipCode
this
.
_
zipCode
=
another
.
zipCode
this
.
phone
=
another
.
phone
this
.
_
phone
=
another
.
phone
this
.
gender
=
another
.
gender
this
.
_
gender
=
another
.
gender
}
}
/**
/**
...
...
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
View file @
ad04b0ae
...
@@ -44,6 +44,7 @@ suspend fun main() {
...
@@ -44,6 +44,7 @@ suspend fun main() {
subscribeAlways
<
Subscribable
>
{
subscribeAlways
<
Subscribable
>
{
//bot.logger.verbose("收到了一个事件: ${it::class.simpleName}")
//bot.logger.verbose("收到了一个事件: ${it::class.simpleName}")
}
}
bot
.
subscribeMessages
{
bot
.
subscribeMessages
{
"你好"
reply
"你好!"
"你好"
reply
"你好!"
"profile"
reply
{
"profile"
reply
{
...
...
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