我试图使用discord4j核心实现对我的不和谐的机器人的斜杠命令,但我找不到一种工作方式来注册这些命令。
我查阅了discord4j页面中的示例。他们用
GuildCommandRegistrar.create(client.getRestClient(), guildId, Collections.singletonList(randomCommand))
.registerCommands()
.doOnError(e -> log.warn("Unable to create guild command", e))
.onErrorResume(e -> Mono.empty())
.blockLast();但我不能让这件事对我有用。在示例项目中,他们使用此导入
import discord4j.core.support.GuildCommandRegistrar;但我自己不能用这个。有人知道我如何用discord4j注册我的Slash命令吗?
提前感谢
发布于 2022-08-28 13:43:28
这里的维护人员之一,.support...类路径是我们的测试/演示类。
我们的示例项目为我们推荐如何注册全局斜杠命令提供了更好的参考源。
来自我自己的机器人的Spring在Kotlin的一个真实的例子:https://github.com/DreamExposure/TicketBird-Discord-Bot/blob/master/src/main/kotlin/org/dreamexposure/ticketbird/service/GlobalCommandRegistrar.kt
https://stackoverflow.com/questions/73517223
复制相似问题