Merge branch 'master' into 'stable'

feat: started working on DB connection

See merge request moonleay/botendo!3
This commit is contained in:
moonleay 2023-05-11 15:38:35 +00:00
commit a2e74dfb96
31 changed files with 446 additions and 420 deletions

View file

@ -12,18 +12,28 @@ A Discord music bot, written in Kotlin using the kord library.
## Contributors ## Contributors
<div class="aside"> <div class="aside">
<img src="https://img.shields.io/badge/limited__dev-Owner%20%26%20Developer-blue" alt="limited_dev: Owner & Developer"/> <img src="https://img.shields.io/badge/moonleay-Head%20Developer-red" alt="moonleay: Head Developer"/>
</div> </div>
## Special Thanks to ## Special Thanks to
- HopeBaron for helping me a whole lot - HopeBaron for helping me a lot
## Commands ## Known issues
- None (currently). Report issues to issues@moonleay.net or moonleay#7441
## Commands & Features
- Commands
- info -- Show basic infos about the bot - info -- Show basic infos about the bot
- play -- Play a song - play -- Play a song
- stop -- Stop playing a song and leave the vc - stop -- Stop playing a song and leave the vc
- skip -- Skip to the next song
- queue -- Show what songs are next up
- nowplaying -- Show what is currently playing
- Features
- Button Controller -- You can control the currently playing music using buttons.
## How to self-host (using the Docker container) ## How to self-host (using the Docker container)

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,21 +22,21 @@ import org.jetbrains.gradle.ext.TaskTriggersConfig
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("jvm") version "1.8.0" kotlin("jvm") version "1.8.21"
id("com.github.johnrengelman.shadow") version "7.1.2" id("com.github.johnrengelman.shadow") version "7.1.2"
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.6" id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.6"
`maven-publish` `maven-publish`
} }
//Botendo version 5 //Botendo version 6
val ownerID = 372703841151614976L val ownerID = 372703841151614976L
group = "de.limited_dev.botendo" group = "de.limited_dev.botendo"
version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" } version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" }
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" } ?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
?: "6.2.0" ?: "6.3.3"
val kordver = "1.5.6" val kordver = "1.5.6"
val lavaver = "3.8.0" val lavaver = "4.0.0"
val coroutinesver = "1.1.0" val coroutinesver = "1.1.0"
val mavenArtifact = "Botendo" val mavenArtifact = "Botendo"
@ -77,9 +77,14 @@ val implementation by configurations.getting
implementation.extendsFrom(shadow) implementation.extendsFrom(shadow)
dependencies { dependencies {
//Discord
shadow("com.kotlindiscord.kord.extensions:kord-extensions:$kordver") shadow("com.kotlindiscord.kord.extensions:kord-extensions:$kordver")
shadow("dev.schlaubi.lavakord:kord:$lavaver") shadow("dev.schlaubi.lavakord:kord:$lavaver")
//Util
shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesver") shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesver")
//Logging
shadow("org.slf4j:slf4j-api:2.0.3") shadow("org.slf4j:slf4j-api:2.0.3")
shadow("org.slf4j:slf4j-simple:2.0.3") shadow("org.slf4j:slf4j-simple:2.0.3")
} }

View file

@ -1,6 +1,6 @@
# #
# Botendo # Botendo
# Copyright (C) 2023 limited_dev # Copyright (C) 2023 moonleay
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
# #
# Botendo # Botendo
# Copyright (C) 2023 limited_dev # Copyright (C) 2023 moonleay
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

2
gradlew vendored
View file

@ -2,7 +2,7 @@
# #
# Botendo # Botendo
# Copyright (C) 2023 limited_dev # Copyright (C) 2023 moonleay
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,10 +21,10 @@ package de.limited_dev.botendo
import com.kotlindiscord.kord.extensions.ExtensibleBot import com.kotlindiscord.kord.extensions.ExtensibleBot
import de.limited_dev.botendo.buttons.ButtonManager import de.limited_dev.botendo.buttons.ButtonManager
import de.limited_dev.botendo.data.CredentialManager
import de.limited_dev.botendo.extensions.music.* import de.limited_dev.botendo.extensions.music.*
import de.limited_dev.botendo.extensions.util.InfoExtension import de.limited_dev.botendo.extensions.util.InfoExtension
import de.limited_dev.botendo.extensions.util.PotatoExtension import de.limited_dev.botendo.extensions.util.PotatoExtension
import de.limited_dev.botendo.util.CredentialManager
import de.limited_dev.botendo.util.Logger import de.limited_dev.botendo.util.Logger
import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.MessageUtil
import dev.kord.common.Color import dev.kord.common.Color
@ -84,14 +84,12 @@ object Bot {
val response = inter.deferPublicResponse() val response = inter.deferPublicResponse()
val u = inter.user val u = inter.user
val g = this.interaction.getOriginalInteractionResponse().getGuild() val g = this.interaction.getOriginalInteractionResponse().getGuild()
var flag = false
for (b in ButtonManager.buttons) { for (b in ButtonManager.buttons) {
if (b.id != inter.componentId || flag) if (b.id != inter.componentId)
continue continue
b.onInteraction(response, g, u) b.onInteraction(response, g, u)
flag = true return@on
} }
if (!flag) {
response.respond { response.respond {
this.embeds = mutableListOf( this.embeds = mutableListOf(
MessageUtil.getEmbed( MessageUtil.getEmbed(
@ -103,7 +101,6 @@ object Bot {
) )
} }
} }
}
//Start the bot //Start the bot
bot.start() bot.start()

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
* *
*/ */
package de.limited_dev.botendo.util package de.limited_dev.botendo.data
import java.io.* import java.io.*
import java.util.* import java.util.*

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -69,9 +69,9 @@ class NowPlayingExtension : Extension() {
MessageUtil.getEmbedWithImage( MessageUtil.getEmbedWithImage(
Color(0x52E01A), Color(0x52E01A),
"Currently playing", "Currently playing",
"**${track.title}**\n*Now Playing*\nby ${track.author} :${ "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
TimeUtil.getTimeFormatedRaw( TimeUtil.getTimeFormatedRaw(
track.position.inWholeMilliseconds player.position
) )
}: ${ }: ${
TimeUtil.getTimeFormatedRaw( TimeUtil.getTimeFormatedRaw(
@ -79,13 +79,18 @@ class NowPlayingExtension : Extension() {
) )
}\n" + }\n" +
">>>${track.uri}", ">>>${track.uri}",
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg", user.asUser().username + "#" + user.asUser().discriminator,
user.asUser().username + "#" + user.asUser().discriminator "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri.toString()) + "/maxresdefault.jpg"
) )
) )
this.actionRow { this.actionRow {
ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating) this.components.addAll(
ButtonUtil.getMusicControllerButtons(
player.paused,
gts.repeating
).components
)
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -94,7 +94,6 @@ class PlayExtension : Extension() {
) )
} }
MusicManager.addToQueue(this, link, search) MusicManager.addToQueue(this, link, search)
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -80,7 +80,12 @@ class QueueExtension : Extension() {
) )
this.actionRow { this.actionRow {
ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating) this.components.addAll(
ButtonUtil.getMusicControllerButtons(
player.paused,
gts.repeating
).components
)
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -108,7 +108,12 @@ class SkipExtension : Extension() {
) )
this.actionRow { this.actionRow {
ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating) this.components.addAll(
ButtonUtil.getMusicControllerButtons(
player.paused,
gts.repeating
).components
)
} }
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -20,23 +20,20 @@
package de.limited_dev.botendo.extensions.music.components package de.limited_dev.botendo.extensions.music.components
import de.limited_dev.botendo.util.Logger import de.limited_dev.botendo.util.Logger
import dev.schlaubi.lavakord.audio.TrackEndEvent import dev.schlaubi.lavakord.audio.*
import dev.schlaubi.lavakord.audio.TrackExceptionEvent
import dev.schlaubi.lavakord.audio.TrackStuckEvent
import dev.schlaubi.lavakord.audio.on
import dev.schlaubi.lavakord.audio.player.Player import dev.schlaubi.lavakord.audio.player.Player
import dev.schlaubi.lavakord.rest.TrackResponse import dev.schlaubi.lavakord.rest.models.PartialTrack
import java.util.concurrent.BlockingQueue import java.util.concurrent.BlockingQueue
import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.LinkedBlockingQueue
class GuildTrackScheduler(val pl: Player) { class GuildTrackScheduler(val pl: Player) {
private var queue: BlockingQueue<TrackResponse.PartialTrack> = LinkedBlockingQueue() private var queue: BlockingQueue<PartialTrack> = LinkedBlockingQueue()
var repeating = false var repeating = false
private var hasRegisteredEvents = false private var hasRegisteredEvents = false
///Add a track to queue and start playing, if there is no song currently playing ///Add a track to queue and start playing, if there is no song currently playing
suspend fun queue(track: TrackResponse.PartialTrack) { suspend fun queue(track: PartialTrack) {
if (this.pl.playingTrack == null) { if (this.pl.playingTrack == null) {
play(track) play(track)
} else { } else {
@ -51,7 +48,7 @@ class GuildTrackScheduler(val pl: Player) {
this.pl.stopTrack() this.pl.stopTrack()
} }
private suspend fun play(tr: TrackResponse.PartialTrack) { private suspend fun play(tr: PartialTrack) {
this.pl.playTrack(tr) this.pl.playTrack(tr)
} }
@ -62,15 +59,15 @@ class GuildTrackScheduler(val pl: Player) {
Logger.out("Adding track events to GuildTrackScheduler...") Logger.out("Adding track events to GuildTrackScheduler...")
pl.on<TrackEndEvent> { pl.on<Event, TrackEndEvent> {
onTrackEnd(this) onTrackEnd(this)
} }
pl.on<TrackStuckEvent> { pl.on<Event, TrackStuckEvent> {
onTrackStuck(this) onTrackStuck(this)
} }
pl.on<TrackExceptionEvent> { pl.on<Event, TrackExceptionEvent> {
onTrackExc(this) onTrackExc(this)
} }
} }
@ -78,7 +75,8 @@ class GuildTrackScheduler(val pl: Player) {
private suspend fun onTrackEnd(e: TrackEndEvent) { private suspend fun onTrackEnd(e: TrackEndEvent) {
if (e.reason.mayStartNext) { if (e.reason.mayStartNext) {
if (repeating) { if (repeating) {
this.pl.playTrack(e.track.copy()) Logger.out("Repeating track...")
this.pl.playTrack(e.getTrack().copy())
return return
} }
Logger.out("Track has ended; Playing next...") Logger.out("Track has ended; Playing next...")
@ -88,12 +86,12 @@ class GuildTrackScheduler(val pl: Player) {
private suspend fun onTrackStuck(e: TrackStuckEvent) { private suspend fun onTrackStuck(e: TrackStuckEvent) {
Logger.out("Track is stuck, retrying...") Logger.out("Track is stuck, retrying...")
this.pl.playTrack(e.track.copy()) this.pl.playTrack(e.getTrack().copy())
} }
private suspend fun onTrackExc(e: TrackExceptionEvent) { private suspend fun onTrackExc(e: TrackExceptionEvent) {
Logger.out("Track had an exception, retrying...") Logger.out("Track had an exception, retrying...")
this.pl.playTrack(e.track.copy()) this.pl.playTrack(e.getTrack().copy())
} }
fun clear() { fun clear() {
@ -102,11 +100,11 @@ class GuildTrackScheduler(val pl: Player) {
queue.clear() queue.clear()
} }
fun getQueue(): List<TrackResponse.PartialTrack> { fun getQueue(): List<PartialTrack> {
return queue.toList() return queue.toList()
} }
fun getHead(): TrackResponse.PartialTrack { fun getHead(): PartialTrack {
return queue.first() return queue.first()
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -33,8 +33,8 @@ import dev.kord.core.entity.Guild
import dev.kord.rest.builder.message.create.actionRow import dev.kord.rest.builder.message.create.actionRow
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.audio.player.Player import dev.schlaubi.lavakord.audio.player.Player
import dev.schlaubi.lavakord.rest.TrackResponse
import dev.schlaubi.lavakord.rest.loadItem import dev.schlaubi.lavakord.rest.loadItem
import dev.schlaubi.lavakord.rest.models.TrackResponse
object MusicManager { object MusicManager {
private var musicManagerMap: MutableMap<Snowflake, GuildTrackScheduler> = mutableMapOf() private var musicManagerMap: MutableMap<Snowflake, GuildTrackScheduler> = mutableMapOf()
@ -76,7 +76,7 @@ object MusicManager {
MessageUtil.getEmbedWithImage( MessageUtil.getEmbedWithImage(
Color(0x52E01A), Color(0x52E01A),
"Queuing track from link", "Queuing track from link",
"**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} :: ${ "**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} ;: ${
TimeUtil.getTimeFormatedRaw( TimeUtil.getTimeFormatedRaw(
item.track.info.length item.track.info.length
) )
@ -108,7 +108,7 @@ object MusicManager {
MessageUtil.getEmbedWithImage( MessageUtil.getEmbedWithImage(
Color(0x52E01A), Color(0x52E01A),
"Queuing playlist from link", "Queuing playlist from link",
"**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} :: ${ "**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} ;: ${
TimeUtil.getTimeFormatedRaw( TimeUtil.getTimeFormatedRaw(
item.tracks.first().info.length item.tracks.first().info.length
) )
@ -137,7 +137,7 @@ object MusicManager {
MessageUtil.getEmbedWithImage( MessageUtil.getEmbedWithImage(
Color(0x52E01A), Color(0x52E01A),
"Queuing track from query", "Queuing track from query",
"**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} :: ${ "**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} ;: ${
TimeUtil.getTimeFormatedRaw( TimeUtil.getTimeFormatedRaw(
item.tracks.first().info.length item.tracks.first().info.length
) )

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,7 +37,9 @@ class InfoExtension : Extension() {
"Botendo ***v." + BuildConstants.version + "***\n" + "Botendo ***v." + BuildConstants.version + "***\n" +
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" + "Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
"lavalink.kt ***v." + BuildConstants.lavaVersion + "***\n" + "lavalink.kt ***v." + BuildConstants.lavaVersion + "***\n" +
"Coroutines ***v." + BuildConstants.coroutinesVersion + "***" "Coroutines ***v." + BuildConstants.coroutinesVersion + "***\n\n\n" +
"***Bot made by moonleay#7441***\n" +
"(c) 2023, licensed under GPL-3.0"
) )
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,12 +31,12 @@ object Logger {
try { try {
println( println(
("[" + Class.forName(caller.className).simpleName + "." + ("[" + Class.forName(caller.className).simpleName + "." +
caller.methodName + ":" + caller.lineNumber + "] [" + dtf.format(now)).toString() + "] <" + msg + ">" caller.methodName + ":" + caller.lineNumber + "] [" + dtf.format(now)) + "] <" + msg + ">"
) )
} catch (e: ClassNotFoundException) { } catch (e: ClassNotFoundException) {
e.printStackTrace() e.printStackTrace()
} }
// Ich kann nicht mehr // Ich kann nicht mehr
// [Klasse.Funktion] [T/M HH:MM] <NACHRICHT> // [Class.function] [T/M HH:MM] <MESSAGE>
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit
object TimeUtil { object TimeUtil {
///Convert Miliseconds to xdays xhours xmins xsecs ///Convert Miliseconds to xdays xhours xmins xsecs
fun getTimeFormatedShortend(time: Long): String { fun getTimeFormatedShortend(timeIn: Long): String {
var time = time var time = timeIn
val days = TimeUnit.MILLISECONDS val days = TimeUnit.MILLISECONDS
.toDays(time) .toDays(time)
time -= TimeUnit.DAYS.toMillis(days) time -= TimeUnit.DAYS.toMillis(days)
@ -55,8 +55,8 @@ object TimeUtil {
return s return s
} }
fun getTimeFormatedRaw(time: Long): String { fun getTimeFormatedRaw(timeIn: Long): String {
var time = time var time = timeIn
val days = TimeUnit.MILLISECONDS val days = TimeUnit.MILLISECONDS
.toDays(time) .toDays(time)
time -= TimeUnit.DAYS.toMillis(days) time -= TimeUnit.DAYS.toMillis(days)

View file

@ -1,6 +1,6 @@
/* /*
* Botendo * Botendo
* Copyright (C) 2023 limited_dev * Copyright (C) 2023 moonleay
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
# #
# Botendo # Botendo
# Copyright (C) 2023 limited_dev # Copyright (C) 2023 moonleay
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by