GithubHelp home page GithubHelp logo

asforest / mshell Goto Github PK

View Code? Open in Web Editor NEW
38.0 38.0 4.0 1.3 MB

一个Mirai机器人插件,用来连接QQ聊天窗口和系统Shell

Home Page: https://github.com/asforest/MShell/discussions

License: GNU Affero General Public License v3.0

Kotlin 100.00%
mirai qq qqbot

mshell's People

Contributors

asforest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mshell's Issues

/ms auth add给予权限不足问题

操作简述(用xxx代替真实qq)

  1. 安装mirai-consolechat commandMShell,登录帐号
  2. 执行/ms auth add xxx
  3. 尝试在QQ中使用/ms help得不到回复

status

Running MiraiConsole v2.11.0-M1, built on 2022-03-08 20:34:54.
Frontend Terminal: version 2.11.0-M1, provided by Mamoe Technologies

Permission Service: Built In Permission Service

Plugins: MCL Addon v1.2.2, Chat Command v0.5.0, MShell v2.2.1

Object Pending Finalization Count: 0
                 committed |  init  |  used   |   max   
    Heap Memory:  72.33MB  | 16.0MB | 55.4MB  | 233.93MB
Non-Heap Memory:  77.62MB  | 7.31MB | 73.93MB |    -1   

运行mirai-console的设备信息

  • 系统:Alibaba Cloud Linux release 3 (Soaring Falcon) x86_64
  • uname -a: Linux xxxxx 5.10.84-10.2.al8.x86_64 #1 SMP Thu Feb 10 15:03:09 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

个人猜测

  • 猜想1: /ms auth add只添加了一个权限
  • 猜想2: MShell的验证方式存在问题

完整操作过程(均用xxx代替真实QQ号)当然了这似乎也是个临时解决方案了

安装MShell和ChatCommand插件后,console可以正常使用ms指令的所有功能。
使用 /permission add xxx console:*/ms auth add xxx 之后,提示成功
私聊机器人,发现/ms无效,然后我查看了config/Console/ermissionService.yml
文件内容如下

grantedPermissionMap:
  '*:*':
    - console
  'com.github.asforest.mshell:*':
    - fxxx
  'console:*':
    - uxxx

不知道f开头是什么意思,于是改成了u开头
修改后,内容如下:

grantedPermissionMap:
  '*:*':
    - console
  'com.github.asforest.mshell:*':
    - uxxx
  'console:*':
    - uxxx

重启机器人,发现可以在私聊机器人的情况下执行/ms
输入/ms open,提示没有权限使用预设 'null'
关闭机器人,再次修改config/Console/ermissionService.yml,在'com.github.asforest.mshell:*'下,添加-f xxx
修改后,内容如下:

grantedPermissionMap:
  '*:*':
    - console
  'com.github.asforest.mshell:*':
    - uxxx
    - fxxx
  'console:*':
    - uxxx

重启机器人,发现可以正常使用

添加预设时,提供了足够的参数,但出现java.lang.IllegalArgumentException异常(提示参数不足)

status

Running MiraiConsole v2.10.0, built on 2022-02-01 00:02:35.
Frontend Terminal: version 2.10.0, provided by Mamoe Technologies

Permission Service: Built In Permission Service

Plugins: 点歌插件 v1.1.7, MShell v0.0.0, net.mamoe.mirai-api-http v1.10.0, MCL Addon v1.2.2, Chat Command v0.5.0

Object Pending Finalization Count: 0
                 committed |  init  |  used   |   max   
    Heap Memory:  86.18MB  | 16.0MB | 56.47MB | 233.93MB
Non-Heap Memory:  82.93MB  | 7.31MB | 79.38MB |    -1   

输出

> ms preset add bash utf-8 /bin/bash
2022-03-08 22:08:00 E/console: java.lang.IllegalArgumentException: Callable expects 6 arguments, but 5 were provided.
java.lang.IllegalArgumentException: Callable expects 6 arguments, but 5 were provided.
        at kotlin.reflect.jvm.internal.calls.Caller$DefaultImpls.checkArguments(Caller.kt:20)                                                                         at kotlin.reflect.jvm.internal.calls.CallerImpl.checkArguments(CallerImpl.kt:15)                                                                              at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:112)                                                                       at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108)        at kotlin.reflect.full.KCallables.callSuspend(KCallables.kt:56)                at com.github.asforest.mshell.command.resolver.ArgumentedFunction.callSuspend(ArgumentedFunction.kt:29)
        at com.github.asforest.mshell.command.mshell.MShellCommand.onCommand(MShellCommand.kt:58)
        at com.github.asforest.mshell.command.MiraiTreeCommand$overloads$1.invokeSuspend(MiraiTreeCommand.kt:59)
        at com.github.asforest.mshell.command.MiraiTreeCommand$overloads$1.invoke(MiraiTreeCommand.kt)
        at com.github.asforest.mshell.command.MiraiTreeCommand$overloads$1.invoke(MiraiTreeCommand.kt)
        at net.mamoe.mirai.console.command.descriptor.CommandSignatureImpl.call$suspendImpl(CommandSignature.kt:75)
        at net.mamoe.mirai.console.command.descriptor.CommandSignatureImpl.call(CommandSignature.kt)
        at net.mamoe.mirai.console.internal.command.CommandManagerImplKt.executeCommandImpl(CommandManagerImpl.kt:167)
        at net.mamoe.mirai.console.command.CommandManager.executeCommand(CommandManager.kt:131)
        at net.mamoe.mirai.console.command.CommandManager$INSTANCE.executeCommand(CommandManager.kt)
        at net.mamoe.mirai.console.terminal.ConsoleThreadKt$startupConsoleThread$3.invokeSuspend(ConsoleThread.kt:191)
        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)

复现方式

  1. 安装mcl
  2. 安装chat-command,mirai-api-http插件
  3. 安装MShell插件
  4. 执行指令ms preset add bash utf-8 /bin/bash

个人尝试

我在发现此报错后,尝试增加,减少参数数量,减少参数后正常反馈错误,增加参数后仍然出现java.lang.IllegalArgumentException: Callable expects 6 arguments, but 5 were provided.

建议添加一个简单的会话消息历史记录机制

建议添加一个简单的会话消息历史记录机制,因为断开会话期间的消息用户收不到,要是能增加一个小的缓冲区临时存储一下最后几行消息就好了。在用户连接到会话时会发送给用户,用来显示最后的几条消息。

另外这些遗留消息要与正常的消息做区分

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.