feat: added get Users in the first X fields
fix: fixed typo in May be available button chore: renamed ButtonUtil to EmbedUtil Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
parent
8bca3838bc
commit
4bc2fe6930
1 changed files with 17 additions and 2 deletions
|
@ -23,14 +23,14 @@ import dev.kord.core.entity.Embed
|
|||
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||
import dev.kord.rest.builder.message.EmbedBuilder
|
||||
|
||||
object ButtonUtil {
|
||||
object EmbedUtil {
|
||||
fun getTimePlannerButtons(): ActionRowBuilder {
|
||||
val ar = ActionRowBuilder()
|
||||
ar.interactionButton(ButtonStyle.Success, "public.edit.btn.timemanagement.available") {
|
||||
this.label = "Available"
|
||||
}
|
||||
ar.interactionButton(ButtonStyle.Primary, "public.edit.btn.timemanagement.maybeavailable") {
|
||||
this.label = "Maybe available"
|
||||
this.label = "May be available"
|
||||
}
|
||||
ar.interactionButton(ButtonStyle.Danger, "public.edit.btn.timemanagement.notavailable") {
|
||||
this.label = "Not available"
|
||||
|
@ -60,6 +60,21 @@ object ButtonUtil {
|
|||
return ebb
|
||||
}
|
||||
|
||||
fun getAllUsersInTheFirstXTables(amountOfTables: Int, e: Embed): List<String> {
|
||||
val users = mutableListOf<String>()
|
||||
for (i in 0 until amountOfTables - 1) {
|
||||
val f = e.fields[i]
|
||||
if (!f.value.contains("@"))
|
||||
continue // check next one. this one does not have any entries
|
||||
val v = f.value.split("\n").toMutableList()
|
||||
for (l in v) {
|
||||
Logger.out(l)
|
||||
users.add(l.subSequence(2, l.indexOf(">")).toString())
|
||||
}
|
||||
}
|
||||
return users
|
||||
}
|
||||
|
||||
fun addXToValuesAtTable(x: String, e: Embed, table: Int): EmbedBuilder {
|
||||
val ebb = MessageUtil.getAClonedEmbedd(e)
|
||||
for ((i, f) in e.fields.withIndex()) {
|
Loading…
Reference in a new issue