Don’t remove managed roles for timeout
This commit is contained in:
parent
93a6e92191
commit
3944b07ec0
|
@ -22,6 +22,7 @@ internal class MessageRedirect(rawRedirect: RawRedirect) {
|
||||||
content.removePrefix(command.trigger).trim()
|
content.removePrefix(command.trigger).trim()
|
||||||
}
|
}
|
||||||
addField(Config.localization.redirectedMessage, redirectedText)
|
addField(Config.localization.redirectedMessage, redirectedText)
|
||||||
|
Log.info("Redirected message: $redirectedText")
|
||||||
}
|
}
|
||||||
// No inlined if/else because the types are different.
|
// No inlined if/else because the types are different.
|
||||||
// Passing the full message author will also include the avatar in the embed.
|
// Passing the full message author will also include the avatar in the embed.
|
||||||
|
|
|
@ -20,10 +20,12 @@ class TimeoutFeature(raw: RawTimeoutFeature) : MessageFeature {
|
||||||
override fun handle(message: MessageCreateEvent) {
|
override fun handle(message: MessageCreateEvent) {
|
||||||
val (_, target, time) = message.readableMessageContent.split(' ', limit = 3)
|
val (_, target, time) = message.readableMessageContent.split(' ', limit = 3)
|
||||||
findUser(target)?.let { user ->
|
findUser(target)?.let { user ->
|
||||||
val oldRoles = user.getRoles(Config.server).map { role ->
|
val oldRoles = user.getRoles(Config.server)
|
||||||
user.removeRole(role)
|
.filter { !it.isManaged }
|
||||||
role.id
|
.map { role ->
|
||||||
}
|
user.removeRole(role)
|
||||||
|
role.id
|
||||||
|
}
|
||||||
user.addRole(timeoutRole)
|
user.addRole(timeoutRole)
|
||||||
val releaseTime = Instant.now().plus(Duration.ofMinutes(time.toLong())).epochSecond
|
val releaseTime = Instant.now().plus(Duration.ofMinutes(time.toLong())).epochSecond
|
||||||
Dao.saveTimeout(releaseTime, listOf(user.id) + oldRoles)
|
Dao.saveTimeout(releaseTime, listOf(user.id) + oldRoles)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user