mirror of
https://github.com/Noratrieb/killua-bot.git
synced 2026-01-14 23:25:01 +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.commands.handler.Command;
|
||||
import com.github.nilstrieb.reactions.ReactionEventManager;
|
||||
import com.github.nilstrieb.reactions.ReactionListener;
|
||||
import com.github.nilstrieb.util.DepartureSong;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
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() {
|
||||
super("departure");
|
||||
}
|
||||
|
|
@ -19,5 +23,16 @@ public class DepartureCommand extends Command {
|
|||
.addField("Youtube Link: ", DepartureSong.DEPARTURE_YOUTUBE_LINK, false);
|
||||
reply(event, builder.build());
|
||||
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.ToukaCommand;
|
||||
import com.github.nilstrieb.listener.CommandListener;
|
||||
import com.github.nilstrieb.listener.ReactionEventListener;
|
||||
import com.github.nilstrieb.listener.StartUpListener;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
|
|
@ -24,7 +25,7 @@ public class Main {
|
|||
builder.setCompression(Compression.ZLIB);
|
||||
builder.setActivity(Activity.watching("over Gon"));
|
||||
|
||||
builder.addEventListeners(new StartUpListener(), new CommandListener());
|
||||
builder.addEventListeners(new StartUpListener(), new CommandListener(), new ReactionEventListener());
|
||||
|
||||
JDA jda = builder.build();
|
||||
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 =
|
||||
"""
|
||||
大地を踏みしめて
|
||||
君は目覚めていく
|
||||
天使の微笑みで 連れ出して!
|
||||
孤独でも 一人じゃないさ
|
||||
生まれてきたことに
|
||||
必ず意味がある
|
||||
優しさに 満ち溢れてる
|
||||
青い地球(ほし)にありがとう
|
||||
You can smile again
|
||||
太陽浴びて
|
||||
You can fly away
|
||||
世界は君の 輝きを待ってる
|
||||
大地を踏みしめて
|
||||
君は目覚めていく
|
||||
天使の微笑みで 連れ出して!
|
||||
(you can smile!)
|
||||
"始まり"はいつでも遅くないさ
|
||||
何度でも立ち上がれ!
|
||||
最後まで あきらめないさ
|
||||
やり続けることに 必ず意味がある
|
||||
You just try again
|
||||
闇を抜けて
|
||||
You just go away
|
||||
未来はいつも 僕たちを待ってる
|
||||
大空駆けぬけて 海原越えて行け
|
||||
天使の投げキッス 捕まえて!
|
||||
(you can try!)
|
||||
まだ誰も見たことない世界へ
|
||||
飛び出そう明日
|
||||
大地を踏みしめて
|
||||
君は目覚めていく
|
||||
天使の微笑みで 連れ出して!
|
||||
(you can smile!)
|
||||
終わらない冒険に出掛けよう…
|
||||
""";
|
||||
大地を踏みしめて
|
||||
君は目覚めていく
|
||||
天使の微笑みで 連れ出して!
|
||||
孤独でも 一人じゃないさ
|
||||
生まれてきたことに
|
||||
必ず意味がある
|
||||
優しさに 満ち溢れてる
|
||||
青い地球(ほし)にありがとう
|
||||
You can smile again
|
||||
太陽浴びて
|
||||
You can fly away
|
||||
世界は君の 輝きを待ってる
|
||||
大地を踏みしめて
|
||||
君は目覚めていく
|
||||
天使の微笑みで 連れ出して!
|
||||
(you can smile!)
|
||||
"始まり"はいつでも遅くないさ
|
||||
何度でも立ち上がれ!
|
||||
最後まで あきらめないさ
|
||||
やり続けることに 必ず意味がある
|
||||
You just try again
|
||||
闇を抜けて
|
||||
You just go away
|
||||
未来はいつも 僕たちを待ってる
|
||||
大空駆けぬけて 海原越えて行け
|
||||
天使の投げキッス 捕まえて!
|
||||
(you can try!)
|
||||
まだ誰も見たことない世界へ
|
||||
飛び出そう明日
|
||||
大地を踏みしめて
|
||||
君は目覚めていく
|
||||
天使の微笑みで 連れ出して!
|
||||
(you can smile!)
|
||||
終わらない冒険に出掛けよう…
|
||||
""";
|
||||
|
||||
public static final String LYRICS_LATIN =
|
||||
"""
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite!
|
||||
|
||||
Kodoku demo
|
||||
Hitori janai sa
|
||||
Umaretekita koto ni
|
||||
Kanarazu ima ga aru
|
||||
|
||||
Yasashisa ni michiafureteru
|
||||
Aoi hoshi ni arigatou
|
||||
|
||||
You can smile again
|
||||
Taiyou abite
|
||||
You can fly away
|
||||
Sekai wa kimi no kagayaki
|
||||
Wo matteru
|
||||
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite! (You can smile!)
|
||||
"Hajimari" wa itsudemo
|
||||
Osokunai sa
|
||||
Nandodemo tachiagare!
|
||||
|
||||
Saigo made akiramenai sa
|
||||
Yaritsuzukeru koto ni
|
||||
Kanarazu imi ga aru
|
||||
|
||||
You just try again
|
||||
Yami wo nukete
|
||||
You just go away
|
||||
Mirai wa itsumo bokutachi wo
|
||||
Matteru
|
||||
|
||||
Oozora nukenukete kaihara
|
||||
Koeteyuke
|
||||
Tenshi no nage kissu
|
||||
Tsukamaete! (You can try!)
|
||||
Mada daremo mita koto nai
|
||||
Sekai he
|
||||
Tobidasou ashita
|
||||
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite! (YOU CAN SMILE!)
|
||||
Owaranai bouken ni dekakeyou
|
||||
Itsumademo dokomademo
|
||||
|
||||
Nagareochiru namida yuuki ni
|
||||
Kaeteiku
|
||||
Tenshi no hani hiroge maiagare! (YOU CAN FLY!)
|
||||
Kanashimi mo itami mo
|
||||
Tsutsumikonde
|
||||
Tsuyoku nare ashita
|
||||
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite! (You can smile!)
|
||||
|
||||
"Hajimari" wa itsudemo
|
||||
Osokunai sa
|
||||
Nandodemo! (you can try!)
|
||||
Nandodemo! (you can try!)
|
||||
Nandodemo tachiagare!
|
||||
""";
|
||||
}
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite!
|
||||
|
||||
Kodoku demo
|
||||
Hitori janai sa
|
||||
Umaretekita koto ni
|
||||
Kanarazu ima ga aru
|
||||
|
||||
Yasashisa ni michiafureteru
|
||||
Aoi hoshi ni arigatou
|
||||
|
||||
You can smile again
|
||||
Taiyou abite
|
||||
You can fly away
|
||||
Sekai wa kimi no kagayaki
|
||||
Wo matteru
|
||||
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite! (You can smile!)
|
||||
"Hajimari" wa itsudemo
|
||||
Osokunai sa
|
||||
Nandodemo tachiagare!
|
||||
|
||||
Saigo made akiramenai sa
|
||||
Yaritsuzukeru koto ni
|
||||
Kanarazu imi ga aru
|
||||
|
||||
You just try again
|
||||
Yami wo nukete
|
||||
You just go away
|
||||
Mirai wa itsumo bokutachi wo
|
||||
Matteru
|
||||
|
||||
Oozora nukenukete kaihara
|
||||
Koeteyuke
|
||||
Tenshi no nage kissu
|
||||
Tsukamaete! (You can try!)
|
||||
Mada daremo mita koto nai
|
||||
Sekai he
|
||||
Tobidasou ashita
|
||||
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite! (YOU CAN SMILE!)
|
||||
Owaranai bouken ni dekakeyou
|
||||
Itsumademo dokomademo
|
||||
|
||||
Nagareochiru namida yuuki ni
|
||||
Kaeteiku
|
||||
Tenshi no hani hiroge maiagare! (YOU CAN FLY!)
|
||||
Kanashimi mo itami mo
|
||||
Tsutsumikonde
|
||||
Tsuyoku nare ashita
|
||||
|
||||
Daichi wo fumishimete
|
||||
Kimi wa mezameteiku
|
||||
Tenshi no hohoemi de
|
||||
Tsuredashite! (You can smile!)
|
||||
|
||||
"Hajimari" wa itsudemo
|
||||
Osokunai sa
|
||||
Nandodemo! (you can try!)
|
||||
Nandodemo! (you can try!)
|
||||
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