discord-bot #230
@ -33,6 +33,7 @@ import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import java.awt.*;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
@UtilityClass
|
||||
public class EventManager {
|
||||
@ -66,9 +67,9 @@ public class EventManager {
|
||||
Event.getComing().forEach(event -> {
|
||||
StringBuilder st = new StringBuilder();
|
||||
if (event.getDeadline().after(now)) {
|
||||
st.append("Deadline: <t:").append(event.getDeadline().getTime()).append(":R>\n");
|
||||
st.append("Deadline: <t:").append(event.getDeadline().getTime() / 1000).append(":R>\n");
|
||||
}
|
||||
st.append("Start: <t:").append(event.getStart().getTime()).append(":R>");
|
||||
st.append("Start: <t:").append(event.getStart().getTime() / 1000).append(":R>");
|
||||
embedBuilder.addField(event.getEventName(), st.toString(), false);
|
||||
});
|
||||
|
||||
@ -89,8 +90,23 @@ public class EventManager {
|
||||
embedBuilder.setTitle("Event: " + event.getEventName());
|
||||
embedBuilder.setAuthor("SteamWar", "https://www.steamwar.de");
|
||||
|
||||
Instant now = Instant.now();
|
||||
EventFight.getEvent(event.getEventID()).forEach(eventFight -> {
|
||||
embedBuilder.addField(Team.get(eventFight.getTeamBlue()).getTeamKuerzel() + " vs. " + Team.get(eventFight.getTeamRed()).getTeamKuerzel(), "<t:" + eventFight.getStartTime().getTime() + ":R>", true);
|
||||
Team teamBlue = Team.get(eventFight.getTeamBlue());
|
||||
Team teamRed = Team.get(eventFight.getTeamRed());
|
||||
|
||||
StringBuilder st = new StringBuilder();
|
||||
st.append("Fightbeginn: <t:").append(eventFight.getStartTime().getTime() / 1000).append(":R>");
|
||||
if(now.isAfter(eventFight.getStartTime().toInstant().plus(35, ChronoUnit.MINUTES))) {
|
||||
if (eventFight.getErgebnis() == 1) {
|
||||
st.append("Sieg ").append(teamBlue.getTeamKuerzel());
|
||||
} else if (eventFight.getErgebnis() == 2) {
|
||||
st.append("Sieg ").append(teamRed.getTeamKuerzel());
|
||||
} else {
|
||||
st.append("Unentschieden");
|
||||
}
|
||||
}
|
||||
embedBuilder.addField(teamBlue.getTeamKuerzel() + " vs. " + teamRed.getTeamKuerzel(), st.toString(), true);
|
||||
});
|
||||
|
||||
MessageBuilder messageBuilder = new MessageBuilder();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren