Compare commits
No commits in common. "36f931b9193701a32d18ebbfae5533441cebd869" and "3d1f2c7d8f46d55bfbf157701b3b5d0f162e969b" have entirely different histories.
36f931b919
...
3d1f2c7d8f
4 changed files with 70 additions and 12 deletions
|
@ -47,13 +47,13 @@ class SendPlannerExtension : Extension() {
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
publicSlashCommand() {
|
publicSlashCommand() {
|
||||||
name = "sendplanner"
|
name = "sendplanner"
|
||||||
description = "Send the planner for the current week"
|
description = "Send the planner for the current and x next weeks"
|
||||||
this.action {
|
this.action {
|
||||||
if (!this.member!!.asMember(this.guild!!.id)
|
if (!this.member!!.asMember(this.guild!!.id)
|
||||||
.hasPermission(Permission.Administrator)
|
.hasPermission(Permission.Administrator)
|
||||||
) {
|
) {
|
||||||
val res = this.respond {
|
val res = this.respond {
|
||||||
this.content = "You need to be an administrator to use this command."
|
this.content = "no."
|
||||||
}
|
}
|
||||||
res.delete()
|
res.delete()
|
||||||
return@action
|
return@action
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* lilJudd
|
||||||
|
* Copyright (C) 2023 moonleay
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.moonleay.lilJudd.extensions
|
||||||
|
|
||||||
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
|
import com.kotlindiscord.kord.extensions.types.respond
|
||||||
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
|
import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
|
||||||
|
/* This extension has no proper use.
|
||||||
|
It is used in testing to test stuff, without having to wait for certain events to trigger. */
|
||||||
|
class TestExtension : Extension() {
|
||||||
|
override val name = "test"
|
||||||
|
override val allowApplicationCommandInDMs: Boolean
|
||||||
|
get() = false
|
||||||
|
|
||||||
|
override suspend fun setup() {
|
||||||
|
publicSlashCommand {
|
||||||
|
name = "test"
|
||||||
|
description = "Test game"
|
||||||
|
this.action {
|
||||||
|
this.respond {
|
||||||
|
this.embeds.add(
|
||||||
|
MessageUtil.getEmbedWithTable(
|
||||||
|
Color(0X4C4645),
|
||||||
|
"",
|
||||||
|
"MONDAY, 22.05.2023",
|
||||||
|
mapOf(
|
||||||
|
"Is available" to listOf(),
|
||||||
|
"May be available" to listOf(),
|
||||||
|
"Is not available" to listOf()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
this.actionRow {
|
||||||
|
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ class UpdateRolesExtension : Extension() {
|
||||||
.hasPermission(Permission.Administrator)
|
.hasPermission(Permission.Administrator)
|
||||||
) {
|
) {
|
||||||
val res = this.respond {
|
val res = this.respond {
|
||||||
this.content = "You need to be an administrator to use this command."
|
this.content = "no."
|
||||||
}
|
}
|
||||||
res.delete()
|
res.delete()
|
||||||
return@action
|
return@action
|
||||||
|
@ -55,7 +55,7 @@ class UpdateRolesExtension : Extension() {
|
||||||
// -- below here is the code of the cronjob --
|
// -- below here is the code of the cronjob --
|
||||||
Logger.out("Starting to update roles...")
|
Logger.out("Starting to update roles...")
|
||||||
|
|
||||||
AvailabilityManager.updateInChannel(this.channel.id)
|
AvailabilityManager.runThread()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
package net.moonleay.lilJudd.features
|
package net.moonleay.lilJudd.features
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.utils.isNullOrBot
|
|
||||||
import dev.inmo.krontab.buildSchedule
|
import dev.inmo.krontab.buildSchedule
|
||||||
import dev.inmo.krontab.doInfinity
|
import dev.inmo.krontab.doInfinity
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
@ -163,15 +162,12 @@ object AvailabilityManager : IFeature {
|
||||||
}
|
}
|
||||||
mce.collect { memberchunkevent ->
|
mce.collect { memberchunkevent ->
|
||||||
memberchunkevent.members.forEach {
|
memberchunkevent.members.forEach {
|
||||||
if (!it.isNullOrBot()) { // Check if the member is a bot
|
|
||||||
Logger.out("Checking member ${it.id.value} (${it.username})")
|
Logger.out("Checking member ${it.id.value} (${it.username})")
|
||||||
if (it.roleIds.contains(Snowflake(pnrd.hastimeroleid))) {
|
if (it.roleIds.contains(Snowflake(pnrd.hastimeroleid))) {
|
||||||
it.removeRole(Snowflake(pnrd.hastimeroleid))
|
it.removeRole(Snowflake(pnrd.hastimeroleid))
|
||||||
Logger.out("Removed role from ${it.username}") // Removed the role
|
Logger.out("Removed role from ${it.username}") // Removed the role
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// I cant use continue here, because it does not work with .forEach
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.out("Got through all members")
|
Logger.out("Got through all members")
|
||||||
|
|
Loading…
Reference in a new issue