started work on Member class
parent
22e0139466
commit
92f66779c1
|
@ -17,6 +17,9 @@ public class Main {
|
|||
|
||||
DiscordApi api = new DiscordApiBuilder().setToken(token).login().join();
|
||||
|
||||
//Trivia management
|
||||
Member member = new Member(api);
|
||||
|
||||
// Add a listener which answers with "Pong!" if someone writes "!ping"
|
||||
api.addMessageCreateListener(event -> {
|
||||
if (event.getMessageContent().equalsIgnoreCase("!ping")) {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package linux.general.hackyquizbot;
|
||||
|
||||
import org.javacord.api.DiscordApi;
|
||||
import org.javacord.api.entity.user.User;
|
||||
|
||||
public class Member {
|
||||
private DiscordApi api;
|
||||
private User user;
|
||||
|
||||
public Member(DiscordApi api) {
|
||||
this.api = api;
|
||||
|
||||
this.api.addMessageCreateListener(event ->{
|
||||
if(event.getMessageContent().equalsIgnoreCase("!trivia")) {
|
||||
if(event.getMessageAuthor().asUser().isPresent()) {
|
||||
this.user = event.getMessageAuthor().asUser().get();
|
||||
|
||||
this.user.sendMessage("Welcome to hell");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue