🔨 Add invite link api
This commit is contained in:
parent
e760a87e1d
commit
e134459ca2
@ -1,8 +1,11 @@
|
|||||||
package net.Broken.Api.Controllers;
|
package net.Broken.Api.Controllers;
|
||||||
|
|
||||||
import net.Broken.Api.Data.Guild;
|
import net.Broken.Api.Data.Guild;
|
||||||
|
import net.Broken.Api.Data.InviteLink;
|
||||||
import net.Broken.Api.Security.Data.JwtPrincipal;
|
import net.Broken.Api.Security.Data.JwtPrincipal;
|
||||||
import net.Broken.Api.Services.GuildService;
|
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.security.core.Authentication;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -27,4 +30,10 @@ public class GuildController {
|
|||||||
JwtPrincipal jwtPrincipal = (JwtPrincipal) authentication.getPrincipal();
|
JwtPrincipal jwtPrincipal = (JwtPrincipal) authentication.getPrincipal();
|
||||||
return guildService.getMutualGuilds(jwtPrincipal.user());
|
return guildService.getMutualGuilds(jwtPrincipal.user());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("inviteLink")
|
||||||
|
public InviteLink getInviteLink(){
|
||||||
|
String link = MainBot.jda.getInviteUrl(Permission.ADMINISTRATOR);
|
||||||
|
return new InviteLink(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
4
src/main/java/net/Broken/Api/Data/InviteLink.java
Normal file
4
src/main/java/net/Broken/Api/Data/InviteLink.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package net.Broken.Api.Data;
|
||||||
|
|
||||||
|
public record InviteLink(String link) {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user