🔨 Add invite link api

This commit is contained in:
SebClem 2022-06-03 14:28:12 +02:00
parent e760a87e1d
commit e134459ca2
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
2 changed files with 13 additions and 0 deletions

View File

@ -1,8 +1,11 @@
package net.Broken.Api.Controllers;
import net.Broken.Api.Data.Guild;
import net.Broken.Api.Data.InviteLink;
import net.Broken.Api.Security.Data.JwtPrincipal;
import net.Broken.Api.Services.GuildService;
import net.Broken.MainBot;
import net.dv8tion.jda.api.Permission;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
@ -27,4 +30,10 @@ public class GuildController {
JwtPrincipal jwtPrincipal = (JwtPrincipal) authentication.getPrincipal();
return guildService.getMutualGuilds(jwtPrincipal.user());
}
@GetMapping("inviteLink")
public InviteLink getInviteLink(){
String link = MainBot.jda.getInviteUrl(Permission.ADMINISTRATOR);
return new InviteLink(link);
}
}

View File

@ -0,0 +1,4 @@
package net.Broken.Api.Data;
public record InviteLink(String link) {
}