Compare commits
No commits in common. "caa5d49baddaebb268e74c329333b10a1cddc324" and "af15f7eb739f2eef5424298a1cdb9e2f5742e6e5" have entirely different histories.
caa5d49bad
...
af15f7eb73
10 changed files with 57 additions and 86 deletions
|
@ -19,6 +19,7 @@
|
||||||
package net.moonleay.lilJudd
|
package net.moonleay.lilJudd
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.ExtensibleBot
|
import com.kotlindiscord.kord.extensions.ExtensibleBot
|
||||||
|
import dev.kord.common.Color
|
||||||
import dev.kord.common.entity.PresenceStatus
|
import dev.kord.common.entity.PresenceStatus
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.event.gateway.ReadyEvent
|
import dev.kord.core.event.gateway.ReadyEvent
|
||||||
|
@ -38,7 +39,6 @@ import net.moonleay.lilJudd.extensions.*
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.features.MatchManager
|
import net.moonleay.lilJudd.features.MatchManager
|
||||||
import net.moonleay.lilJudd.features.TimeManager
|
import net.moonleay.lilJudd.features.TimeManager
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.lilJudd.util.Logger
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
@ -146,10 +146,9 @@ object Bot {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embeds = mutableListOf(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"404: Not Found",
|
"Error",
|
||||||
"Could not find button with id \"${inter.componentId}\"." +
|
"Could not find button with id \"${inter.componentId}\".\nPlease report this.",
|
||||||
"\nPlease report this.",
|
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,11 +25,11 @@ import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
import com.kotlindiscord.kord.extensions.types.respond
|
||||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
|
import dev.kord.common.Color
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
import net.moonleay.lilJudd.extensions.component.EnableOrDisable
|
import net.moonleay.lilJudd.extensions.component.EnableOrDisable
|
||||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
import net.moonleay.lilJudd.features.component.FeatureEnum
|
||||||
import net.moonleay.lilJudd.features.component.FeatureManager
|
import net.moonleay.lilJudd.features.component.FeatureManager
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.lilJudd.util.Logger
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class FeatureManageExtension : Extension() {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"403: Forbidden",
|
"403: Forbidden",
|
||||||
"You cannot edit features, as you don't have the Administrator permission.",
|
"You cannot edit features, as you don't have the Administrator permission.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
@ -70,7 +70,7 @@ class FeatureManageExtension : Extension() {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"404: Not Found",
|
"404: Not Found",
|
||||||
"The feature you are trying to edit does not exist.",
|
"The feature you are trying to edit does not exist.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.kotlindiscord.kord.extensions.commands.converters.impl.string
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
import com.kotlindiscord.kord.extensions.types.respond
|
||||||
|
import dev.kord.common.Color
|
||||||
import dev.kord.core.behavior.channel.createMessage
|
import dev.kord.core.behavior.channel.createMessage
|
||||||
import dev.kord.core.behavior.createRole
|
import dev.kord.core.behavior.createRole
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
|
@ -32,7 +33,6 @@ import net.moonleay.lilJudd.data.tables.MatchPlanningData
|
||||||
import net.moonleay.lilJudd.extensions.component.MatchTypes
|
import net.moonleay.lilJudd.extensions.component.MatchTypes
|
||||||
import net.moonleay.lilJudd.jobs.MatchJob
|
import net.moonleay.lilJudd.jobs.MatchJob
|
||||||
import net.moonleay.lilJudd.jobs.component.JobManager
|
import net.moonleay.lilJudd.jobs.component.JobManager
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
import net.moonleay.lilJudd.util.TimeUtil
|
import net.moonleay.lilJudd.util.TimeUtil
|
||||||
|
@ -60,7 +60,7 @@ class MatchExtension : Extension() {
|
||||||
val msg = this.respond {
|
val msg = this.respond {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbedWithTable(
|
MessageUtil.getEmbedWithTable(
|
||||||
EmbedColor.INFO,
|
Color(0X4C4645),
|
||||||
args.matchType.readableName,
|
args.matchType.readableName,
|
||||||
"***Vs. $opponent***\n" +
|
"***Vs. $opponent***\n" +
|
||||||
"At ${args.timeStamp}\n" +
|
"At ${args.timeStamp}\n" +
|
||||||
|
@ -90,7 +90,7 @@ class MatchExtension : Extension() {
|
||||||
this.channel.createMessage {
|
this.channel.createMessage {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"500: Internal Error",
|
"500: Internal Error",
|
||||||
"Could not find created role.\n" +
|
"Could not find created role.\n" +
|
||||||
"It seems, that said role could not be created.",
|
"It seems, that said role could not be created.",
|
||||||
|
|
|
@ -22,12 +22,16 @@ import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
import com.kotlindiscord.kord.extensions.types.respond
|
||||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
|
import dev.kord.common.Color
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
import dev.kord.core.behavior.channel.createMessage
|
import dev.kord.core.behavior.channel.createMessage
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
||||||
import net.moonleay.lilJudd.util.*
|
import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
|
import net.moonleay.lilJudd.util.Logger
|
||||||
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
import net.moonleay.lilJudd.util.TimeUtil
|
||||||
import org.jetbrains.exposed.sql.insert
|
import org.jetbrains.exposed.sql.insert
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
|
@ -67,7 +71,7 @@ class SendPlannerExtension : Extension() {
|
||||||
c.createMessage {
|
c.createMessage {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.INFO,
|
Color(0X4C4645),
|
||||||
"Time Planning Feature",
|
"Time Planning Feature",
|
||||||
"Do you have time on the following Days?",
|
"Do you have time on the following Days?",
|
||||||
"Automated Message"
|
"Automated Message"
|
||||||
|
@ -79,7 +83,7 @@ class SendPlannerExtension : Extension() {
|
||||||
val msg = c.createMessage {
|
val msg = c.createMessage {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbedWithTable(
|
MessageUtil.getEmbedWithTable(
|
||||||
EmbedColor.INFO,
|
Color(0X4C4645),
|
||||||
"",
|
"",
|
||||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||||
mapOf(
|
mapOf(
|
||||||
|
|
|
@ -23,16 +23,16 @@ import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
import com.kotlindiscord.kord.extensions.types.respond
|
||||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
|
import dev.kord.gateway.PrivilegedIntent
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.lilJudd.util.Logger
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
|
||||||
|
|
||||||
class UpdateRolesExtension : Extension() {
|
class UpdateRolesExtension : Extension() {
|
||||||
override val name = "updateroles"
|
override val name = "updateroles"
|
||||||
override val allowApplicationCommandInDMs: Boolean
|
override val allowApplicationCommandInDMs: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
|
@OptIn(PrivilegedIntent::class)
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
publicSlashCommand() {
|
publicSlashCommand() {
|
||||||
name = "updateroles"
|
name = "updateroles"
|
||||||
|
@ -41,30 +41,17 @@ class UpdateRolesExtension : Extension() {
|
||||||
if (!this.member!!.asMember(this.guild!!.id)
|
if (!this.member!!.asMember(this.guild!!.id)
|
||||||
.hasPermission(Permission.Administrator)
|
.hasPermission(Permission.Administrator)
|
||||||
) {
|
) {
|
||||||
this.respond {
|
val res = this.respond {
|
||||||
this.embeds.add(
|
this.content = "You need to be an administrator to use this command."
|
||||||
MessageUtil.getEmbed(
|
|
||||||
EmbedColor.ERROR,
|
|
||||||
"403: Forbidden",
|
|
||||||
"You need to be an administrator to use this command.",
|
|
||||||
user.asUser().username + "#" + user.asUser().discriminator
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
res.delete()
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
this.respond {
|
val res = this.respond {
|
||||||
this.embeds.add(
|
this.content = "OK."
|
||||||
MessageUtil.getEmbed(
|
|
||||||
EmbedColor.SUCCESS,
|
|
||||||
"200: Success",
|
|
||||||
"Updating roles.\n" +
|
|
||||||
"This may take a while, please be patient.",
|
|
||||||
user.asUser().username + "#" + user.asUser().discriminator
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- 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...")
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ package net.moonleay.lilJudd.extensions
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
|
import dev.kord.common.Color
|
||||||
import net.moonleay.botendo.build.BuildConstants
|
import net.moonleay.botendo.build.BuildConstants
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
|
||||||
class VersionExtension : Extension() {
|
class VersionExtension : Extension() {
|
||||||
|
@ -33,7 +33,7 @@ class VersionExtension : Extension() {
|
||||||
this.action {
|
this.action {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this,
|
this,
|
||||||
EmbedColor.INFO,
|
Color(0x52E01A),
|
||||||
"Lil' Judd",
|
"Lil' Judd",
|
||||||
"Lil' Judd ***v." + BuildConstants.version + "***\n" +
|
"Lil' Judd ***v." + BuildConstants.version + "***\n" +
|
||||||
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
||||||
|
|
|
@ -21,6 +21,7 @@ package net.moonleay.lilJudd.features
|
||||||
import com.kotlindiscord.kord.extensions.utils.isNullOrBot
|
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.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.behavior.UserBehavior
|
import dev.kord.core.behavior.UserBehavior
|
||||||
import dev.kord.core.behavior.createRole
|
import dev.kord.core.behavior.createRole
|
||||||
|
@ -37,7 +38,10 @@ import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
||||||
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
||||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
import net.moonleay.lilJudd.features.component.FeatureEnum
|
||||||
import net.moonleay.lilJudd.features.component.IFeature
|
import net.moonleay.lilJudd.features.component.IFeature
|
||||||
import net.moonleay.lilJudd.util.*
|
import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
|
import net.moonleay.lilJudd.util.Logger
|
||||||
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
import net.moonleay.lilJudd.util.TimeUtil
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
@ -260,7 +264,7 @@ object AvailabilityManager : IFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.SUCCESS,
|
Color(0x52E01A),
|
||||||
"200: Success",
|
"200: Success",
|
||||||
"The feature was enabled in channel ${args.channel.data.name.value} with roles ${hasTimeRole.mention} & ${wantsNotifsRole.mention}.",
|
"The feature was enabled in channel ${args.channel.data.name.value} with roles ${hasTimeRole.mention} & ${wantsNotifsRole.mention}.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
@ -269,7 +273,7 @@ object AvailabilityManager : IFeature {
|
||||||
|
|
||||||
// They exist, do not add them
|
// They exist, do not add them
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"403: Forbidden",
|
"403: Forbidden",
|
||||||
"The feature is already enabled in this channel.",
|
"The feature is already enabled in this channel.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
@ -314,7 +318,7 @@ object AvailabilityManager : IFeature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.SUCCESS,
|
Color(0x52E019),
|
||||||
"200: Success",
|
"200: Success",
|
||||||
"The feature was disabled.",
|
"The feature was disabled.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
@ -322,7 +326,7 @@ object AvailabilityManager : IFeature {
|
||||||
}
|
}
|
||||||
// not in db, do nothing
|
// not in db, do nothing
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"403: Forbidden",
|
"403: Forbidden",
|
||||||
"The feature is already disabled in this channel.",
|
"The feature is already disabled in this channel.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
|
|
@ -20,6 +20,7 @@ package net.moonleay.lilJudd.features
|
||||||
|
|
||||||
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.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.behavior.UserBehavior
|
import dev.kord.core.behavior.UserBehavior
|
||||||
import dev.kord.core.behavior.channel.createMessage
|
import dev.kord.core.behavior.channel.createMessage
|
||||||
|
@ -36,7 +37,10 @@ import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
||||||
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
||||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
import net.moonleay.lilJudd.features.component.FeatureEnum
|
||||||
import net.moonleay.lilJudd.features.component.IFeature
|
import net.moonleay.lilJudd.features.component.IFeature
|
||||||
import net.moonleay.lilJudd.util.*
|
import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
|
import net.moonleay.lilJudd.util.Logger
|
||||||
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
import net.moonleay.lilJudd.util.TimeUtil
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
@ -97,7 +101,7 @@ object TimeManager : IFeature {
|
||||||
"The weekly planning starts now <@&${Snowflake(roleMap[ch]?.wantstobenotifid!!)}>"
|
"The weekly planning starts now <@&${Snowflake(roleMap[ch]?.wantstobenotifid!!)}>"
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.INFO,
|
Color(0X4C4645),
|
||||||
"Time Planning Feature",
|
"Time Planning Feature",
|
||||||
"Do you have time on the following Days?",
|
"Do you have time on the following Days?",
|
||||||
"Automated Message"
|
"Automated Message"
|
||||||
|
@ -108,7 +112,7 @@ object TimeManager : IFeature {
|
||||||
c.createMessage {
|
c.createMessage {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
EmbedColor.INFO,
|
Color(0X4C4645),
|
||||||
"Time Planning Feature",
|
"Time Planning Feature",
|
||||||
"Do you have time on the following Days?",
|
"Do you have time on the following Days?",
|
||||||
"Automated Message"
|
"Automated Message"
|
||||||
|
@ -122,7 +126,7 @@ object TimeManager : IFeature {
|
||||||
val msg = c.createMessage {
|
val msg = c.createMessage {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbedWithTable(
|
MessageUtil.getEmbedWithTable(
|
||||||
EmbedColor.INFO,
|
Color(0X4C4645),
|
||||||
"",
|
"",
|
||||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||||
mapOf(
|
mapOf(
|
||||||
|
@ -180,14 +184,14 @@ object TimeManager : IFeature {
|
||||||
} get TimePlanningChannels.id
|
} get TimePlanningChannels.id
|
||||||
}
|
}
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.SUCCESS,
|
Color(0x52E01A),
|
||||||
"200: Success",
|
"200: Success",
|
||||||
"The feature was enabled in channel ${args.channel.data.name.value}",
|
"The feature was enabled in channel ${args.channel.data.name.value}",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"403: Forbidden",
|
"403: Forbidden",
|
||||||
"The feature is already enabled in this channel.",
|
"The feature is already enabled in this channel.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
@ -222,7 +226,7 @@ object TimeManager : IFeature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.SUCCESS,
|
Color(0x52E019),
|
||||||
"200: Success",
|
"200: Success",
|
||||||
"The feature was disabled.",
|
"The feature was disabled.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
@ -230,7 +234,7 @@ object TimeManager : IFeature {
|
||||||
}
|
}
|
||||||
// Do nothing; not in db
|
// Do nothing; not in db
|
||||||
return MessageUtil.getEmbed(
|
return MessageUtil.getEmbed(
|
||||||
EmbedColor.ERROR,
|
Color(0xE0311A),
|
||||||
"403: Forbidden",
|
"403: Forbidden",
|
||||||
"The feature is already disabled in this channel.",
|
"The feature is already disabled in this channel.",
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
u.asUser().username + "#" + u.asUser().discriminator
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.util
|
|
||||||
|
|
||||||
import dev.kord.common.Color
|
|
||||||
|
|
||||||
enum class EmbedColor(val color: Color) {
|
|
||||||
ERROR(Color(0xE0311A)),
|
|
||||||
WARNING(Color(0xFFA500)),
|
|
||||||
SUCCESS(Color(0x52E01A)),
|
|
||||||
INFO(Color(0x4C4645)),
|
|
||||||
}
|
|
|
@ -22,6 +22,7 @@ import com.kotlindiscord.kord.extensions.commands.Arguments
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
|
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
|
||||||
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
import com.kotlindiscord.kord.extensions.types.respond
|
||||||
|
import dev.kord.common.Color
|
||||||
import dev.kord.core.entity.Embed
|
import dev.kord.core.entity.Embed
|
||||||
import dev.kord.rest.builder.message.EmbedBuilder
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
@ -33,7 +34,7 @@ object MessageUtil {
|
||||||
///Send an embedded message as a reply
|
///Send an embedded message as a reply
|
||||||
suspend fun sendEmbedForPublicSlashCommand(
|
suspend fun sendEmbedForPublicSlashCommand(
|
||||||
ctx: PublicSlashCommandContext<Arguments, ModalForm>,
|
ctx: PublicSlashCommandContext<Arguments, ModalForm>,
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String
|
description: String
|
||||||
) {
|
) {
|
||||||
|
@ -52,7 +53,7 @@ object MessageUtil {
|
||||||
///Send an embedded message with an image as a reply
|
///Send an embedded message with an image as a reply
|
||||||
suspend fun sendEmbedForPublicSlashCommandWithImage(
|
suspend fun sendEmbedForPublicSlashCommandWithImage(
|
||||||
ctx: PublicSlashCommandContext<Arguments, ModalForm>,
|
ctx: PublicSlashCommandContext<Arguments, ModalForm>,
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
thumbnailUrl: String
|
thumbnailUrl: String
|
||||||
|
@ -102,7 +103,7 @@ object MessageUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getEmbedWithTableWithFooter(
|
fun getEmbedWithTableWithFooter(
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
values: Map<String, List<String>>?,
|
values: Map<String, List<String>>?,
|
||||||
|
@ -116,7 +117,7 @@ object MessageUtil {
|
||||||
|
|
||||||
///Get an embedded msg with image, title and description
|
///Get an embedded msg with image, title and description
|
||||||
fun getEmbedWithTable(
|
fun getEmbedWithTable(
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
values: Map<String, List<String>>?
|
values: Map<String, List<String>>?
|
||||||
|
@ -139,20 +140,20 @@ object MessageUtil {
|
||||||
|
|
||||||
///Get an embedded msg with title and description
|
///Get an embedded msg with title and description
|
||||||
fun getEmbedSmall(
|
fun getEmbedSmall(
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String
|
description: String
|
||||||
): EmbedBuilder {
|
): EmbedBuilder {
|
||||||
val ebb = EmbedBuilder()
|
val ebb = EmbedBuilder()
|
||||||
ebb.title = title
|
ebb.title = title
|
||||||
ebb.description = description
|
ebb.description = description
|
||||||
ebb.color = color.color
|
ebb.color = color
|
||||||
return ebb
|
return ebb
|
||||||
}
|
}
|
||||||
|
|
||||||
///Get an embedded msg with title, description and a src
|
///Get an embedded msg with title, description and a src
|
||||||
fun getEmbed(
|
fun getEmbed(
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
source: String
|
source: String
|
||||||
|
@ -166,7 +167,7 @@ object MessageUtil {
|
||||||
|
|
||||||
///Get an embedded msg with image, title, description and a src
|
///Get an embedded msg with image, title, description and a src
|
||||||
fun getEmbedWithImage(
|
fun getEmbedWithImage(
|
||||||
color: EmbedColor,
|
color: Color,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
source: String,
|
source: String,
|
||||||
|
|
Loading…
Reference in a new issue