feat: added improved warning, when user failed last time
This commit is contained in:
parent
8defc45b12
commit
aab31d8d41
1 changed files with 18 additions and 2 deletions
|
@ -21,12 +21,12 @@ package net.moonleay.bedge.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.types.respond
|
||||||
import dev.kord.common.entity.MessageFlags
|
|
||||||
import net.moonleay.bedge.data.database.repository.UserRepository
|
import net.moonleay.bedge.data.database.repository.UserRepository
|
||||||
import net.moonleay.bedge.jobs.component.JobManager
|
import net.moonleay.bedge.jobs.component.JobManager
|
||||||
import net.moonleay.bedge.util.EmbedColor
|
import net.moonleay.bedge.util.EmbedColor
|
||||||
import net.moonleay.bedge.util.Logger
|
import net.moonleay.bedge.util.Logger
|
||||||
import net.moonleay.bedge.util.MessageUtil
|
import net.moonleay.bedge.util.MessageUtil
|
||||||
|
import net.moonleay.bedge.util.TimeUtil
|
||||||
|
|
||||||
|
|
||||||
class AwakeExtension : Extension() {
|
class AwakeExtension : Extension() {
|
||||||
|
@ -42,6 +42,22 @@ class AwakeExtension : Extension() {
|
||||||
val ud = UserRepository.getUserByID(u.id.value)
|
val ud = UserRepository.getUserByID(u.id.value)
|
||||||
if (ud.isAwake) {
|
if (ud.isAwake) {
|
||||||
// User is already awake
|
// User is already awake
|
||||||
|
|
||||||
|
if (ud.currentStreak == 0) {
|
||||||
|
// User failed last time
|
||||||
|
this.respond {
|
||||||
|
this.embeds.add(
|
||||||
|
MessageUtil.getEmbed(
|
||||||
|
EmbedColor.ERROR,
|
||||||
|
"You failed last time!!",
|
||||||
|
"You failed to wake up at ${TimeUtil.getHourAndMinuteFromStamp(ud.nextWakeup)}!\n" +
|
||||||
|
"You can try again tomorrow with `/time`.",
|
||||||
|
u.username
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return@action
|
||||||
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embeds.add(
|
||||||
MessageUtil.getEmbed(
|
MessageUtil.getEmbed(
|
||||||
|
@ -94,7 +110,7 @@ class AwakeExtension : Extension() {
|
||||||
"Good morning, ${u.username}!",
|
"Good morning, ${u.username}!",
|
||||||
ud.customWakeupMessage.replace("#user", u.mention) + "\n" +
|
ud.customWakeupMessage.replace("#user", u.mention) + "\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"${if (streakCoins > 0) "[${ud.currentStreak} day streak]" else ""}\n" +
|
"${if (ud.currentStreak > 0) "[${ud.currentStreak} day streak]" else ""}\n" +
|
||||||
"${ud.coins} coin${if (ud.coins >= 1) "s" else ""} (+${streakCoins+1})\n" +
|
"${ud.coins} coin${if (ud.coins >= 1) "s" else ""} (+${streakCoins+1})\n" +
|
||||||
"lvl ${ud.level} (${ud.xp}/${neededXpForNextLvl} xp) [+${10 + bonusXp} xp]\n",
|
"lvl ${ud.level} (${ud.xp}/${neededXpForNextLvl} xp) [+${10 + bonusXp} xp]\n",
|
||||||
u.username,
|
u.username,
|
||||||
|
|
Loading…
Reference in a new issue