A Mirai console plugin that can provide osu!std players some appropriate beatmap (WIP)

Overview

OsuMapSuggester

A mirai-console plugin that can provide osu!std players some appropriate beatmap. (WIP)

CI CodeFactor

Features

It can analyze player's aim, speed and accuracy skills of his best performances and PerformancePlus and other factors to infer what type of the player he is.

Then it can recommend specific beatmaps for his shortcomings or other kind of beatmaps.

But currently none of the feature above is implemented, because it is still working in progress. XD

There are also other features:

  • Analyze player's skills(main function).
  • Recommend specific beatmaps(main function).
  • Show your best performance picture.
  • Best performance versus.
  • Recalculate best performance if all full combo.
  • ...

How plugin process OAuth request and bind account

When users click OAuth link and confirm authorization. It will redirect to your callback URL with query parameters state and code.

The OsuMapSuggester plugin will open a frontend http server to process the parameters.

Pictures generated by plugin

Help page
Command: .help 1-100
Show best performance
Command: .bpa 1-100
Recalculate best performance if all fc
Command: .bpa fc 1-100
Best performance versus
me and OsmiumD
Command: .bpvs @Target 1-100

Deploy

It is easy to deploy this bot.

Preparation:

Run:

  1. Clone this project and open with IntelliJ IDEA. Sync gradle project and run mirai/buildPlugin task to build the plugin binary file.

You can also build via command line by runing ./gradle buildPlugin command if your IntelliJ IDEA is not installed.

  1. Copy the output in build/mirai/OsuMapSuggester-xxx.mirai.jar to <console runtime>/plugins/ folder, and start mirai console once, you may get this error log:
2021-07-26 20:22:37 E/OsuMapSuggester: Failed to connect database: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Access denied for user 'root'@'localhost' (using password: YES).
2021-07-26 20:22:37 E/OsuMapSuggester: Retry to connect database in 10 seconds.
  1. Close mirai console, edit config/OsuMapSuggester/OsuMapSuggester.Config.yml
qq: 1234567890 # Enable the plugin for this bot
database: 
  address: localhost # Your database address
  port: 3306 # Database port
  user: root # Database user
  password: testpwd # Database password
  table: osu!beatmap suggester # Database name
  maximumPoolSize: 10
osuAuth: 
  clientId: 0 # The OAuth application client id you just created.
  secret: '' # OAuth application client secret
  authCallbackBaseUrl: 'http://localhost:8081' # callback base url, it is for generating OAuth link when users bind qq account, must be same with OAuth application callback base url(no "/authCallback").
frontend: # frontend is used to process oauth application callback
  host: localhost # frontend host
  port: 8081 # frontend port
  1. Save config, rerun mirai console. If you see this log, it means everything works ok.
2021-07-26 20:34:27 I/OsuMapSuggester: Subscribed group and friend messages.

Issues

This project is still working in progress, it is unstable and there are still many bugs.

If you suffer from fatal bug when running bot, please open a issue with bug to feedback.

Also, if you have any good idea, welcome to contribute to this project or open a issue with feature label.

Library

  • mirai - High-performance bot framework for Tencent QQ.
  • mirai-console - headless frontend for mirai.
  • Exposed - A Kotlin SQL Framework.
  • HikariCP - 光 HikariCP ・ A solid, high-performance, JDBC connection pool at last.
  • peace-performance - osu! pp & stars calculation algorithm.
  • ktor - Framework for quickly creating connected applications in Kotlin with minimal effort
  • skija - Skia bindings for Java

LICENSE of this project and mirai

OsuMapSuggester
Copyright (C) 2021 StageGuard

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
mirai
Copyright (C) 2019-2021 Mamoe Technologies and contributors.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
Comments
  • 插件编译后,载入出现NPE异常

    插件编译后,载入出现NPE异常

    编译环境: Openjdk 16

    提取文件的时候,在data\OsuMapSuggester\resources文件夹中解出来的文件不全

    2021-10-10 20:36:39 E/OsuMapSuggester: Exception in coroutine Plugin OsuMapSuggester of OsuMapSuggester
    java.lang.NullPointerException: Cannot invoke "java.io.InputStream.readAllBytes()" because "inputStream" is null
            at me.stageguard.obms.utils.ExportResourcesKt$exportStaticResourcesToDataFolder$2.invokeSuspend(exportResources.kt:32)
            at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
            at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
            at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
            at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
            at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
            at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
    
    opened by SleepyAsh0191 13
  • OsuMapSuggester: Unhandled: GET - /authCallback

    OsuMapSuggester: Unhandled: GET - /authCallback

    2022-07-10 17:42:23 E/OsuMapSuggester: Unhandled: GET - /authCallback java.lang.LinkageError: loader constraint violation: when resolving method 'void io.ktor.client.request.HttpRequestBuilder.setMethod(io.ktor.http.HttpMethod)' the class loader 'OsuMapSuggester-2.3.0.mirai.jar' @5d497a91 of the current class, me/stageguard/obms/osu/api/OsuWebApi$getTokenWithCode$$inlined$postImpl$1, and the class loader 'app' for the method's defining class, io/ktor/client/request/HttpRequestBuilder, have different Class objects for the type io/ktor/http/HttpMethod used in the signature (me.stageguard.obms.osu.api.OsuWebApi$getTokenWithCode$$inlined$postImpl$1 is in unnamed module of loader 'OsuMapSuggester-2.3.0.mirai.jar' @5d497a91, parent loader 'global-shared' @636bbbbb; io.ktor.client.request.HttpRequestBuilder is in unnamed module of loader 'app') at OsuMapSuggester-2.3.0.mirai.jar//me.stageguard.obms.osu.api.OsuWebApi$getTokenWithCode$$inlined$postImpl$1.invokeSuspend(OsuWebApi.kt:382) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

    opened by MeiJuice 5
  • 关于插件手动编译后运行报错的一点建议

    关于插件手动编译后运行报错的一点建议

    今天在Debian编译后运行也出现了错误,和 #2 一样的错误,资源没有加载 Snipaste_2021-12-13_15-55-15 去看了一下库发现了问题,资源文件的大小写不对,Linux对大小写敏感,造成编译时没有打包进去。 拉下来之后,去改了一下资源的大小写,编译运行成功 建议修改/main/src/main/resources/svg内的文件名

    opened by li14300 3
  •  java.lang.UnsatisfiedLinkError: /tmp/skija_0.92.15/libskija.so: libGL.so.1: 无法打开共享对象文件: 没有那个文件或目录

    java.lang.UnsatisfiedLinkError: /tmp/skija_0.92.15/libskija.so: libGL.so.1: 无法打开共享对象文件: 没有那个文件或目录

    java.lang.UnsatisfiedLinkError: /tmp/skija_0.92.15/libskija.so: libGL.so.1: 无法打开共享对象文件: 没有那个文件或目录 at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source) at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source) at java.base/java.lang.Runtime.load0(Unknown Source) at java.base/java.lang.System.load(Unknown Source) at OsuMapSuggester-2.4.0.mirai.jar//org.jetbrains.skija.impl.Library.load(Library.java:77) at OsuMapSuggester-2.4.0.mirai.jar//org.jetbrains.skija.impl.Library.staticLoad(Library.java:47) at OsuMapSuggester-2.4.0.mirai.jar//org.jetbrains.skija.Surface.(Surface.java:9) at OsuMapSuggester-2.4.0.mirai.jar//me.stageguard.obms.graph.item.BestPerformanceDetail.drawBestPerformancesImage(BestPerformanceDetail.kt:48) at OsuMapSuggester-2.4.0.mirai.jar//me.stageguard.obms.bot.route.BestPerformanceAnalyzeKt$processOrderResultAndSend$bytes$1.invokeSuspend(bestPerformanceAnalyze.kt:191) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

    opened by MeiJuice 2
  • .skill查询异常(Beatmap stack leniency is invalid)

    .skill查询异常(Beatmap stack leniency is invalid)

    发起查询的玩家: RandomEnch

    错误日志:

    2021-10-16 18:55:18 I/OsuMapSuggester: POST: https://osu.ppy.sh/oauth/token
    2021-10-16 18:55:20 I/OsuMapSuggester: GET: https://osu.ppy.sh/api/v2/users/16605104/scores/best?mode=osu&include_fails=0&limit=50&offset=0
    2021-10-16 18:55:20 I/OsuMapSuggester: GET: https://osu.ppy.sh/api/v2/users/16605104/scores/best?mode=osu&include_fails=0&limit=50&offset=50
    2021-10-16 18:55:20 I/OsuMapSuggester: GET: https://old.ppy.sh/osu/1145
    2021-10-16 18:55:21 I/OsuMapSuggester: GET: https://old.ppy.sh/osu/1145
    2021-10-16 18:55:21 E/OsuMapSuggester: java.lang.IllegalStateException: BEATMAP_PARSE_ERROR:java.lang.IllegalArgumentException: Beatmap stack leniency is invalid.
    java.lang.IllegalStateException: BEATMAP_PARSE_ERROR:java.lang.IllegalArgumentException: Beatmap stack leniency is invalid.
            at me.stageguard.obms.cache.BeatmapCache.getBeatmap(BeatmapCache.kt:47)
            at me.stageguard.obms.cache.BeatmapCache$getBeatmap$1.invokeSuspend(BeatmapCache.kt)
            at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
            at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
            at java.base/java.lang.Thread.run(Thread.java:831)
    
    2021-10-16 18:55:22 V/Bot.779008220: Group(432995268) <- [mirai:at:1048421623] 解析 Beatmap 1145 时发生了异常: unhandled exception: BEATMAP_PARSE_ERROR:java.lang.IllegalArgumentException: Beatmap stack leniency is invalid.
    

    别问我为什么这个beatmap ID为什么是这么臭,我不知道

    opened by SleepyAsh0191 2
  • 铺面推荐错误

    铺面推荐错误

    A02484D081507733363C6666AD83203B 后台日志: 来点ar9图 2022-10-15 17:39:41 I/OsuMapSuggester: GET: https://osu.ppy.sh/api/v2/beatmapsets/search?q=13df7m40t6ynm23f4g07ym&m=0 2022-10-15 17:39:42 I/OsuMapSuggester: GET: https://osu.ppy.sh/api/v2/beatmaps/0/

    bug 
    opened by Dreamail 7
  • TODO

    TODO

    功能

    • [x] 通过 OAuth 绑定账号( netty 开个 http 服务器处理 oauth 结果)
    • [x] pp 算法,pp + 算法
    • [x] 查 最好成绩,最近成绩,以图片输出
    • [x] 最好成绩图片里显示 pp 曲线和图的 pp+ 属性饼图
    • [x] replay 解析,仿 lazer 的 Accuracy Heatmap 和 Timing Distribution 显示在最近成绩图片里
    • [x] 添加自定义铺面类型规则
    • [x] 根据自定义规则推图
    • [x] 以图片方式显示推图结果,附带一个链接可以直接像官网一样一键导入谱面(前端做个重定向)
    • [x] 支持编辑自定义谱面类型规则
    • [x] 以图片方式显示所有自定义谱面类型规则
    • [x] 实现 Web 端添加,编辑自定义谱面类型规则(做一个session池防止越级编辑)
    • [ ] #4
    • [x] 编写 wiki
    • [x] ~~规则中表达式里的谱面四维支持加了 mod 后的数值判断~~
    • [x] 谱面评价
    • [x] 解除绑定 .unbind
    • [x] 玩家对铺面类型规则评价(影响匹配优先度)
    • [ ] 谱面预览(查看谱面的属性)

    已知问题

    • [x] 请求 osu api 如果 timeout 了不会显示错误
    • [x] 在 QQ 聊天交互编辑的时候还会触发指令(把这个抽象出来,做个缓存池)
    • [x] 在 QQ 聊天交互编辑没有超时退出(要设置超时)
    • [x] pp + 算法还有点问题
    • [x] 匹配不到任何关键词和匹配到关键词了但是没有符合要求的图的输出都一样 No proper beatmap found.
    • [ ] 成绩中如果 meh(50) 太多会爆砍 pp,导致算法不准确
    • [x] 错误信息处理混乱
    milestone 
    opened by StageGuard 0
Releases(2.5.2)
Owner
StageGuard
StageGuard
A plugin for Jetbrains IDE, Your code is powerful, unleash it like playing osu!

Osu! Mode A plugin for Jetbrains IDE, Your code is powerful, unleash it like playing osu! Demo 2021-10-15.18-50-30.mp4 Bilibili Feature open project /

Nthily 8 Sep 8, 2022
✈️ IDE plugin for the IntelliJ platform which adds GitHub Copilot support. (VERY WIP)

JetBrains Copilot GitHub Copilot support for the IntellIJ Platform. Installation Download the latest release. Select the Install Plugin from Disk opti

Koding 155 Dec 10, 2022
A IntelliJ plugin to provide check on 'value type' which is limited to numerical constant values

ValueType A IntelliJ plugin to provide check on 'value type' which is limited to

Bennyhuo 4 Mar 11, 2022
A IntelliJ plugin to provide check on 'value type' which is limited to numerical constant values

ValueDef A IntelliJ plugin to provide check on 'value type' which is limited to

Bennyhuo 4 Mar 11, 2022
A Candid language plugin that provide a complete support to efficiently edit .did files.

IntelliJ Candid Language Plugin A Candid language plugin that provide a complete support to efficiently edit .did files. Candid is an interface descri

Maxime Bonvin 9 Dec 3, 2022
IntelliJ plugin that provides some useful utilities to support the daily work with Gradle.

IntelliJ Gradle Utilities Plugin This IntelliJ plugin provides some useful utilities to support the daily work with Gradle. It's available on the offi

Marcel Kliemannel 6 Jul 29, 2022
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.

Gradle Play Publisher Gradle Play Publisher is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and

null 3.9k Dec 30, 2022
A flutter plugin through which you can get audios, videos, or images from the local storage.

Getter Made flutter easier. Description A flutter plugin through which you can get audios, videos or images from the local storage. Dependencies Befor

Younes Lagmah 3 Sep 11, 2021
Intellij Idea Plugin that can convert HTML to Compose for Web code.

HtmlToComposeWebConverter Intellij Idea Plugin that can convert HTML to Compose for Web code. Turn this: Into this: Show some ❤️ and star the repo to

Jens Klingenberg 90 Oct 10, 2022
gradle-android-scala-plugin adds scala language support to official gradle android plugin

gradle-android-scala-plugin gradle-android-scala-plugin adds scala language support to official gradle android plugin. See also sample projects at htt

saturday06 345 Dec 10, 2022
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.

eventbus-intellij-plugin Plugin to navigate between events posted by EventBus. Post to onEvent and onEvent to Post Install There are two ways. Prefere

Shinnosuke Kugimiya 315 Aug 8, 2022
IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea

IntelliJ Idea Astor Plugin IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea. It communicates with a local/remote program

null 4 Aug 28, 2021
Intellij-platform-plugin-template - IntelliJ Platform Plugin Template

IntelliJ Platform Plugin Template TL;DR: Click the Use this template button and

null 0 Jan 1, 2022
BuildPlots-Plugin - PaperMC-Plugin for build contests written in Kotlin.

BuildPlotsPlugin PaperMC-Plugin for build contests. This is my first time using Kotlin and the first plugin I've written after a long time. It is stil

Lukas Heinzl 0 Jan 1, 2022
K6-intellij-plugin - IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your IntelliJ IDE

IntelliJ-based Plugin to run k6 tests locally or in the k6 Cloud from your Intel

Mikhail Bolotov 8 Jan 2, 2023
Ownership-gradle-plugin - Gradle code ownership verification plugin

Gradle code ownership verification plugin A gradle plugin that will verify owner

null 4 Dec 15, 2022
A Gradle plugin to report the number of method references in your APK on every build.

Dexcount Gradle Plugin A Gradle plugin to report the number of method references in your APK, AAR, or java module. This helps you keep tabs on the gro

Keepsafe 3k Dec 29, 2022
This plugin help you to set material design icon to your project.

Android Material Design Icon Generator Plugin This plugin help you to set material design icons to your Android project. Installation Manually Downloa

Yusuke Konishi 2.4k Dec 30, 2022
IntelliJ Plugin for Android Parcelable boilerplate code generation.

IntelliJ/Android Studio Plugin for Android Parcelable boilerplate code generation This tool generates an Android Parcelable implementation based on fi

Michał Charmas 2.1k Dec 27, 2022