forked from godsofheaven/Discord-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgodsofheaven_basic_bot_template
More file actions
26 lines (21 loc) · 933 Bytes
/
godsofheaven_basic_bot_template
File metadata and controls
26 lines (21 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//Just a basic template to get started. Ignore this if you're familiar with the working.
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import javax.security.auth.login.LoginException;
public class Main extends ListenerAdapter {
public static void main (String[] args) throws LoginException {
JDABuilder builder = JDABuilder.createDefault("Your_Token_Here");
builder.addEventListeners(new Main());
builder.build();
}
@Override
public void onMessageReceived(MessageReceivedEvent event)
{
System.out.println("We recieved a message from "+ event.getAuthor().getName() + ":" + event.getMessage().getContentDisplay());
if(event.getMessage().getContentRaw().matches("Bye"))
{
event.getChannel().sendMessage("Good Night").queue();
}
}
}