@cssxsh 感谢大佬回复,还想请教一下,安卓手表协议是否还有其他不支持的事件类型?在上面那段代码中,不只是戳戳事件,其他的事件(比如成员入群退群)似乎也无法监听的到
N70_ 发布的帖子
-
RE: 【求助】突然无法监听到事件
-
Kotlin怎么调用Hutool的CronUtil动态添加定时任务?
官方参考文档只有Java代码如下:
CronUtil.schedule("*/2 * * * * *", new Task() { @Override public void execute() { some code } });
在IDEA中自动转换的JAVA代码如下:
报错
-
【求助】突然无法监听到事件
事件监听代码如下:
override fun onEnable() { val channel = GlobalEventChannel val nudge = channel.filter { it is NudgeEvent } val memberJoin = channle.filter { it is MemberJoinEvent } memberJoin.subscribeAlways<MemberJoinEvent> { event -> (here is some code) } nudge.subscribeAlways<NudgeEvent> { event -> (here is some code) }
当有新成员加入或者有人触发戳一戳时,不执行对应动作,控制台也没有事件触发的提示
-
【求助】Kotlin使用hutool工具类库时,一调用Util就抛出java.lang.reflect.InvocationTargetException该如何解决?
控制台日志:
2022-07-27 12:41:40 E/console: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97) at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113) at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:159) at kotlin.reflect.full.KCallables.callSuspendBy(KCallables.kt:74) at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1.invokeSuspend(CommandReflector.kt:329) at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1.invoke(CommandReflector.kt) at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1.invoke(CommandReflector.kt) at net.mamoe.mirai.console.command.descriptor.CommandSignatureFromKFunctionImpl.call$suspendImpl(CommandSignature.kt:88) at net.mamoe.mirai.console.command.descriptor.CommandSignatureFromKFunctionImpl.call(CommandSignature.kt) at net.mamoe.mirai.console.internal.command.CommandManagerImplKt.executeCommandImpl(CommandManagerImpl.kt:168) at net.mamoe.mirai.console.command.CommandManager.executeCommand$suspendImpl(CommandManager.kt:130) at net.mamoe.mirai.console.command.CommandManager.executeCommand(CommandManager.kt) 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:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Caused by: java.lang.NoClassDefFoundError: cn/hutool/http/HttpUtil at org.ASN70.apiExercise.Commands$COVID19.handle(Commands.kt:14) ... 25 more Caused by: java.lang.ClassNotFoundException: cn.hutool.http.HttpUtil at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 26 more
调用HttpUtil.get时的代码
suspend fun CommandSender.handle() { val jsonData = HttpUtil.get("https://www.baidu.com") println(jsonData) }
-
mirai接收不到群消息?
群内发送命令不起作用,控制台也不显示群内的聊天消息了,但是还可以在控制台执行命令
控制台日志如下2022-07-22 10:25:35 E/main: net.mamoe.mirai.internal.utils.crypto.DecryptionFailedException net.mamoe.mirai.internal.utils.crypto.DecryptionFailedException at net.mamoe.mirai.internal.utils.crypto.TEA.fail(TEA.kt:298) at net.mamoe.mirai.internal.utils.crypto.TEA.doOption$decrypt(TEA.kt:274) at net.mamoe.mirai.internal.utils.crypto.TEA.doOption(TEA.kt:294) at net.mamoe.mirai.internal.utils.crypto.TEA.decrypt(TEA.kt:318) at net.mamoe.mirai.internal.utils.crypto.TEA.decrypt$default(TEA.kt:317) at net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin.WtLoginExt.analyzeTlv106(WtLoginExt.kt:378) at net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin$Login.onLoginSuccess(WtLogin.kt:272) at net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin$Login.decode(WtLogin.kt:181) at net.mamoe.mirai.internal.network.components.PacketCodecImpl.processBody(PacketCodec.kt:420) at net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler$PacketDecodePipeline$send$1.invokeSuspend(NettyNetworkHandler.kt:189) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Unknown Source) Suppressed: java.util.concurrent.CancellationException: Bot closed at kotlinx.coroutines.ExceptionsKt.CancellationException(Exceptions.kt:22) at net.mamoe.mirai.internal.AbstractBot.close(AbstractBot.kt:112) at net.mamoe.mirai.internal.QQAndroidBot.close(QQAndroidBot.kt:84) at net.mamoe.mirai.internal.AbstractBot.login(AbstractBot.kt:136) at net.mamoe.mirai.internal.AbstractBot$login$1.invokeSuspend(AbstractBot.kt) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279) at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:245) at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:464) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:168) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon$default(MiraiConsoleTerminalLoader.kt:167) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.main(MiraiConsoleTerminalLoader.kt:52) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.itxtech.mcl.Utility.bootJars(Utility.java:89) at org.itxtech.mcl.Utility.bootJars(Utility.java:79) at org.itxtech.mcl.Utility.bootMirai(Utility.java:101) at org.itxtech.mcl.module.builtin.Boot.boot(Boot.java:109) at org.itxtech.mcl.module.ModuleManager.phaseBoot(ModuleManager.java:148) at org.itxtech.mcl.Loader.lambda$start$4(Loader.java:189) at org.itxtech.mcl.Loader.tryCatching(Loader.java:146) at org.itxtech.mcl.Loader.start(Loader.java:189) at org.itxtech.mcl.Loader.main(Loader.java:79) Caused by: [CIRCULAR REFERENCE: net.mamoe.mirai.internal.utils.crypto.DecryptionFailedException]
-
在给命令函数传递参数的时候
QuoteReply,Message,groupMessageEvent这几类参数是怎么传入函数的?我以为是对这条命令消息进行解析,比如我想让某条命令在回复别人消息的情况下触发,我给函数设置了一个QuoteReply的参数,但是实际会提示我缺参数
-
RE: Weibo Helper 一个简单的将微博转发到QQ的插件
@cssxsh 在 Weibo Helper 一个简单的将微博转发到QQ的插件 中说:
历史记录保留时间
大佬您好,想请教下,如果不想让插件推送机器人关闭时错过的微博,是在配置文件的历史记录那一项修改为0嘛?
-
RE: 【小白求教】如何在群成员触发命令时向群内发送一张本地图片?
@Karlatemp 谢谢您,但是还是有个问题
我把sender.subject写到uploadAsImage时,显示类型不匹配,它需要一个contact,但是sender.subject返回的是Contact?
感觉还是自己没整明白其中一些原理性的东西…… -
【小白求教】如何在群成员触发命令时向群内发送一张本地图片?
rt,我使用上传本地图片为Image的方法发送图片,但在uploadAsImage时不知道该如何调用要发送的Contact。
顺便求问 一下大佬们,可否有相关的插件代码适合于帮助理解命令触发时的Contact、Event、CommandSender、User、Message这些东西的工作原理、工作方式?对如何使用它们不甚理解……经常在需要的时候不会调用 -
如何在执行指令时发送一条at指令发送者的消息?
rt,CommandSender似乎是User?类型,与At()参数类型不一样,并不能直接调用
且我没有找到该如何获得CommandSender的QQ号码或者将CommandSender转换成UserOrBot类型