mirror of
https://github.com/Noratrieb/killua-bot.git
synced 2026-01-14 15:15:01 +01:00
dm debug
This commit is contained in:
parent
5c60b60c1b
commit
8be7a4caac
3 changed files with 23 additions and 3 deletions
|
|
@ -2,7 +2,6 @@ package com.github.nilstrieb.core;
|
||||||
|
|
||||||
import com.github.nilstrieb.cofig.Config;
|
import com.github.nilstrieb.cofig.Config;
|
||||||
import com.github.nilstrieb.cofig.Secrets;
|
import com.github.nilstrieb.cofig.Secrets;
|
||||||
//import com.github.nilstrieb.commands.fun.DepartureCommand;
|
|
||||||
import com.github.nilstrieb.commands.fun.DepartureCommand;
|
import com.github.nilstrieb.commands.fun.DepartureCommand;
|
||||||
import com.github.nilstrieb.commands.fun.FightCommand;
|
import com.github.nilstrieb.commands.fun.FightCommand;
|
||||||
import com.github.nilstrieb.commands.fun.QuoteCommand;
|
import com.github.nilstrieb.commands.fun.QuoteCommand;
|
||||||
|
|
@ -16,6 +15,7 @@ import com.github.nilstrieb.commands.util.EmoteAddCommand;
|
||||||
import com.github.nilstrieb.core.sections.ChannelMessageListener;
|
import com.github.nilstrieb.core.sections.ChannelMessageListener;
|
||||||
import com.github.nilstrieb.core.command.CommandListener;
|
import com.github.nilstrieb.core.command.CommandListener;
|
||||||
import com.github.nilstrieb.core.reactions.ReactionEventListener;
|
import com.github.nilstrieb.core.reactions.ReactionEventListener;
|
||||||
|
import com.github.nilstrieb.listener.DMDebugListener;
|
||||||
import com.github.nilstrieb.listener.StartUpListener;
|
import com.github.nilstrieb.listener.StartUpListener;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
|
|
@ -34,7 +34,12 @@ public class Main {
|
||||||
builder.setCompression(Compression.ZLIB);
|
builder.setCompression(Compression.ZLIB);
|
||||||
builder.setActivity(Activity.watching("over Gon"));
|
builder.setActivity(Activity.watching("over Gon"));
|
||||||
|
|
||||||
builder.addEventListeners(new StartUpListener(), new ChannelMessageListener(), new CommandListener(), new ReactionEventListener());
|
builder.addEventListeners(
|
||||||
|
new StartUpListener(),
|
||||||
|
new ChannelMessageListener(),
|
||||||
|
new CommandListener(),
|
||||||
|
new ReactionEventListener(),
|
||||||
|
new DMDebugListener());
|
||||||
|
|
||||||
JDA jda = builder.build();
|
JDA jda = builder.build();
|
||||||
setupCommands();
|
setupCommands();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public class ChannelMessageListener extends ListenerAdapter {
|
public class ChannelMessageListener extends ListenerAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
|
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
|
||||||
if (!event.getAuthor().isBot()) {
|
if (!event.getAuthor().isBot() && event.isFromGuild()) {
|
||||||
ChannelMessageEventManager.onMessageReceived(event);
|
ChannelMessageEventManager.onMessageReceived(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.github.nilstrieb.listener;
|
||||||
|
|
||||||
|
import com.github.nilstrieb.cofig.Config;
|
||||||
|
import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class DMDebugListener extends ListenerAdapter {
|
||||||
|
@Override
|
||||||
|
public void onPrivateMessageReceived(@NotNull PrivateMessageReceivedEvent event) {
|
||||||
|
if (event.getAuthor().getIdLong() == Config.NILS_ID) {
|
||||||
|
event.getAuthor().openPrivateChannel().queue(channel -> channel.sendMessage("Hallo!").queue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue