Skip to content

Commit

Permalink
docs: ...
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Nov 16, 2021
1 parent f9e34fa commit 0413a3f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/kotlin/io/github/gnuf0rce/mirai/plugin/GitHubUitls.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,38 @@ const val IMAGE_FOLDER_PROPERTY = "io.github.gnuf0rce.mirai.plugin.image"

const val REPLY_TYPE_PROPERTY = "io.github.gnuf0rce.mirai.plugin.reply"

/**
* 1. [LOGGER_PROPERTY]
* 2. [GitHubHelperPlugin.logger]
*/
internal val logger by lazy {
val open = System.getProperty(LOGGER_PROPERTY, "${true}").toBoolean()
if (open) GitHubHelperPlugin.logger else SilentLogger
}

/**
* 1. [IMAGE_FOLDER_PROPERTY]
* 2. [GitHubHelperPlugin.dataFolder]
*/
internal val ImageFolder by lazy {
val path = System.getProperty(IMAGE_FOLDER_PROPERTY)
(if (path.isNullOrBlank()) GitHubHelperPlugin.dataFolder else File(path)).resolve("image")
}

/**
* 1. [REPLY_TYPE_PROPERTY]
* 2. [MessageType]
*/
internal val reply by lazy {
System.getProperty(REPLY_TYPE_PROPERTY)
?.let(MessageType::valueOf)
?: GitHubConfig.reply
}

/**
* 1. [GitHubClient]
* 2. [GitHubConfig]
*/
internal val github by lazy {
object : GitHubClient(token = GitHubConfig.token.takeIf { it.isNotBlank() }) {
init {
Expand Down

0 comments on commit 0413a3f

Please sign in to comment.