!fix: removed not properly usable sendplanner command

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-15 08:07:15 +02:00
parent 8bebe08b15
commit 9885466ed5

View file

@ -18,8 +18,6 @@
package net.moonleay.lilJudd.extensions
import com.kotlindiscord.kord.extensions.commands.Arguments
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
@ -44,11 +42,11 @@ class SendPlannerExtension : Extension() {
get() = false
override suspend fun setup() {
publicSlashCommand(::PlannerArgs) {
publicSlashCommand() {
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)
if (!this.member!!.asMember(this.guild!!.id)
.hasPermission(Permission.Administrator)
) {
val res = this.respond {
@ -65,7 +63,6 @@ class SendPlannerExtension : Extension() {
var then =
ZonedDateTime.now(ZoneId.of("Europe/Berlin")).withDayOfMonth(getMondayDayOfMonth()).withHour(4)
.withMinute(0).withSecond(0)
repeat(this.arguments.weeks) {
c.createMessage {
this.embeds.add(
MessageUtil.getEmbed(
@ -100,8 +97,6 @@ class SendPlannerExtension : Extension() {
Logger.out("Finished sending day $it")
delay(1000)
}
Logger.out("Finished week $it")
}
Logger.out("Finished with ${c.data.guildId.value}")
}
}
@ -112,12 +107,4 @@ class SendPlannerExtension : Extension() {
val monday = now.with(DayOfWeek.MONDAY)
return monday.dayOfMonth
}
inner class PlannerArgs : Arguments() {
val weeks by int {
name = "weeks"
description = "Amount of weeks to send. Needs to be at least 1."
minValue = 1
}
}
}