generated from project-mirai/mirai-console-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
272 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,29 @@ | ||
name: Gradle CI | ||
name: build | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push and pull request events but only for the master branch | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
# Allows to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
name: Gradle-Build | ||
|
||
# The type of runner that the job will run on | ||
runs-on: ubuntu-20.04 | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Setup JDK | ||
- name: Setup Java JDK | ||
uses: actions/setup-java@v3 | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Java setup | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: 11 | ||
distribution: 'zulu' | ||
cache: 'gradle' | ||
|
||
# Validate Gradle Wrapper | ||
- name: Gradle Wrapper Validation | ||
uses: gradle/wrapper-validation-action@v1.0.5 | ||
|
||
# Build | ||
- name: Make gradlew executable | ||
run: chmod +x ./gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
check-latest: true | ||
- uses: burrunan/gradle-cache-action@v1 | ||
name: BuildPluginLegacy | ||
with: | ||
job-id: jdk11 | ||
arguments: buildPluginLegacy | ||
gradle-version: wrapper | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: lgz-bot | ||
path: build/mirai/*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# mirai-console-plugin-template | ||
# mirai-quotly-bot | ||
|
||
[Mirai Console](https://github.com/mamoe/mirai-console) 插件模板, 使用 Kotlin + Gradle. | ||
|
||
[如何使用](https://github.com/project-mirai/how-to-use-plugin-template) | ||
A qq quotly plugin depend on [quote-api](https://github.com/LyoSU/quote-api)</br> | ||
listenport=3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
plugins { | ||
val kotlinVersion = "1.6.10" | ||
val kotlinVersion = "1.8.0" | ||
kotlin("jvm") version kotlinVersion | ||
kotlin("plugin.serialization") version kotlinVersion | ||
|
||
id("net.mamoe.mirai-console") version "2.13.2" | ||
} | ||
|
||
group = "org.example" | ||
dependencies { | ||
val overflow_version = "2.16.0-db61867-SNAPSHOT" | ||
implementation("org.json:json:20230227") | ||
implementation("cn.hutool:hutool-http:5.8.26") | ||
implementation("org.apache.httpcomponents:httpclient:4.5.14") | ||
|
||
compileOnly("top.mrxiaom:overflow-core-api:$overflow_version") | ||
compileOnly("xyz.cssxsh.mirai:mirai-hibernate-plugin:2.8.0") | ||
compileOnly("top.mrxiaom:overflow-core:$overflow_version") | ||
// testImplementation("xyz.cssxsh.mirai:mirai-hibernate-plugin:2.8.0") | ||
|
||
compileOnly(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) | ||
} | ||
|
||
group = "ltd.guimc.plugin" | ||
version = "0.1.0" | ||
|
||
repositories { | ||
if (System.getenv("CI")?.toBoolean() != true) { | ||
maven("https://maven.aliyun.com/repository/public") // 阿里云国内代理仓库 | ||
} | ||
maven { url = uri("https://repo.repsy.io/mvn/chrynan/public") } | ||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
mavenCentral() | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = "mirai-console-plugin-template" | ||
rootProject.name = "mirai-quotly-bot" |
91 changes: 0 additions & 91 deletions
91
src/main/java/org/example/mirai/plugin/JavaPluginMain.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package ltd.guimc.lgzbot.utils | ||
|
||
class CooldownUtils(val cooldown: Long) { | ||
var cooldownMap: MutableMap<Any, Long> = mutableMapOf() | ||
var cooldownNoticeMap: MutableMap<Any, Long> = mutableMapOf() | ||
|
||
fun flag(target: Any) { | ||
cooldownMap[target] = System.currentTimeMillis() | ||
} | ||
|
||
fun isTimePassed(target: Any): Boolean { | ||
return isTimePassed(target, cooldown) | ||
} | ||
|
||
fun isTimePassed(target: Any, time: Long): Boolean { | ||
if (cooldownMap.keys.indexOf(target) == -1) return true | ||
if (System.currentTimeMillis() - cooldownMap[target]!! >= time) return true | ||
return false | ||
} | ||
|
||
fun shouldSendCooldownNotice(target: Any): Boolean { | ||
if (cooldownNoticeMap.keys.indexOf(target) == -1) return true | ||
if (System.currentTimeMillis() - cooldownNoticeMap[target]!! >= 3000) { | ||
cooldownNoticeMap[target] = System.currentTimeMillis() | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
fun getLeftTime(target: Any): Long { | ||
return getLeftTime(target, cooldown) | ||
} | ||
|
||
fun getLeftTime(target: Any, time: Long): Long { | ||
if (cooldownMap.keys.indexOf(target) == -1) return -1 | ||
return time - (System.currentTimeMillis() - cooldownMap[target]!!) | ||
} | ||
|
||
fun addLeftTime(target: Any, time: Long) { | ||
if (cooldownMap.keys.indexOf(target) == -1) return | ||
cooldownMap[target] = cooldownMap[target]!! + time | ||
} | ||
} |
Oops, something went wrong.