Return username on send, add message to close auth page
This commit is contained in:
parent
5192999143
commit
112791e926
2 changed files with 3 additions and 4 deletions
|
@ -50,7 +50,7 @@ public class DCController {
|
||||||
service.deleteSession(user);
|
service.deleteSession(user);
|
||||||
String token = UUID.randomUUID().toString();
|
String token = UUID.randomUUID().toString();
|
||||||
service.insertSession(new Session(token, Snowflake.of(channel), user));
|
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")
|
@GetMapping("/api/users/get")
|
||||||
|
|
|
@ -6,7 +6,6 @@ import discord4j.core.event.domain.message.MessageCreateEvent;
|
||||||
import discord4j.core.object.entity.GuildMessageChannel;
|
import discord4j.core.object.entity.GuildMessageChannel;
|
||||||
import discord4j.core.object.entity.Member;
|
import discord4j.core.object.entity.Member;
|
||||||
import discord4j.core.object.util.Snowflake;
|
import discord4j.core.object.util.Snowflake;
|
||||||
import io.github.norbipeti.gcdc.Application;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
@ -43,9 +42,9 @@ public class DiscordService {
|
||||||
client.getChannelById(Snowflake.of(channel)).cast(GuildMessageChannel.class)
|
client.getChannelById(Snowflake.of(channel)).cast(GuildMessageChannel.class)
|
||||||
.flatMap(ch -> getUsername(user, ch)
|
.flatMap(ch -> getUsername(user, ch)
|
||||||
.flatMap(name -> ch.createEmbed(ecs -> ecs.setAuthor(name, null, null)
|
.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)
|
.doOnError(result::setErrorResult)
|
||||||
.subscribe(msg -> result.setResult(Application.RESULT_OK));
|
.subscribe(name -> result.setResult(Map.of("response", "OK", "username", name)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue