forked from DiscordBots/lilJudd
fix!: Changed all colors to EmbedColor
Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
parent
8d14597a38
commit
caa5d49bad
8 changed files with 50 additions and 48 deletions
|
@ -19,7 +19,6 @@
|
|||
package net.moonleay.lilJudd
|
||||
|
||||
import com.kotlindiscord.kord.extensions.ExtensibleBot
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.common.entity.PresenceStatus
|
||||
import dev.kord.core.behavior.interaction.response.respond
|
||||
import dev.kord.core.event.gateway.ReadyEvent
|
||||
|
@ -39,6 +38,7 @@ import net.moonleay.lilJudd.extensions.*
|
|||
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||
import net.moonleay.lilJudd.features.MatchManager
|
||||
import net.moonleay.lilJudd.features.TimeManager
|
||||
import net.moonleay.lilJudd.util.EmbedColor
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
import net.moonleay.lilJudd.util.MessageUtil
|
||||
import kotlin.system.exitProcess
|
||||
|
@ -146,9 +146,10 @@ object Bot {
|
|||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Error",
|
||||
"Could not find button with id \"${inter.componentId}\".\nPlease report this.",
|
||||
EmbedColor.ERROR,
|
||||
"404: Not Found",
|
||||
"Could not find button with id \"${inter.componentId}\"." +
|
||||
"\nPlease report this.",
|
||||
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.types.respond
|
||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.common.entity.Permission
|
||||
import net.moonleay.lilJudd.extensions.component.EnableOrDisable
|
||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
||||
import net.moonleay.lilJudd.features.component.FeatureManager
|
||||
import net.moonleay.lilJudd.util.EmbedColor
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
import net.moonleay.lilJudd.util.MessageUtil
|
||||
|
||||
|
@ -51,7 +51,7 @@ class FeatureManageExtension : Extension() {
|
|||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"403: Forbidden",
|
||||
"You cannot edit features, as you don't have the Administrator permission.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
@ -70,7 +70,7 @@ class FeatureManageExtension : Extension() {
|
|||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"404: Not Found",
|
||||
"The feature you are trying to edit does not exist.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
|
|
@ -25,7 +25,6 @@ import com.kotlindiscord.kord.extensions.commands.converters.impl.string
|
|||
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.core.behavior.channel.createMessage
|
||||
import dev.kord.core.behavior.createRole
|
||||
import dev.kord.rest.builder.message.create.actionRow
|
||||
|
@ -33,6 +32,7 @@ import net.moonleay.lilJudd.data.tables.MatchPlanningData
|
|||
import net.moonleay.lilJudd.extensions.component.MatchTypes
|
||||
import net.moonleay.lilJudd.jobs.MatchJob
|
||||
import net.moonleay.lilJudd.jobs.component.JobManager
|
||||
import net.moonleay.lilJudd.util.EmbedColor
|
||||
import net.moonleay.lilJudd.util.EmbedUtil
|
||||
import net.moonleay.lilJudd.util.MessageUtil
|
||||
import net.moonleay.lilJudd.util.TimeUtil
|
||||
|
@ -60,7 +60,7 @@ class MatchExtension : Extension() {
|
|||
val msg = this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithTable(
|
||||
Color(0X4C4645),
|
||||
EmbedColor.INFO,
|
||||
args.matchType.readableName,
|
||||
"***Vs. $opponent***\n" +
|
||||
"At ${args.timeStamp}\n" +
|
||||
|
@ -90,7 +90,7 @@ class MatchExtension : Extension() {
|
|||
this.channel.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"500: Internal Error",
|
||||
"Could not find created role.\n" +
|
||||
"It seems, that said role could not be created.",
|
||||
|
|
|
@ -22,16 +22,12 @@ 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
|
||||
import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
||||
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 net.moonleay.lilJudd.util.*
|
||||
import org.jetbrains.exposed.sql.insert
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import java.time.ZoneId
|
||||
|
@ -71,7 +67,7 @@ class SendPlannerExtension : Extension() {
|
|||
c.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0X4C4645),
|
||||
EmbedColor.INFO,
|
||||
"Time Planning Feature",
|
||||
"Do you have time on the following Days?",
|
||||
"Automated Message"
|
||||
|
@ -83,7 +79,7 @@ class SendPlannerExtension : Extension() {
|
|||
val msg = c.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithTable(
|
||||
Color(0X4C4645),
|
||||
EmbedColor.INFO,
|
||||
"",
|
||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||
mapOf(
|
||||
|
|
|
@ -23,16 +23,16 @@ 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.entity.Permission
|
||||
import dev.kord.gateway.PrivilegedIntent
|
||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||
import net.moonleay.lilJudd.util.EmbedColor
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
import net.moonleay.lilJudd.util.MessageUtil
|
||||
|
||||
class UpdateRolesExtension : Extension() {
|
||||
override val name = "updateroles"
|
||||
override val allowApplicationCommandInDMs: Boolean
|
||||
get() = false
|
||||
|
||||
@OptIn(PrivilegedIntent::class)
|
||||
override suspend fun setup() {
|
||||
publicSlashCommand() {
|
||||
name = "updateroles"
|
||||
|
@ -41,17 +41,30 @@ class UpdateRolesExtension : Extension() {
|
|||
if (!this.member!!.asMember(this.guild!!.id)
|
||||
.hasPermission(Permission.Administrator)
|
||||
) {
|
||||
val res = this.respond {
|
||||
this.content = "You need to be an administrator to use this command."
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
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
|
||||
}
|
||||
val res = this.respond {
|
||||
this.content = "OK."
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
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 --
|
||||
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.publicSlashCommand
|
||||
import dev.kord.common.Color
|
||||
import net.moonleay.botendo.build.BuildConstants
|
||||
import net.moonleay.lilJudd.util.EmbedColor
|
||||
import net.moonleay.lilJudd.util.MessageUtil
|
||||
|
||||
class VersionExtension : Extension() {
|
||||
|
@ -33,7 +33,7 @@ class VersionExtension : Extension() {
|
|||
this.action {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0x52E01A),
|
||||
EmbedColor.INFO,
|
||||
"Lil' Judd",
|
||||
"Lil' Judd ***v." + BuildConstants.version + "***\n" +
|
||||
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
||||
|
|
|
@ -21,7 +21,6 @@ package net.moonleay.lilJudd.features
|
|||
import com.kotlindiscord.kord.extensions.utils.isNullOrBot
|
||||
import dev.inmo.krontab.buildSchedule
|
||||
import dev.inmo.krontab.doInfinity
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.common.entity.Snowflake
|
||||
import dev.kord.core.behavior.UserBehavior
|
||||
import dev.kord.core.behavior.createRole
|
||||
|
@ -38,10 +37,7 @@ import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
|||
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
||||
import net.moonleay.lilJudd.features.component.IFeature
|
||||
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 net.moonleay.lilJudd.util.*
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
|
@ -264,7 +260,7 @@ object AvailabilityManager : IFeature {
|
|||
}
|
||||
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
EmbedColor.SUCCESS,
|
||||
"200: Success",
|
||||
"The feature was enabled in channel ${args.channel.data.name.value} with roles ${hasTimeRole.mention} & ${wantsNotifsRole.mention}.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
@ -273,7 +269,7 @@ object AvailabilityManager : IFeature {
|
|||
|
||||
// They exist, do not add them
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"403: Forbidden",
|
||||
"The feature is already enabled in this channel.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
@ -318,7 +314,7 @@ object AvailabilityManager : IFeature {
|
|||
}
|
||||
}
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0x52E019),
|
||||
EmbedColor.SUCCESS,
|
||||
"200: Success",
|
||||
"The feature was disabled.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
@ -326,7 +322,7 @@ object AvailabilityManager : IFeature {
|
|||
}
|
||||
// not in db, do nothing
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"403: Forbidden",
|
||||
"The feature is already disabled in this channel.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
|
|
@ -20,7 +20,6 @@ package net.moonleay.lilJudd.features
|
|||
|
||||
import dev.inmo.krontab.buildSchedule
|
||||
import dev.inmo.krontab.doInfinity
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.common.entity.Snowflake
|
||||
import dev.kord.core.behavior.UserBehavior
|
||||
import dev.kord.core.behavior.channel.createMessage
|
||||
|
@ -37,10 +36,7 @@ import net.moonleay.lilJudd.data.tables.TimePlanningMessages
|
|||
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
||||
import net.moonleay.lilJudd.features.component.IFeature
|
||||
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 net.moonleay.lilJudd.util.*
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
|
@ -101,7 +97,7 @@ object TimeManager : IFeature {
|
|||
"The weekly planning starts now <@&${Snowflake(roleMap[ch]?.wantstobenotifid!!)}>"
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0X4C4645),
|
||||
EmbedColor.INFO,
|
||||
"Time Planning Feature",
|
||||
"Do you have time on the following Days?",
|
||||
"Automated Message"
|
||||
|
@ -112,7 +108,7 @@ object TimeManager : IFeature {
|
|||
c.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0X4C4645),
|
||||
EmbedColor.INFO,
|
||||
"Time Planning Feature",
|
||||
"Do you have time on the following Days?",
|
||||
"Automated Message"
|
||||
|
@ -126,7 +122,7 @@ object TimeManager : IFeature {
|
|||
val msg = c.createMessage {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithTable(
|
||||
Color(0X4C4645),
|
||||
EmbedColor.INFO,
|
||||
"",
|
||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||
mapOf(
|
||||
|
@ -184,14 +180,14 @@ object TimeManager : IFeature {
|
|||
} get TimePlanningChannels.id
|
||||
}
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
EmbedColor.SUCCESS,
|
||||
"200: Success",
|
||||
"The feature was enabled in channel ${args.channel.data.name.value}",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
)
|
||||
}
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"403: Forbidden",
|
||||
"The feature is already enabled in this channel.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
@ -226,7 +222,7 @@ object TimeManager : IFeature {
|
|||
}
|
||||
}
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0x52E019),
|
||||
EmbedColor.SUCCESS,
|
||||
"200: Success",
|
||||
"The feature was disabled.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
@ -234,7 +230,7 @@ object TimeManager : IFeature {
|
|||
}
|
||||
// Do nothing; not in db
|
||||
return MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
EmbedColor.ERROR,
|
||||
"403: Forbidden",
|
||||
"The feature is already disabled in this channel.",
|
||||
u.asUser().username + "#" + u.asUser().discriminator
|
||||
|
|
Loading…
Reference in a new issue