forked from DiscordBots/lilJudd
!fix: removed not properly usable sendplanner command
Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
parent
8bebe08b15
commit
9885466ed5
1 changed files with 27 additions and 40 deletions
|
@ -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,42 +63,39 @@ 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(
|
||||
Color(0X4C4645),
|
||||
"Time Planning Feature",
|
||||
"Do you have time on the following Days?",
|
||||
"Automated Message"
|
||||
)
|
||||
)
|
||||
}
|
||||
delay(1000)
|
||||
repeat(7) {
|
||||
c.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
MessageUtil.getEmbedWithTable(
|
||||
Color(0X4C4645),
|
||||
"Time Planning Feature",
|
||||
"Do you have time on the following Days?",
|
||||
"Automated Message"
|
||||
)
|
||||
)
|
||||
}
|
||||
delay(1000)
|
||||
repeat(7) {
|
||||
c.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithTable(
|
||||
Color(0X4C4645),
|
||||
"",
|
||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||
mapOf(
|
||||
"Is available" to listOf(),
|
||||
"May be available" to listOf(),
|
||||
"Is not available" to listOf()
|
||||
)
|
||||
"",
|
||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||
mapOf(
|
||||
"Is available" to listOf(),
|
||||
"May be available" to listOf(),
|
||||
"Is not available" to listOf()
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(ButtonUtil.getTimePlannerButtons().components)
|
||||
}
|
||||
this.actionRow {
|
||||
this.components.addAll(ButtonUtil.getTimePlannerButtons().components)
|
||||
}
|
||||
then = then.plusDays(1).withHour(4).withMinute(0).withSecond(0)
|
||||
Logger.out("Finished sending day $it")
|
||||
delay(1000)
|
||||
}
|
||||
Logger.out("Finished week $it")
|
||||
then = then.plusDays(1).withHour(4).withMinute(0).withSecond(0)
|
||||
Logger.out("Finished sending day $it")
|
||||
delay(1000)
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue