chore: changed Ext to Extension, added Potatoes

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-04-23 23:53:11 +02:00
parent c8d7003ef5
commit 7753f11e60
9 changed files with 68 additions and 17 deletions

View file

@ -21,16 +21,19 @@ package de.limited_dev.botendo
import com.kotlindiscord.kord.extensions.ExtensibleBot import com.kotlindiscord.kord.extensions.ExtensibleBot
import de.limited_dev.botendo.extensions.music.* import de.limited_dev.botendo.extensions.music.*
import de.limited_dev.botendo.extensions.util.InfoExt import de.limited_dev.botendo.extensions.util.InfoExtension
import de.limited_dev.botendo.extensions.util.PotatoExtension
import de.limited_dev.botendo.util.CredentialManager import de.limited_dev.botendo.util.CredentialManager
import de.limited_dev.botendo.util.Logger import de.limited_dev.botendo.util.Logger
import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
import dev.kord.core.on
import dev.schlaubi.lavakord.LavaKord import dev.schlaubi.lavakord.LavaKord
import dev.schlaubi.lavakord.kord.lavakord import dev.schlaubi.lavakord.kord.lavakord
object Bot { object Bot {
//The kord object gets set at app launch //The kord object gets set at app launch
lateinit var lava: LavaKord
private lateinit var bot: ExtensibleBot private lateinit var bot: ExtensibleBot
lateinit var lava: LavaKord
suspend fun start() { suspend fun start() {
Logger.out("Starting Bot...") Logger.out("Starting Bot...")
@ -51,12 +54,13 @@ object Bot {
} }
extensions { extensions {
add(::InfoExt) add(::InfoExtension)
add(::PlayExt) add(::PlayExtension)
add(::StopExt) add(::StopExtension)
add(::SkipExt) add(::SkipExtension)
add(::NowPlayingExt) add(::NowPlayingExtension)
add(::QueueExt) add(::QueueExtension)
add(::PotatoExtension)
} }
} }
@ -66,6 +70,11 @@ object Bot {
//Add the LavaLink node from config //Add the LavaLink node from config
lava.addNode(CredentialManager.linkip, CredentialManager.linkpw) lava.addNode(CredentialManager.linkip, CredentialManager.linkpw)
//Register Button presses
bot.kordRef.on<ButtonInteractionCreateEvent> {
}
//Start the bot //Start the bot
bot.start() bot.start()
} }

View file

@ -28,7 +28,7 @@ import de.limited_dev.botendo.util.UrlUtil
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.kord.getLink import dev.schlaubi.lavakord.kord.getLink
class NowPlayingExt : Extension() { class NowPlayingExtension : Extension() {
override val name = "nowplaying" override val name = "nowplaying"
override suspend fun setup() { override suspend fun setup() {
publicSlashCommand { publicSlashCommand {

View file

@ -30,7 +30,8 @@ import de.limited_dev.botendo.util.MessageUtil
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.kord.getLink import dev.schlaubi.lavakord.kord.getLink
class PlayExt : Extension() {
class PlayExtension : Extension() {
override val name = "play" override val name = "play"

View file

@ -27,7 +27,7 @@ import de.limited_dev.botendo.util.MessageUtil
import de.limited_dev.botendo.util.TimeUtil import de.limited_dev.botendo.util.TimeUtil
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
class QueueExt : Extension() { class QueueExtension : Extension() {
override val name = "queue" override val name = "queue"
override suspend fun setup() { override suspend fun setup() {
publicSlashCommand { publicSlashCommand {

View file

@ -28,7 +28,7 @@ import de.limited_dev.botendo.util.TimeUtil
import de.limited_dev.botendo.util.UrlUtil import de.limited_dev.botendo.util.UrlUtil
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
class SkipExt : Extension() { class SkipExtension : Extension() {
override val name = "skip" override val name = "skip"
override suspend fun setup() { override suspend fun setup() {
publicSlashCommand { publicSlashCommand {

View file

@ -28,7 +28,7 @@ import de.limited_dev.botendo.util.MessageUtil
import dev.schlaubi.lavakord.audio.Link import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.kord.getLink import dev.schlaubi.lavakord.kord.getLink
class StopExt : Extension() { class StopExtension : Extension() {
override val name = "stop" override val name = "stop"
override suspend fun setup() { override suspend fun setup() {
publicSlashCommand { publicSlashCommand {

View file

@ -22,7 +22,7 @@ package de.limited_dev.botendo.extensions.music.components
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
import com.kotlindiscord.kord.extensions.components.forms.ModalForm import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.types.respond import com.kotlindiscord.kord.extensions.types.respond
import de.limited_dev.botendo.extensions.music.PlayExt import de.limited_dev.botendo.extensions.music.PlayExtension
import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.MessageUtil
import de.limited_dev.botendo.util.TimeUtil import de.limited_dev.botendo.util.TimeUtil
import de.limited_dev.botendo.util.UrlUtil import de.limited_dev.botendo.util.UrlUtil
@ -44,7 +44,7 @@ object MusicManager {
suspend fun addToQueue( suspend fun addToQueue(
ctx: PublicSlashCommandContext<PlayExt.PlayArgs, ModalForm>, ctx: PublicSlashCommandContext<PlayExtension.PlayArgs, ModalForm>,
link: Link, link: Link,
search: String search: String
) { ) {
@ -52,7 +52,7 @@ object MusicManager {
} }
suspend fun addToQueue( suspend fun addToQueue(
ctx: PublicSlashCommandContext<PlayExt.PlayArgs, ModalForm>, ctx: PublicSlashCommandContext<PlayExtension.PlayArgs, ModalForm>,
link: Link, link: Link,
search: String, search: String,
silent: Boolean silent: Boolean

View file

@ -24,7 +24,7 @@ import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import de.limited_dev.botendo.build.BuildConstants import de.limited_dev.botendo.build.BuildConstants
import de.limited_dev.botendo.util.MessageUtil import de.limited_dev.botendo.util.MessageUtil
class InfoExt : Extension() { class InfoExtension : Extension() {
override val name = "info" override val name = "info"
override suspend fun setup() { override suspend fun setup() {
publicSlashCommand { publicSlashCommand {

View file

@ -0,0 +1,41 @@
/*
* Botendo
* Copyright (C) 2023 limited_dev
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
package de.limited_dev.botendo.extensions.util
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import de.limited_dev.botendo.util.MessageUtil
class PotatoExtension : Extension() {
override val name = "potato"
override suspend fun setup() {
publicSlashCommand {
name = "potato"
description = "Potato"
this.action {
MessageUtil.sendEmbedForPublicSlashCommandWithImage(
this, "Potato",
"Potato",
"https://static.tumblr.com/c06d8e0928395746a63b9c5d3cb1ce66/sl9iajp/gxFmqk38z/tumblr_static_potato-equality.jpg"
)
}
}
}
}