you can try!

This commit is contained in:
nora 2021-01-19 15:56:32 +01:00
parent 656e1addbf
commit 2319549ff9
9 changed files with 219 additions and 8 deletions

View file

@ -1,9 +1,20 @@
package com.github.nilstrieb.cofig;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.Event;
import java.awt.*;
public class Config {
public static final String PREFIX = "kil ";
public static final String NILS_ID = "414755070161453076";
public static final long NILS_ID = 414755070161453076L;
public static final Color DEFAULT_COLOR = new Color(229, 201, 255);
public static final long THIS_ID = 801015254023798825L;
public static EmbedBuilder getDefaultEmbed() {
EmbedBuilder builder = new EmbedBuilder();
builder.setColor(Config.DEFAULT_COLOR);
return builder;
}
}

View file

@ -0,0 +1,23 @@
package com.github.nilstrieb.commands.fun;
import com.github.nilstrieb.cofig.Config;
import com.github.nilstrieb.commands.handler.Command;
import com.github.nilstrieb.util.DepartureSong;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class DepartureCommand extends Command {
public DepartureCommand() {
super("departure");
}
@Override
public void called(MessageReceivedEvent event, String args) {
EmbedBuilder builder = Config.getDefaultEmbed();
builder.setTitle("DEPARTURE - GALNERYUS")
.addField("Youtube Link: ", DepartureSong.DEPARTURE_YOUTUBE_LINK, false);
reply(event, builder.build());
reply(event, "Lyrics:\n" + DepartureSong.LYRICS_LATIN);
}
}

View file

@ -0,0 +1,17 @@
package com.github.nilstrieb.commands.fun;
import com.github.nilstrieb.commands.handler.Command;
import com.github.nilstrieb.util.KilluaQuotes;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class QuoteCommand extends Command {
public QuoteCommand() {
super("quote");
}
@Override
public void called(MessageReceivedEvent event, String args) {
reply(event, KilluaQuotes.getRandomQuote());
deleteMsg(event);
}
}

View file

@ -1,5 +1,7 @@
package com.github.nilstrieb.commands.handler;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import java.util.Timer;
@ -20,6 +22,11 @@ public abstract class Command {
event.getTextChannel().sendMessage(message).queue();
}
protected void reply(MessageReceivedEvent event, MessageEmbed embed) {
event.getTextChannel().sendMessage(embed).queue();
}
protected void deleteMsg(MessageReceivedEvent event, long delay){
new Timer().schedule(
new TimerTask() {

View file

@ -3,6 +3,7 @@ package com.github.nilstrieb.commands.info;
import com.github.nilstrieb.cofig.Config;
import com.github.nilstrieb.commands.handler.Command;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.User;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
@ -21,13 +22,15 @@ public class InviteCommand extends Command {
public void called(MessageReceivedEvent event, String args) {
User nils = event.getJDA().getUserById(Config.NILS_ID);
User killua = event.getJDA().getUserById(Config.THIS_ID);
Objects.requireNonNull(nils, "user nils not found");
Objects.requireNonNull(killua, "user killua not found");
EmbedBuilder builder = new EmbedBuilder();
builder.setAuthor("Invite me to your server!")
.setAuthor("This bot was made by Nils#2048")
.setColor(Config.DEFAULT_COLOR)
.addField("Link", "[Invite]" + INVITE_LINK, false);
event.getTextChannel().sendMessage(builder.build()).queue();
EmbedBuilder builder = Config.getDefaultEmbed();
builder.setFooter("This bot was made by " + nils.getAsTag())
.setTitle("Invite me!")
.setThumbnail(killua.getAvatarUrl())
.addField("", "[Invite]" + INVITE_LINK, true);
reply(event, builder.build());
}
}

View file

@ -1,6 +1,8 @@
package com.github.nilstrieb.core;
import com.github.nilstrieb.cofig.Secrets;
import com.github.nilstrieb.commands.fun.DepartureCommand;
import com.github.nilstrieb.commands.fun.QuoteCommand;
import com.github.nilstrieb.commands.fun.SayCommand;
import com.github.nilstrieb.commands.info.InviteCommand;
import com.github.nilstrieb.commands.info.EvalCommand;
@ -34,5 +36,7 @@ public class Main {
new ToukaCommand();
new SayCommand();
new InviteCommand();
new QuoteCommand();
new DepartureCommand();
}
}

View file

@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
public class CommandListener extends ListenerAdapter {
@Override
public void onMessageReceived(@NotNull MessageReceivedEvent event) {
System.out.println("[CListener] Received message " + event.getMessage().getContentRaw());
System.out.println("[CListener] Received message: '" + event.getMessage().getContentRaw() + "'");
CommandHandler.call(event);
}
}

View file

@ -0,0 +1,117 @@
package com.github.nilstrieb.util;
public class DepartureSong {
public static final String DEPARTURE_YOUTUBE_LINK = "https://www.youtube.com/watch?v=VxFUs1pcWzU";
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!)
終わらない冒険に出掛けよう
""";
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!
""";
}

View file

@ -0,0 +1,29 @@
package com.github.nilstrieb.util;
import java.util.Random;
public class KilluaQuotes {
private static Random random = new Random();
private static final String[] quotes = {
"When I say it doesn't hurt me, that means I can bear it.",
"Gon, you are light itself. Sometimes you're too bright and I can't look at you... But can I still stay by your side?",
"People only find me interesting because they can't tell whether I'm serious or not.",
"I'm so tired of killing, I just want to be a kid. Hanging out, doing stuff with Gon. That's it.",
"Move, and you die. Use Nen, or utter one word, and you die. Now close you eyes... You see what happens when you break promises? Open your eyes again and look at me in the mirror. Listen. Don't you ever show your scummy face to us ever again. This is a promise you will keep.",
"If I ignore a friend I have the ability to help, wouldn't I be betraying him?",
"Who wants to have their life planned out for them.",
"Not killing people is really hard. Clean living is tough.",
"Assassination — It's the family trade. We all take it up. My folks see me as an exceptional prospect. But I don't see that I should have to live up to their expectations.",
"Gon, let's get in front. Yeah, and it'll get us away from Hisoka. He's killed, and wants to kill again. The fog will make a great cover. You're wondering how I know. Fact is, I'm like him. I can smell it in him.",
"Gon's suffering right now! Someone who meant a lot to him was ruthlessly altered! Even his mind was changed. As we speak, Gon's facing against the person responsible! If you up without warning, looking like that, he won't be able to hold it together. So you have to promise to call him by his name first! That's my one condition! Let him know you're okay. He was so worried about you, up to the minute we came in here. Give him some peace of mind. Please. Put his mind at ease. Only you, Palm, can do that right now. Nobody else can reach him. Not me. I can't help him anymore!",
"Nanika, will you forgive me for being a bad big brother?",
"We were complacent. Too confident of our powers. Both of us combined were worth less than a one-armed Kite. That was his assessment... That's the reality. If Kite was by himself, this wouldn't have happened. We were fools.",
"Assassination — Its the family trade. We all take it up. My folks see me as an exceptional prospect. But I dont see that I should have to live up to their expectations.",
"We didnt do anything.. our enemies did"
};
public static String getRandomQuote() {
return quotes[random.nextInt(quotes.length)];
}
}