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
57011090
Commit
57011090
authored
Dec 19, 2019
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused members
parent
2f67f836
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
27 deletions
+3
-27
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/GentleImage.kt
...o-gentleman/src/main/kotlin/demo/gentleman/GentleImage.kt
+3
-27
No files found.
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/GentleImage.kt
View file @
57011090
...
...
@@ -7,35 +7,11 @@ import net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.uploadAsImage
import
org.jsoup.Jsoup
class
GentleImage
{
// This class is untidy, but it doesn't matter
lateinit
var
tags
:
String
lateinit
var
author
:
String
lateinit
var
file_url
:
String
var
score
:
Int
=
0
var
width
:
Int
=
0
var
height
:
Int
=
0
//val summary by lazy { "Avatar by ${author}; Origin size ($width*$height);" + "HD URL: $file_url" }
val
name
:
String
by
lazy
{
var
name
:
String
val
tags
=
tags
.
split
(
" "
.
toRegex
()).
dropLastWhile
{
it
.
isEmpty
()
}.
toTypedArray
()
if
(
tags
.
isEmpty
())
{
return
@
lazy
"OneTapper"
}
name
=
tags
[(
Math
.
random
()
*
tags
.
size
).
toInt
()]
name
=
name
.
substring
(
0
,
1
).
toUpperCase
()
+
name
.
substring
(
1
)
name
=
name
.
split
(
"\\("
.
toRegex
()).
dropLastWhile
{
it
.
isEmpty
()
}.
toTypedArray
()[
0
]
name
=
name
.
split
(
"_"
.
toRegex
()).
dropLastWhile
{
it
.
isEmpty
()
}.
toTypedArray
()[
0
]
name
}
class
GentleImage
{
lateinit
var
contact
:
Contact
// `Deferred<Image?>` causes a runtime ClassCastException
val
image
:
Deferred
<
Image
>
by
lazy
{
GlobalScope
.
async
{
//delay((Math.random() * 5000L).toLong())
...
...
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