Browse Source

Return username on send, add message to close auth page

master
NorbiPeti 4 years ago
parent
commit
112791e926
Signed by: NorbiPeti <szatmari.norbert.peter@gmail.com> GPG Key ID: DBA4C4549A927E56
2 changed files with 3 additions and 4 deletions
  1. +1
    -1
      src/main/java/io/github/norbipeti/gcdc/controller/DCController.java
  2. +2
    -3
      src/main/java/io/github/norbipeti/gcdc/service/DiscordService.java

+ 1
- 1
src/main/java/io/github/norbipeti/gcdc/controller/DCController.java View File

@@ -50,7 +50,7 @@ public class DCController {
service.deleteSession(user);
String token = UUID.randomUUID().toString();
service.insertSession(new Session(token, Snowflake.of(channel), user));
return "Run the following command:<br/>\ndcsetup \"" + token + "\"";
return "Run the following command:<br/>\ndcsetup \"" + token + "\"\n<br>Then you can close this window.";
}

@GetMapping("/api/users/get")


+ 2
- 3
src/main/java/io/github/norbipeti/gcdc/service/DiscordService.java View File

@@ -6,7 +6,6 @@ import discord4j.core.event.domain.message.MessageCreateEvent;
import discord4j.core.object.entity.GuildMessageChannel;
import discord4j.core.object.entity.Member;
import discord4j.core.object.util.Snowflake;
import io.github.norbipeti.gcdc.Application;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.async.DeferredResult;
@@ -43,9 +42,9 @@ public class DiscordService {
client.getChannelById(Snowflake.of(channel)).cast(GuildMessageChannel.class)
.flatMap(ch -> getUsername(user, ch)
.flatMap(name -> ch.createEmbed(ecs -> ecs.setAuthor(name, null, null)
.setColor(Color.BLUE).setDescription(message))))
.setColor(Color.BLUE).setDescription(message)).map(msg -> name)))
.doOnError(result::setErrorResult)
.subscribe(msg -> result.setResult(Application.RESULT_OK));
.subscribe(name -> result.setResult(Map.of("response", "OK", "username", name)));
return result;
}



Loading…
Cancel
Save