Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/root' into root
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Jul 23, 2024
2 parents e944502 + 1be2427 commit a594114
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/published-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ afterEvaluate {
name.set(project.ext.get("pubName").toString())
description.set(project.ext.get("pubDesc").toString())

url.set("https://kordex.kotlindiscord.com")
url.set("https://kordex.dev")

packaging = "jar"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public suspend fun CheckContext<*>.hasPermission(perm: Permission) {
val memberObj = member.asMember()

val result = when {
// TODO: Remove this when Kord fixes their function
memberObj.permissions?.contains(Permission.Administrator) == true -> true
memberObj.permissions?.contains(perm) == true -> true

memberObj.hasPermission(Permission.Administrator) -> true

channel != null -> channel.permissionsForMember(member.id).contains(perm)

else -> memberObj.hasPermission(perm)
Expand Down Expand Up @@ -91,7 +96,12 @@ public suspend fun CheckContext<*>.notHasPermission(perm: Permission) {
val memberObj = member.asMember()

val result = when {
// TODO: Remove this when Kord fixes their function
memberObj.permissions?.contains(Permission.Administrator) == true -> true
memberObj.permissions?.contains(perm) == true -> true

memberObj.hasPermission(Permission.Administrator) -> true

channel != null -> channel.permissionsForMember(member.id).contains(perm)

else -> memberObj.hasPermission(perm)
Expand Down Expand Up @@ -139,7 +149,12 @@ public suspend fun CheckContext<*>.hasPermissions(perms: Permissions) {
val memberObj = member.asMember()

val result = when {
// TODO: Remove this when Kord fixes their function
memberObj.permissions?.contains(Permission.Administrator) == true -> true
memberObj.permissions?.contains(perms) == true -> true

memberObj.hasPermission(Permission.Administrator) -> true

channel != null -> channel.permissionsForMember(member.id).contains(perms)

else -> memberObj.hasPermissions(perms.values)
Expand Down Expand Up @@ -188,7 +203,12 @@ public suspend fun CheckContext<*>.notHasPermissions(perms: Permissions) {
val memberObj = member.asMember()

val result = when {
// TODO: Remove this when Kord fixes their function
memberObj.permissions?.contains(Permission.Administrator) == true -> true
memberObj.permissions?.contains(perms) == true -> true

memberObj.hasPermission(Permission.Administrator) -> true

channel != null -> channel.permissionsForMember(member.id).contains(perms)

else -> memberObj.hasPermissions(perms.values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,16 @@ public suspend fun memberFor(event: Event): MemberBehavior? {
null
}

is InteractionCreateEvent -> {
val guildId = event.interaction.data.guildId.value
?: return null
is InteractionCreateEvent -> when {
event.interaction.data.member.value != null && event.interaction.data.user.value != null ->
Member(event.interaction.data.member.value!!, event.interaction.data.user.value!!, event.kord)

event.interaction.data.guildId.value != null ->
event.kord.unsafe
.guild(event.interaction.data.guildId.value!!)
.getMemberOrNull(event.interaction.user.id)

event.kord.unsafe
.guild(guildId)
.getMemberOrNull(event.interaction.user.id)
else -> null
}

is InviteCreateEvent -> event.inviterMember
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.kotlindiscord.kord.extensions.modules.extra.mappings.extMappings
import com.kotlindiscord.kord.extensions.modules.extra.phishing.extPhishing
import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.extPluralKit
import com.kotlindiscord.kord.extensions.testbot.extensions.*
import com.kotlindiscord.kord.extensions.testbot.extensions.PaginatorTestExtension
import com.kotlindiscord.kord.extensions.testbot.utils.LogLevel
import com.kotlindiscord.kord.extensions.utils.env
import com.kotlindiscord.kord.extensions.utils.envOrNull
Expand Down

0 comments on commit a594114

Please sign in to comment.