mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-06-22 00:42:46 +00:00
[SIS-xxx] changing ban message
modifying meetup to add the location on the meetup message itself updating abstracto version
This commit is contained in:
@@ -35,6 +35,8 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -76,7 +78,7 @@ public class CreateMeetup extends AbstractConditionableCommand {
|
||||
private static final String DESCRIPTION_PARAMETER = "description";
|
||||
private static final String LOCATION_PARAMETER = "location";
|
||||
private static final String CONFIRMATION_TEMPLATE = "createMeetup_confirmation";
|
||||
private static final String DEFAULT_LOCATION_STRING = "\"\"";
|
||||
private static final String DEFAULT_LOCATION_STRING = "";
|
||||
|
||||
@Override
|
||||
public CompletableFuture<CommandResult> executeAsync(CommandContext commandContext) {
|
||||
@@ -94,13 +96,14 @@ public class CreateMeetup extends AbstractConditionableCommand {
|
||||
Meetup meetup = meetupManagementServiceBean.createMeetup(meetupTime, meetupTopic, description, organizer, meetupChannel, DEFAULT_LOCATION_STRING);
|
||||
String confirmationId = componentService.generateComponentId();
|
||||
String cancelId = componentService.generateComponentId();
|
||||
String locationEncoded = URLEncoder.encode(meetup.getLocation(), StandardCharsets.UTF_8);
|
||||
MeetupConfirmationModel model = MeetupConfirmationModel
|
||||
.builder()
|
||||
.meetupTime(meetupTime)
|
||||
.guildId(commandContext.getGuild().getIdLong())
|
||||
.description(description)
|
||||
.topic(meetupTopic)
|
||||
.location(meetup.getLocation())
|
||||
.location(locationEncoded)
|
||||
.confirmationId(confirmationId)
|
||||
.cancelId(cancelId)
|
||||
.meetupId(meetup.getId().getId())
|
||||
@@ -136,13 +139,14 @@ public class CreateMeetup extends AbstractConditionableCommand {
|
||||
Meetup meetup = meetupManagementServiceBean.createMeetup(meetupTime, topic, description, organizer, meetupChannel, location);
|
||||
String confirmationId = componentService.generateComponentId();
|
||||
String cancelId = componentService.generateComponentId();
|
||||
String locationEncoded = URLEncoder.encode(meetup.getLocation(), StandardCharsets.UTF_8);
|
||||
MeetupConfirmationModel model = MeetupConfirmationModel
|
||||
.builder()
|
||||
.meetupTime(meetupTime)
|
||||
.guildId(event.getGuild().getIdLong())
|
||||
.description(description)
|
||||
.topic(topic)
|
||||
.location(meetup.getLocation())
|
||||
.location(locationEncoded)
|
||||
.confirmationId(confirmationId)
|
||||
.cancelId(cancelId)
|
||||
.meetupId(meetup.getId().getId())
|
||||
|
||||
@@ -16,7 +16,7 @@ public class MeetupMessageModel {
|
||||
private String description;
|
||||
private Instant meetupTime;
|
||||
private String location;
|
||||
private String decodedLocation;
|
||||
private String locationEncoded;
|
||||
private MemberDisplay organizer;
|
||||
private Long meetupId;
|
||||
private String yesId;
|
||||
|
||||
@@ -195,17 +195,17 @@ public class MeetupServiceBean {
|
||||
.filter(meetupParticipator -> meetupParticipator.getDecision().equals(MeetupDecision.NO_TIME))
|
||||
.map(mapToUserId)
|
||||
.toList();
|
||||
String rawLocation = java.net.URLDecoder.decode(meetup.getLocation(), StandardCharsets.UTF_8);
|
||||
List<Long> participantIds = allParticipants
|
||||
.stream()
|
||||
.map(mapToUserId)
|
||||
.collect(Collectors.toList());
|
||||
String locationEncoded = URLEncoder.encode(meetup.getLocation(), StandardCharsets.UTF_8);
|
||||
MeetupMessageModel.MeetupMessageModelBuilder builder = MeetupMessageModel
|
||||
.builder()
|
||||
.description(meetup.getDescription())
|
||||
.topic(meetup.getTopic())
|
||||
.location(meetup.getLocation())
|
||||
.decodedLocation(rawLocation)
|
||||
.locationEncoded(locationEncoded)
|
||||
.noTimeId(meetup.getNoTimeButtonId())
|
||||
.yesId(meetup.getYesButtonId())
|
||||
.maybeId(meetup.getMaybeButtonId())
|
||||
@@ -525,11 +525,7 @@ public class MeetupServiceBean {
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> changeMeetupLocation(Meetup meetup, String newLocation) {
|
||||
try {
|
||||
meetup.setLocation(URLEncoder.encode(newLocation, StandardCharsets.UTF_8.toString()));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new AbstractoRunTimeException(e);
|
||||
}
|
||||
meetup.setLocation(newLocation);
|
||||
return updateMeetupMessage(meetup);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,23 +35,18 @@ public class MeetupManagementServiceBean {
|
||||
throw new MeetupPastTimeException();
|
||||
}
|
||||
Long meetupId = counterService.getNextCounterValue(organizer.getServerReference(), MEETUP_COUNTER_KEY);
|
||||
Meetup meetup = null;
|
||||
try {
|
||||
meetup = Meetup
|
||||
Meetup meetup = Meetup
|
||||
.builder()
|
||||
.meetupTime(timeStamp)
|
||||
.description(description)
|
||||
.topic(topic)
|
||||
.location(URLEncoder.encode(location, StandardCharsets.UTF_8.toString()))
|
||||
.location(location)
|
||||
.organizer(organizer)
|
||||
.server(organizer.getServerReference())
|
||||
.meetupChannel(meetupChannel)
|
||||
.state(MeetupState.NEW)
|
||||
.id(new ServerSpecificId(organizer.getServerReference().getId(), meetupId))
|
||||
.build();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new AbstractoRunTimeException(e);
|
||||
}
|
||||
return meetupRepository.save(meetup);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user