【发布时间】:2019-11-10 11:36:09
【问题描述】:
我无法向用户添加角色。这是我的代码,如果我运行它,我会收到 UnsupportedOperationException 错误。 “cooldownroleid”是角色的ID,我要加给用户。
代码:
Role cooldownrole = event.getGuild().getRoleById(cooldownroleid);
event.getMember().getRoles().add(cooldownrole);
堆栈跟踪:
> ERROR net.dv8tion.jda.core.JDA - One of the EventListeners had an uncaught
exception java.lang.UnsupportedOperationException: null
at
> java.util.Collections$UnmodifiableCollection.add(Collections.java:1055)
> ~[na:1.8.0_212]
“冷却角色”的输出
> R:cooldown(594147714510356500)
提前致谢!
【问题讨论】:
标签: discord-jda