🔨 Add canManage to guild list
This commit is contained in:
parent
ccb0c6eee8
commit
606d223361
@ -1,4 +1,4 @@
|
|||||||
package net.Broken.Api.Data.Guild;
|
package net.Broken.Api.Data.Guild;
|
||||||
|
|
||||||
public record Guild(String id, String name, String iconUrl) {
|
public record Guild(String id, String name, String iconUrl, boolean canManage) {
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,12 @@ public class GuildService {
|
|||||||
List<Guild> guildList = new ArrayList<>();
|
List<Guild> guildList = new ArrayList<>();
|
||||||
|
|
||||||
for (net.dv8tion.jda.api.entities.Guild guild : mutualGuilds) {
|
for (net.dv8tion.jda.api.entities.Guild guild : mutualGuilds) {
|
||||||
guildList.add(new Guild(guild.getId(), guild.getName(), guild.getIconUrl()));
|
boolean canManage = guild.getMember(discordUser).hasPermission(
|
||||||
|
Permission.MANAGE_SERVER,
|
||||||
|
Permission.MANAGE_PERMISSIONS,
|
||||||
|
Permission.MANAGE_CHANNEL
|
||||||
|
);
|
||||||
|
guildList.add(new Guild(guild.getId(), guild.getName(), guild.getIconUrl(), canManage));
|
||||||
}
|
}
|
||||||
return guildList;
|
return guildList;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user