forked from DiscordBots/lilJudd
fix: fixed all exceptions, which were caused by upgrading dependencies
chore!: rewrote all embeds as a result Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
parent
fc7edc0d0d
commit
5581f8f348
13 changed files with 218 additions and 160 deletions
|
@ -25,7 +25,8 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.lilJudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
||||||
|
@ -89,13 +90,13 @@ class AcceptEditButton() : IEditButton {
|
||||||
if (shouldEditButton) {
|
if (shouldEditButton) {
|
||||||
// update the message
|
// update the message
|
||||||
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
||||||
this.embed {
|
this.embed(fun EmbedBuilder.() {
|
||||||
this.color = eb.color
|
color = eb.color
|
||||||
this.title = eb.title
|
title = eb.title
|
||||||
this.description = eb.description
|
description = eb.description
|
||||||
this.fields = eb.fields
|
fields = eb.fields
|
||||||
this.footer = eb.footer
|
footer = eb.footer
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.lilJudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
||||||
|
@ -62,14 +63,14 @@ class CancelEditButton : IEditButton {
|
||||||
member.removeRole(role.id)
|
member.removeRole(role.id)
|
||||||
}
|
}
|
||||||
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
||||||
this.embed {
|
this.embed(fun EmbedBuilder.() {
|
||||||
val temp = EmbedUtil.replaceXWithYinValuesAtTable(user.id.value.toString(), "", m.embeds[0], 1)
|
val temp = EmbedUtil.replaceXWithYinValuesAtTable(user.id.value.toString(), "", m.embeds[0], 1)
|
||||||
this.color = temp.color
|
color = temp.color
|
||||||
this.title = temp.title
|
title = temp.title
|
||||||
this.description = temp.description
|
description = temp.description
|
||||||
this.fields = temp.fields
|
fields = temp.fields
|
||||||
this.footer = temp.footer
|
footer = temp.footer
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.lilJudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
||||||
|
@ -89,13 +90,13 @@ class DeclineEditButton : IEditButton {
|
||||||
if (shouldEditButton) {
|
if (shouldEditButton) {
|
||||||
// update the message
|
// update the message
|
||||||
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
||||||
this.embed {
|
this.embed(fun EmbedBuilder.() {
|
||||||
this.color = eb.color
|
color = eb.color
|
||||||
this.title = eb.title
|
title = eb.title
|
||||||
this.description = eb.description
|
description = eb.description
|
||||||
this.fields = eb.fields
|
fields = eb.fields
|
||||||
this.footer = eb.footer
|
footer = eb.footer
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.lilJudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
|
|
|
@ -24,7 +24,7 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.lilJudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
|
|
|
@ -24,7 +24,7 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.lilJudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
|
|
|
@ -23,9 +23,9 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.converters.i
|
||||||
import com.kotlindiscord.kord.extensions.commands.converters.impl.channel
|
import com.kotlindiscord.kord.extensions.commands.converters.impl.channel
|
||||||
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.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
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
|
||||||
|
@ -49,14 +49,16 @@ class FeatureManageExtension : Extension() {
|
||||||
val u = this.user
|
val u = this.user
|
||||||
if (!u.asMember(this.guild!!.id).hasPermission(Permission.Administrator)) {
|
if (!u.asMember(this.guild!!.id).hasPermission(Permission.Administrator)) {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "403: Forbidden"
|
||||||
"403: Forbidden",
|
this.description =
|
||||||
"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
|
this.footer {
|
||||||
)
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -68,26 +70,45 @@ class FeatureManageExtension : Extension() {
|
||||||
val f = FeatureManager.getFeature(args.feature)
|
val f = FeatureManager.getFeature(args.feature)
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "404: Not Found"
|
||||||
"404: Not Found",
|
this.description = "The feature you are trying to edit does not exist."
|
||||||
"The feature you are trying to edit does not exist.",
|
this.footer {
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.arguments.setStatus == EnableOrDisable.ENABLE) {
|
if (this.arguments.setStatus == EnableOrDisable.ENABLE) {
|
||||||
|
val enabled = f.enable(u, gID, cID, channel, args)
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(f.enable(u, gID, cID, channel, args))
|
this.embed {
|
||||||
|
this.color = enabled.color
|
||||||
|
this.title = enabled.title
|
||||||
|
this.description = enabled.description
|
||||||
|
this.footer {
|
||||||
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
val disabled = f.disable(u, gID, cID, channel, args)
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(f.disable(u, gID, cID, channel, args))
|
this.embed {
|
||||||
|
this.color = disabled.color
|
||||||
|
this.title = disabled.title
|
||||||
|
this.description = disabled.description
|
||||||
|
this.footer {
|
||||||
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
import net.moonleay.lilJudd.util.EmbedColor
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
|
||||||
import net.moonleay.liljudd.build.BuildConstants
|
import net.moonleay.liljudd.build.BuildConstants
|
||||||
|
|
||||||
class InfoExtension : Extension() {
|
class InfoExtension : Extension() {
|
||||||
|
@ -31,16 +31,17 @@ class InfoExtension : Extension() {
|
||||||
name = "info"
|
name = "info"
|
||||||
description = "Show infos about the bot"
|
description = "Show infos about the bot"
|
||||||
this.action {
|
this.action {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
EmbedColor.INFO,
|
this.color = EmbedColor.INFO.color
|
||||||
"Lil' Judd",
|
this.title = "Li'l Judd"
|
||||||
"Lil' Judd ***v." + BuildConstants.version + "***\n" +
|
this.description = "Li'l Judd ***v." + BuildConstants.version + "***\n" +
|
||||||
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
||||||
"Coroutines ***v." + BuildConstants.coroutinesVersion + "***\n" +
|
"Coroutines ***v." + BuildConstants.coroutinesVersion + "***\n" +
|
||||||
"Krontab ***v." + BuildConstants.krontabVersion + "***\n\n" +
|
"Krontab ***v." + BuildConstants.krontabVersion + "***\n\n" +
|
||||||
"Splatoon 3 api data provided by splatoon3.ink"
|
"Splatoon 3 api data provided by splatoon3.ink"
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ import com.kotlindiscord.kord.extensions.commands.application.slash.converters.i
|
||||||
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
|
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 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.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.data.database.entry.MatchPlanningDataData
|
import net.moonleay.lilJudd.data.database.entry.MatchPlanningDataData
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
||||||
import net.moonleay.lilJudd.extensions.component.MatchTypes
|
import net.moonleay.lilJudd.extensions.component.MatchTypes
|
||||||
|
@ -55,15 +55,16 @@ class MatchExtension : Extension() {
|
||||||
val opponent = args.opponent
|
val opponent = args.opponent
|
||||||
if (!TimeUtil.validateDateString(args.timeStamp)) {
|
if (!TimeUtil.validateDateString(args.timeStamp)) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "400: Bad Request"
|
||||||
"400: Bad Request",
|
this.description = "The given timestamp is invalid.\n" +
|
||||||
"The given timestamp is invalid.\n" +
|
"Please use the format \"dd.MM.yyyy HH:mm\"."
|
||||||
"Please use the format \"dd.MM.yyyy HH:mm\".",
|
this.footer {
|
||||||
m.asUser().username
|
this.icon = m.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(m.asUser())
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -80,32 +81,41 @@ class MatchExtension : Extension() {
|
||||||
// Check if the role was created successfully
|
// Check if the role was created successfully
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "500: Internal Error"
|
||||||
"500: Internal Error",
|
this.description = "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.",
|
this.footer {
|
||||||
m.asUser().username
|
this.icon = m.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(m.asUser())
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val msg = this.respond {
|
val msg = this.respond {
|
||||||
this.embeds.add(
|
val eb = MessageUtil.getEmbedWithTable(
|
||||||
MessageUtil.getEmbedWithTable(
|
EmbedColor.INFO,
|
||||||
EmbedColor.INFO,
|
args.matchType.readableName,
|
||||||
args.matchType.readableName,
|
"***Vs. $opponent***\n" +
|
||||||
"***Vs. $opponent***\n" +
|
"At ${args.timeStamp}\n" +
|
||||||
"At ${args.timeStamp}\n" +
|
"Registered by ${m.mention}",
|
||||||
"Registered by ${m.mention}",
|
mapOf(
|
||||||
mapOf(
|
"Signed up" to listOf(),
|
||||||
"Signed up" to listOf(),
|
"Unavailable" to listOf(),
|
||||||
"Unavailable" to listOf(),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
this.embed {
|
||||||
|
this.color = eb.color
|
||||||
|
this.title = eb.title
|
||||||
|
this.description = eb.description
|
||||||
|
this.fields = eb.fields
|
||||||
|
this.footer {
|
||||||
|
this.icon = m.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(m.asUser())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(EmbedUtil.getMatchButtons().components)
|
this.components.addAll(EmbedUtil.getMatchButtons().components)
|
||||||
|
|
|
@ -20,12 +20,13 @@ 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 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.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.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
||||||
import net.moonleay.lilJudd.data.database.repository.TimePlanningMessagesRepository
|
import net.moonleay.lilJudd.data.database.repository.TimePlanningMessagesRepository
|
||||||
import net.moonleay.lilJudd.util.*
|
import net.moonleay.lilJudd.util.*
|
||||||
|
@ -64,30 +65,40 @@ class SendPlannerExtension : Extension() {
|
||||||
.withHour(4)
|
.withHour(4)
|
||||||
.withMinute(0).withSecond(0)
|
.withMinute(0).withSecond(0)
|
||||||
c.createMessage {
|
c.createMessage {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.INFO.color
|
||||||
EmbedColor.INFO,
|
this.title = "Time Planning Feature"
|
||||||
"Time Planning Feature",
|
this.description = "Do you have time on the following Days?"
|
||||||
"Do you have time on the following Days?",
|
this.footer {
|
||||||
"Automated Message"
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter()
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delay(1000)
|
delay(1000)
|
||||||
repeat(7) {
|
repeat(7) {
|
||||||
val msg = c.createMessage {
|
val eb = MessageUtil.getEmbedWithTable(
|
||||||
this.embeds.add(
|
EmbedColor.INFO,
|
||||||
MessageUtil.getEmbedWithTable(
|
"",
|
||||||
EmbedColor.INFO,
|
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||||
"",
|
mapOf(
|
||||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
"Is available" to listOf(),
|
||||||
mapOf(
|
"May be available" to listOf(),
|
||||||
"Is available" to listOf(),
|
"Is not available" to listOf()
|
||||||
"May be available" to listOf(),
|
|
||||||
"Is not available" to listOf()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val msg = c.createMessage {
|
||||||
|
this.embed {
|
||||||
|
this.color = eb.color
|
||||||
|
this.title = eb.title
|
||||||
|
this.description = eb.description
|
||||||
|
this.fields = eb.fields
|
||||||
|
this.footer {
|
||||||
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
||||||
|
|
|
@ -20,9 +20,9 @@ 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 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.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
import net.moonleay.lilJudd.util.EmbedColor
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.lilJudd.util.Logger
|
||||||
|
@ -42,30 +42,31 @@ class UpdateRolesExtension : Extension() {
|
||||||
.hasPermission(Permission.Administrator)
|
.hasPermission(Permission.Administrator)
|
||||||
) {
|
) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "403: Forbidden"
|
||||||
"403: Forbidden",
|
this.description =
|
||||||
"You need to be an administrator to use this command.",
|
"You cannot update roles, as you don't have the Administrator permission."
|
||||||
user.asUser().username + "#" + user.asUser().discriminator
|
this.footer {
|
||||||
)
|
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.INFO.color
|
||||||
EmbedColor.SUCCESS,
|
this.title = "200: Success"
|
||||||
"200: Success",
|
this.description = "Updating roles.\n" +
|
||||||
"Updating roles.\n" +
|
"This may take a while, please be patient."
|
||||||
"This may take a while, please be patient.",
|
this.footer {
|
||||||
user.asUser().username + "#" + user.asUser().discriminator
|
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- 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.updateInChannel(this.channel.id)
|
||||||
|
|
|
@ -26,7 +26,8 @@ import dev.kord.core.behavior.channel.createMessage
|
||||||
import dev.kord.core.entity.channel.Channel
|
import dev.kord.core.entity.channel.Channel
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.rest.builder.message.EmbedBuilder
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningChannelsData
|
import net.moonleay.lilJudd.data.database.entry.TimePlanningChannelsData
|
||||||
|
@ -78,43 +79,53 @@ object TimeManager : IFeature {
|
||||||
c.createMessage {
|
c.createMessage {
|
||||||
this.content =
|
this.content =
|
||||||
"The weekly planning starts now <@&${Snowflake(targetedRoles[ch2]?.wantsToBeNotifiedID!!)}>"
|
"The weekly planning starts now <@&${Snowflake(targetedRoles[ch2]?.wantsToBeNotifiedID!!)}>"
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.INFO.color
|
||||||
EmbedColor.INFO,
|
this.title = "Time Planning Feature"
|
||||||
"Time Planning Feature",
|
this.description = "Do you have time on the following Days?"
|
||||||
"Do you have time on the following Days?",
|
this.footer {
|
||||||
"Automated Message"
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter()
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
c.createMessage {
|
c.createMessage {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.INFO.color
|
||||||
EmbedColor.INFO,
|
this.title = "Time Planning Feature"
|
||||||
"Time Planning Feature",
|
this.description = "Do you have time on the following Days?"
|
||||||
"Do you have time on the following Days?",
|
this.footer {
|
||||||
"Automated Message"
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter()
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delay(2000)
|
delay(2000)
|
||||||
var then = ZonedDateTime.now(ZoneId.of("Europe/Berlin")).withHour(4).withMinute(0).withSecond(0)
|
var then = ZonedDateTime.now(ZoneId.of("Europe/Berlin")).withHour(4).withMinute(0).withSecond(0)
|
||||||
repeat(7) {
|
repeat(7) {
|
||||||
val msg = c.createMessage {
|
val eb = MessageUtil.getEmbedWithTable(
|
||||||
this.embeds.add(
|
EmbedColor.INFO,
|
||||||
MessageUtil.getEmbedWithTable(
|
"",
|
||||||
EmbedColor.INFO,
|
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||||
"",
|
mapOf(
|
||||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
"Is available" to listOf(),
|
||||||
mapOf(
|
"May be available" to listOf(),
|
||||||
"Is available" to listOf(),
|
"Is not available" to listOf()
|
||||||
"May be available" to listOf(),
|
|
||||||
"Is not available" to listOf()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
val msg = c.createMessage {
|
||||||
|
this.embed {
|
||||||
|
this.color = eb.color
|
||||||
|
this.title = eb.title
|
||||||
|
this.description = eb.description
|
||||||
|
this.fields = eb.fields
|
||||||
|
this.footer {
|
||||||
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
||||||
|
|
|
@ -41,7 +41,7 @@ object StatusUpdater : ICronjob {
|
||||||
private var statusList = listOf<String>()
|
private var statusList = listOf<String>()
|
||||||
private var index = 0
|
private var index = 0
|
||||||
|
|
||||||
// I h8 this job. I'll recode this someday.
|
// I h8 this cronjob. I'll recode this someday.
|
||||||
override suspend fun jobFunction() {
|
override suspend fun jobFunction() {
|
||||||
if (index >= statusList.size) {
|
if (index >= statusList.size) {
|
||||||
index = 0
|
index = 0
|
||||||
|
|
Loading…
Reference in a new issue