feat: added SendPlannerExtension #1
1 changed files with 11 additions and 3 deletions
|
@ -23,7 +23,9 @@ import com.kotlindiscord.kord.extensions.commands.converters.impl.int
|
|||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.common.entity.Permission
|
||||
import dev.kord.core.behavior.channel.createMessage
|
||||
import dev.kord.rest.builder.message.create.actionRow
|
||||
import kotlinx.coroutines.delay
|
||||
|
@ -46,13 +48,19 @@ class SendPlannerExtension : Extension() {
|
|||
name = "sendplanner"
|
||||
description = "Send the planner for the current and x next weeks"
|
||||
this.action {
|
||||
if (this.arguments.weeks == 0 || !this.member!!.asMember(this.guild!!.id)
|
||||
.hasPermission(Permission.Administrator)
|
||||
) {
|
||||
val res = this.respond {
|
||||
this.content = "no."
|
||||
}
|
||||
res.delete()
|
||||
return@action
|
||||
}
|
||||
val res = this.respond {
|
||||
this.content = "OK."
|
||||
}
|
||||
res.delete()
|
||||
if (this.arguments.weeks == 0) {
|
||||
return@action
|
||||
}
|
||||
val c = this.getChannel().asChannel()
|
||||
var then =
|
||||
ZonedDateTime.now(ZoneId.of("Europe/Berlin")).withDayOfMonth(getMondayDayOfMonth()).withHour(4)
|
||||
|
|
Loading…
Reference in a new issue