36 lines
1.6 KiB
Java
36 lines
1.6 KiB
Java
package com.discord.widgets.chat.input.applicationcommands;
|
|
|
|
import com.discord.models.commands.ApplicationCommand;
|
|
import com.discord.widgets.chat.input.UserAndSelectedGuildRoles;
|
|
import d0.z.d.m;
|
|
/* compiled from: WidgetChatInputModelMappingFunctions.kt */
|
|
public final class WidgetChatInputModelMappingFunctionsKt {
|
|
public static final boolean hasPermission(ApplicationCommand applicationCommand, UserAndSelectedGuildRoles userAndSelectedGuildRoles) {
|
|
m.checkNotNullParameter(applicationCommand, "$this$hasPermission");
|
|
m.checkNotNullParameter(userAndSelectedGuildRoles, "userAndSelectedGuildRoles");
|
|
if (applicationCommand.getDefaultPermissions() == null) {
|
|
return true;
|
|
}
|
|
if (applicationCommand.getPermissions() != null) {
|
|
Boolean bool = applicationCommand.getPermissions().get(Long.valueOf(userAndSelectedGuildRoles.getUserId()));
|
|
if (bool != null) {
|
|
return bool.booleanValue();
|
|
}
|
|
Boolean bool2 = null;
|
|
for (Long l : userAndSelectedGuildRoles.getUserSelectedGuildRoles()) {
|
|
Boolean bool3 = applicationCommand.getPermissions().get(Long.valueOf(l.longValue()));
|
|
if (bool3 != null) {
|
|
bool2 = Boolean.valueOf(bool3.booleanValue());
|
|
if (m.areEqual(bool2, Boolean.TRUE)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (bool2 != null) {
|
|
return bool2.booleanValue();
|
|
}
|
|
}
|
|
return applicationCommand.getDefaultPermissions().booleanValue();
|
|
}
|
|
}
|