feat: added SendPlannerExtension #1

Merged
moonleay merged 1 commit from master into feature/ping_system 2023-06-06 09:37:53 +00:00
Showing only changes of commit 414c48708f - Show all commits

View file

@ -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)