Код: Выделить всё
public static void changeName(String online) {
Guild guild = jda.getGuildById("1122886719126126682");
VoiceChannel channel = guild.getVoiceChannelById("1147195002603184159");
channel.getManager().setName(online).queue(
success -> System.out.println("Successfully renamed to: " + online),
error -> System.out.println("Failed to rename: " + error.getMessage())
);
}
Код: Выделить всё
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
[main] INFO JDA - Login Successful!
[JDA MainWS-WriteThread] INFO WebSocketClient - Connected to WebSocket
[JDA MainWS-ReadThread] INFO JDA - Finished Loading!
Server is offline
Exception in thread "main" net.dv8tion.jda.api.exceptions.MissingAccessException: Cannot perform action due to a lack of Permission. Missing permission: VOICE_CONNECT
at net.dv8tion.jda.internal.utils.Checks.checkAccess(Checks.java:303)
at net.dv8tion.jda.internal.managers.channel.ChannelManagerImpl.checkPermissions(ChannelManagerImpl.java:763)
at net.dv8tion.jda.internal.managers.channel.ChannelManagerImpl.(ChannelManagerImpl.java:102)
at net.dv8tion.jda.internal.managers.channel.concrete.VoiceChannelManagerImpl.(VoiceChannelManagerImpl.java:27)
at net.dv8tion.jda.internal.entities.channel.concrete.VoiceChannelImpl.getManager(VoiceChannelImpl.java:167)
at Main.changeName(Main.java:93)
at Main.main(Main.java:52
)
Подробнее здесь: https://stackoverflow.com/questions/784 ... l-with-jda