mirror of
https://github.com/Noratrieb/killua-bot.git
synced 2026-01-15 15:45:02 +01:00
dinge
This commit is contained in:
parent
2319549ff9
commit
70fc06c69e
7 changed files with 195 additions and 108 deletions
|
|
@ -2,11 +2,15 @@ package com.github.nilstrieb.commands.fun;
|
||||||
|
|
||||||
import com.github.nilstrieb.cofig.Config;
|
import com.github.nilstrieb.cofig.Config;
|
||||||
import com.github.nilstrieb.commands.handler.Command;
|
import com.github.nilstrieb.commands.handler.Command;
|
||||||
|
import com.github.nilstrieb.reactions.ReactionEventManager;
|
||||||
|
import com.github.nilstrieb.reactions.ReactionListener;
|
||||||
import com.github.nilstrieb.util.DepartureSong;
|
import com.github.nilstrieb.util.DepartureSong;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||||
|
|
||||||
public class DepartureCommand extends Command {
|
public class DepartureCommand extends Command implements ReactionListener {
|
||||||
public DepartureCommand() {
|
public DepartureCommand() {
|
||||||
super("departure");
|
super("departure");
|
||||||
}
|
}
|
||||||
|
|
@ -19,5 +23,16 @@ public class DepartureCommand extends Command {
|
||||||
.addField("Youtube Link: ", DepartureSong.DEPARTURE_YOUTUBE_LINK, false);
|
.addField("Youtube Link: ", DepartureSong.DEPARTURE_YOUTUBE_LINK, false);
|
||||||
reply(event, builder.build());
|
reply(event, builder.build());
|
||||||
reply(event, "Lyrics:\n" + DepartureSong.LYRICS_LATIN);
|
reply(event, "Lyrics:\n" + DepartureSong.LYRICS_LATIN);
|
||||||
|
//TODO add message id
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReactionAdded(MessageReactionAddEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReactionRemoved(MessageReactionRemoveEvent event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.github.nilstrieb.commands.info.EvalCommand;
|
||||||
import com.github.nilstrieb.commands.info.HelpCommand;
|
import com.github.nilstrieb.commands.info.HelpCommand;
|
||||||
import com.github.nilstrieb.commands.info.ToukaCommand;
|
import com.github.nilstrieb.commands.info.ToukaCommand;
|
||||||
import com.github.nilstrieb.listener.CommandListener;
|
import com.github.nilstrieb.listener.CommandListener;
|
||||||
|
import com.github.nilstrieb.listener.ReactionEventListener;
|
||||||
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;
|
||||||
|
|
@ -24,7 +25,7 @@ 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 CommandListener());
|
builder.addEventListeners(new StartUpListener(), new CommandListener(), new ReactionEventListener());
|
||||||
|
|
||||||
JDA jda = builder.build();
|
JDA jda = builder.build();
|
||||||
setupCommands();
|
setupCommands();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.github.nilstrieb.listener;
|
||||||
|
|
||||||
|
import com.github.nilstrieb.reactions.ReactionEventManager;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class ReactionEventListener extends ListenerAdapter {
|
||||||
|
@Override
|
||||||
|
public void onMessageReactionAdd(@NotNull MessageReactionAddEvent event) {
|
||||||
|
ReactionEventManager.onReactionAdd(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReactionRemove(@NotNull MessageReactionRemoveEvent event) {
|
||||||
|
ReactionEventManager.onReactionRemove(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.github.nilstrieb.reactions;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class ReactionEventManager {
|
||||||
|
private static HashMap<String, ReactionListener> currentReactions = new HashMap<>();
|
||||||
|
|
||||||
|
public static void addMessage(Message message, ReactionListener listener){
|
||||||
|
currentReactions.put(message.getId(), listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeMessage(Message message){
|
||||||
|
currentReactions.remove(message.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onReactionAdd(MessageReactionAddEvent event){
|
||||||
|
String message = event.getMessageId();
|
||||||
|
ReactionListener listener = currentReactions.get(message);
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onReactionAdded(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onReactionRemove(MessageReactionRemoveEvent event){
|
||||||
|
String message = event.getMessageId();
|
||||||
|
ReactionListener listener = currentReactions.get(message);
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onReactionRemoved(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.github.nilstrieb.reactions;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.react.MessageReactionRemoveEvent;
|
||||||
|
|
||||||
|
public interface ReactionListener {
|
||||||
|
void onReactionAdded(MessageReactionAddEvent event);
|
||||||
|
void onReactionRemoved(MessageReactionRemoveEvent event);
|
||||||
|
}
|
||||||
|
|
@ -6,112 +6,112 @@ public class DepartureSong {
|
||||||
|
|
||||||
public static final String LYRICS_JAPANESE =
|
public static final String LYRICS_JAPANESE =
|
||||||
"""
|
"""
|
||||||
大地を踏みしめて
|
大地を踏みしめて
|
||||||
君は目覚めていく
|
君は目覚めていく
|
||||||
天使の微笑みで 連れ出して!
|
天使の微笑みで 連れ出して!
|
||||||
孤独でも 一人じゃないさ
|
孤独でも 一人じゃないさ
|
||||||
生まれてきたことに
|
生まれてきたことに
|
||||||
必ず意味がある
|
必ず意味がある
|
||||||
優しさに 満ち溢れてる
|
優しさに 満ち溢れてる
|
||||||
青い地球(ほし)にありがとう
|
青い地球(ほし)にありがとう
|
||||||
You can smile again
|
You can smile again
|
||||||
太陽浴びて
|
太陽浴びて
|
||||||
You can fly away
|
You can fly away
|
||||||
世界は君の 輝きを待ってる
|
世界は君の 輝きを待ってる
|
||||||
大地を踏みしめて
|
大地を踏みしめて
|
||||||
君は目覚めていく
|
君は目覚めていく
|
||||||
天使の微笑みで 連れ出して!
|
天使の微笑みで 連れ出して!
|
||||||
(you can smile!)
|
(you can smile!)
|
||||||
"始まり"はいつでも遅くないさ
|
"始まり"はいつでも遅くないさ
|
||||||
何度でも立ち上がれ!
|
何度でも立ち上がれ!
|
||||||
最後まで あきらめないさ
|
最後まで あきらめないさ
|
||||||
やり続けることに 必ず意味がある
|
やり続けることに 必ず意味がある
|
||||||
You just try again
|
You just try again
|
||||||
闇を抜けて
|
闇を抜けて
|
||||||
You just go away
|
You just go away
|
||||||
未来はいつも 僕たちを待ってる
|
未来はいつも 僕たちを待ってる
|
||||||
大空駆けぬけて 海原越えて行け
|
大空駆けぬけて 海原越えて行け
|
||||||
天使の投げキッス 捕まえて!
|
天使の投げキッス 捕まえて!
|
||||||
(you can try!)
|
(you can try!)
|
||||||
まだ誰も見たことない世界へ
|
まだ誰も見たことない世界へ
|
||||||
飛び出そう明日
|
飛び出そう明日
|
||||||
大地を踏みしめて
|
大地を踏みしめて
|
||||||
君は目覚めていく
|
君は目覚めていく
|
||||||
天使の微笑みで 連れ出して!
|
天使の微笑みで 連れ出して!
|
||||||
(you can smile!)
|
(you can smile!)
|
||||||
終わらない冒険に出掛けよう…
|
終わらない冒険に出掛けよう…
|
||||||
""";
|
""";
|
||||||
|
|
||||||
public static final String LYRICS_LATIN =
|
public static final String LYRICS_LATIN =
|
||||||
"""
|
"""
|
||||||
Daichi wo fumishimete
|
Daichi wo fumishimete
|
||||||
Kimi wa mezameteiku
|
Kimi wa mezameteiku
|
||||||
Tenshi no hohoemi de
|
Tenshi no hohoemi de
|
||||||
Tsuredashite!
|
Tsuredashite!
|
||||||
|
|
||||||
Kodoku demo
|
Kodoku demo
|
||||||
Hitori janai sa
|
Hitori janai sa
|
||||||
Umaretekita koto ni
|
Umaretekita koto ni
|
||||||
Kanarazu ima ga aru
|
Kanarazu ima ga aru
|
||||||
|
|
||||||
Yasashisa ni michiafureteru
|
Yasashisa ni michiafureteru
|
||||||
Aoi hoshi ni arigatou
|
Aoi hoshi ni arigatou
|
||||||
|
|
||||||
You can smile again
|
You can smile again
|
||||||
Taiyou abite
|
Taiyou abite
|
||||||
You can fly away
|
You can fly away
|
||||||
Sekai wa kimi no kagayaki
|
Sekai wa kimi no kagayaki
|
||||||
Wo matteru
|
Wo matteru
|
||||||
|
|
||||||
Daichi wo fumishimete
|
Daichi wo fumishimete
|
||||||
Kimi wa mezameteiku
|
Kimi wa mezameteiku
|
||||||
Tenshi no hohoemi de
|
Tenshi no hohoemi de
|
||||||
Tsuredashite! (You can smile!)
|
Tsuredashite! (You can smile!)
|
||||||
"Hajimari" wa itsudemo
|
"Hajimari" wa itsudemo
|
||||||
Osokunai sa
|
Osokunai sa
|
||||||
Nandodemo tachiagare!
|
Nandodemo tachiagare!
|
||||||
|
|
||||||
Saigo made akiramenai sa
|
Saigo made akiramenai sa
|
||||||
Yaritsuzukeru koto ni
|
Yaritsuzukeru koto ni
|
||||||
Kanarazu imi ga aru
|
Kanarazu imi ga aru
|
||||||
|
|
||||||
You just try again
|
You just try again
|
||||||
Yami wo nukete
|
Yami wo nukete
|
||||||
You just go away
|
You just go away
|
||||||
Mirai wa itsumo bokutachi wo
|
Mirai wa itsumo bokutachi wo
|
||||||
Matteru
|
Matteru
|
||||||
|
|
||||||
Oozora nukenukete kaihara
|
Oozora nukenukete kaihara
|
||||||
Koeteyuke
|
Koeteyuke
|
||||||
Tenshi no nage kissu
|
Tenshi no nage kissu
|
||||||
Tsukamaete! (You can try!)
|
Tsukamaete! (You can try!)
|
||||||
Mada daremo mita koto nai
|
Mada daremo mita koto nai
|
||||||
Sekai he
|
Sekai he
|
||||||
Tobidasou ashita
|
Tobidasou ashita
|
||||||
|
|
||||||
Daichi wo fumishimete
|
Daichi wo fumishimete
|
||||||
Kimi wa mezameteiku
|
Kimi wa mezameteiku
|
||||||
Tenshi no hohoemi de
|
Tenshi no hohoemi de
|
||||||
Tsuredashite! (YOU CAN SMILE!)
|
Tsuredashite! (YOU CAN SMILE!)
|
||||||
Owaranai bouken ni dekakeyou
|
Owaranai bouken ni dekakeyou
|
||||||
Itsumademo dokomademo
|
Itsumademo dokomademo
|
||||||
|
|
||||||
Nagareochiru namida yuuki ni
|
Nagareochiru namida yuuki ni
|
||||||
Kaeteiku
|
Kaeteiku
|
||||||
Tenshi no hani hiroge maiagare! (YOU CAN FLY!)
|
Tenshi no hani hiroge maiagare! (YOU CAN FLY!)
|
||||||
Kanashimi mo itami mo
|
Kanashimi mo itami mo
|
||||||
Tsutsumikonde
|
Tsutsumikonde
|
||||||
Tsuyoku nare ashita
|
Tsuyoku nare ashita
|
||||||
|
|
||||||
Daichi wo fumishimete
|
Daichi wo fumishimete
|
||||||
Kimi wa mezameteiku
|
Kimi wa mezameteiku
|
||||||
Tenshi no hohoemi de
|
Tenshi no hohoemi de
|
||||||
Tsuredashite! (You can smile!)
|
Tsuredashite! (You can smile!)
|
||||||
|
|
||||||
"Hajimari" wa itsudemo
|
"Hajimari" wa itsudemo
|
||||||
Osokunai sa
|
Osokunai sa
|
||||||
Nandodemo! (you can try!)
|
Nandodemo! (you can try!)
|
||||||
Nandodemo! (you can try!)
|
Nandodemo! (you can try!)
|
||||||
Nandodemo tachiagare!
|
Nandodemo tachiagare!
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.github.nilstrieb.util;
|
||||||
|
|
||||||
|
public class MultiPageEmbed {
|
||||||
|
public static final String NEXT_PAGE_DEFAULT_REACTION = "";
|
||||||
|
public static final String PREVIOUS_PAGE_DEFAULT_REACTION = "";
|
||||||
|
//TODO implement
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue