Discord Bot Coding help

Status
This thread has been locked.

chelsea1124

⚔️professional config and server creator⚔️
Premium
Feedback score
17
Posts
423
Reactions
53
Resources
3
I keep getting this error and it won't post what I wat this code to do as showing below

Error: https://gyazo.com/7b8c6b7c37252b81c3f8ae1d91ac3fc4

Code:
Code:
package test.listeners;

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;


public class voiceListener extends ListenerAdapter {

    public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
        event.getGuild().getTextChannelsByName("voicelog", true).get(0).sendMessage(
                "Member " + event.getVoiceState().getMember().getUser().getName() + " joined voice channel " + event.getChannelJoined().getName() + "."
        ).queue();
    }

}
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

NahuLD

Feedback score
0
Posts
87
Reactions
17
Resources
0
I keep getting this error and it won't post what I wat this code to do as showing below

Error: https://gyazo.com/7b8c6b7c37252b81c3f8ae1d91ac3fc4

Code:
Code:
package test.listeners;

import net.dv8tion.jda.core.events.guild.voice.GuildVoiceJoinEvent;
import net.dv8tion.jda.core.hooks.ListenerAdapter;


public class voiceListener extends ListenerAdapter {

    public void onGuildVoiceJoin(GuildVoiceJoinEvent event) {
        event.getGuild().getTextChannelsByName("voicelog", true).get(0).sendMessage(
                "Member " + event.getVoiceState().getMember().getUser().getName() + " joined voice channel " + event.getChannelJoined().getName() + "."
        ).queue();
    }

}
It seems like your bot does not have permissions to post on the "voicelog" channel.
As for your coding style, I'd recommend sticking to convetions for class naming.
 
Status
This thread has been locked.
Top