asforest / mshell Goto Github PK
View Code? Open in Web Editor NEW一个Mirai机器人插件,用来连接QQ聊天窗口和系统Shell
Home Page: https://github.com/asforest/MShell/discussions
License: GNU Affero General Public License v3.0
一个Mirai机器人插件,用来连接QQ聊天窗口和系统Shell
Home Page: https://github.com/asforest/MShell/discussions
License: GNU Affero General Public License v3.0
mirai-console
,chat command
和MShell
,登录帐号/ms auth add xxx
/ms help
,得不到回复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
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
/ms auth add
只添加了一个权限MShell
的验证方式存在问题安装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
重启机器人,发现可以正常使用
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)
ms preset add bash utf-8 /bin/bash
我在发现此报错后,尝试增加,减少参数数量,减少参数后正常反馈错误,增加参数后仍然出现java.lang.IllegalArgumentException: Callable expects 6 arguments, but 5 were provided.
建议添加一个简单的会话消息历史记录机制,因为断开会话期间的消息用户收不到,要是能增加一个小的缓冲区临时存储一下最后几行消息就好了。在用户连接到会话时会发送给用户,用来显示最后的几条消息。
另外这些遗留消息要与正常的消息做区分
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.