feat: added Logger output

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-10-15 22:24:35 +02:00
parent 54144ac3f9
commit cc397f4b07
3 changed files with 6 additions and 3 deletions

View file

@ -89,7 +89,6 @@ object Bot {
FeedUpdater.update(true) FeedUpdater.update(true)
} }
//Start the bot //Start the bot
bot.start() bot.start()
} }

View file

@ -80,8 +80,10 @@ object FeedUpdater : ICronjob {
data.id data.id
) )
) || TimeUtil.getUnixTimeFromStamp(rssData.pubDate!!) < data.subscriptionTimestamp ) || TimeUtil.getUnixTimeFromStamp(rssData.pubDate!!) < data.subscriptionTimestamp
) ) {
Logger.out("Skipping ${rssData.guid} because it already exists or is too old")
continue continue
}
val channel = Bot.bot.kordRef.getChannel(Snowflake(data.channelId))!!.asChannelOf<MessageChannel>() val channel = Bot.bot.kordRef.getChannel(Snowflake(data.channelId))!!.asChannelOf<MessageChannel>()
channel.createMessage { channel.createMessage {
this.embeds.add( this.embeds.add(

View file

@ -25,6 +25,8 @@ import java.time.format.DateTimeFormatter
object TimeUtil { object TimeUtil {
fun getUnixTimeFromStamp(input: String): Long { // Pattern: Sun, 15 Oct 2023 11:04:57 GMT fun getUnixTimeFromStamp(input: String): Long { // Pattern: Sun, 15 Oct 2023 11:04:57 GMT
val formatter = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z") val formatter = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z")
return ZonedDateTime.parse(input, formatter).toEpochSecond() * 1000 val result = ZonedDateTime.parse(input, formatter).toEpochSecond() * 1000
Logger.out("Converted $input to $result")
return result
} }
} }