-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIWBot.java
More file actions
35 lines (29 loc) · 1.18 KB
/
IWBot.java
File metadata and controls
35 lines (29 loc) · 1.18 KB
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
27
28
29
30
31
32
33
34
35
import io.github.cdimascio.dotenv.Dotenv;
import listeners.*;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.requests.GatewayIntent;
import javax.security.auth.login.LoginException;
import java.util.EnumSet;
public class IWBot {
public IWBot() throws LoginException {
Dotenv config = Dotenv.configure().load();
String token = config.get("TOKEN");
JDABuilder builder = JDABuilder.createDefault(token);
builder.setAutoReconnect(true);
builder.setStatus(OnlineStatus.ONLINE);
builder.setActivity(Activity.playing("MCC Island."));
builder.enableIntents(EnumSet.allOf(GatewayIntent.class));
JDA jda = builder.build();
jda.addEventListener(new TicketSystem(), new ButtonRoles(), new Rules(), new Voting(), new JoinToCreateVCListener());
}
public static void main(String[] args) {
try {
new IWBot();
} catch (LoginException e) {
System.out.println("ERROR: Login failed due to invalid token.");
}
}
}