我有问题,当我试图添加React的消息发送的机器人。这是我的代码和当我尝试添加反作用时遇到的问题。
想法很简单。只需bot发送一个poll命令,并向其添加React,如竖起和竖起拇指,例如:
“$poll this is example poll”,创建此poll后,添加React
代码-
@Override
protected void execute(CommandEvent event) {
if (this.check(event)) {
return;
}
var args = event.getArgs().trim();
if (args.isEmpty()) {
this.incorrectUsage(event);
return;
}
var announcementFormat = this.getConfig().getMessages().get("pool-format")
.replaceAll("%message", args);
event.reply(announcementFormat);
event.getMessage().addReaction("✔").queue();
}
错误-
ERROR net.dv8tion.jda.api.requests.RestAction - RestAction queue returned failure: [ErrorResponseException] 10008: Unknown Message
net.dv8tion.jda.api.exceptions.ContextException
at net.dv8tion.jda.api.exceptions.ContextException.here(ContextException.java:54)
at net.dv8tion.jda.api.requests.Request.<init>(Request.java:71)
at net.dv8tion.jda.internal.requests.RestActionImpl.queue(RestActionImpl.java:197)
at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:563)
at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:529)
at cf.lionsquad.lionminus.command.impl.PollCommand.execute(PollCommand.java:48)
at com.jagrosh.jdautilities.command.Command.run(Command.java:323)
at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onMessageReceived(CommandClientImpl.java:557)
at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onEvent(CommandClientImpl.java:445)
at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:82)
at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:69)
at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:150)
at net.dv8tion.jda.internal.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:122)
at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:36)
at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:948)
at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:835)
at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:813)
at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:986)
at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
1条答案
按热度按时间0vvn1miw1#
您可以使用平面图:
而不是
event.reply(announcementFormat)
.您的代码当前尝试向用户发送的消息添加React,而不是向bot发送的消息添加React。然而,这条消息已经被删除,这就是为什么你得到一个
Unknown Message
错误。