Skip to content

Commit

Permalink
Merge pull request #39 from daksh7011/develop
Browse files Browse the repository at this point in the history
Develop -> Master
  • Loading branch information
daksh7011 authored Dec 22, 2024
2 parents 062dbba + 6282da0 commit 23d3935
Show file tree
Hide file tree
Showing 33 changed files with 185 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2024.2.2
uses: JetBrains/qodana-action@v2024.3.3
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
Expand Down
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[versions]
detekt = "1.23.7" # Note: Plugin versions must be updated in the settings.gradle.kts too
kotlin = "2.0.20" # Note: Plugin versions must be updated in the settings.gradle.kts too
kotlin = "2.1.0" # Note: Plugin versions must be updated in the settings.gradle.kts too

groovy = "3.0.22"
groovy = "3.0.23"
jansi = "2.4.1"
kx-ser = "1.7.2"
logback = "1.5.8"
kx-ser = "1.7.3"
logback = "1.5.15"
logback-groovy = "1.14.5"
logging = "7.0.0"
logging = "7.0.3"
kord-emoji = "0.5.0"
unleash = "9.2.4"
unleash = "9.2.6"
kmongo-coroutine = "5.1.0"
links-detektor = "1.0.1"

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 13 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
pluginManagement {
plugins {
// Update this in libs.version.toml when you change it here.
kotlin("jvm") version "2.0.20"
kotlin("plugin.serialization") version "2.0.20"
kotlin("jvm") version "2.1.0"
kotlin("plugin.serialization") version "2.1.0"

// Update this in libs.version.toml when you change it here.
id("io.gitlab.arturbosch.detekt") version "1.23.7"

id("com.github.jakemarsden.git-hooks") version "0.0.2"
id("com.github.johnrengelman.shadow") version "8.1.1"

id("dev.kordex.gradle.docker") version "1.4.2"
id("dev.kordex.gradle.kordex") version "1.4.2"
id("dev.kordex.gradle.docker") version "1.6.0"
id("dev.kordex.gradle.kordex") version "1.6.0"
}

repositories {
gradlePluginPortal()
mavenCentral()

maven("https://snapshots-repo.kordex.dev")
maven("https://releases-repo.kordex.dev")
maven("https://oss.sonatype.org/content/repositories/snapshots")
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/troy/commands/config/InviteLink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import org.koin.core.component.inject
import troy.data.repository.GlobalGuildRepository
import troy.utils.bold
Expand All @@ -18,16 +19,16 @@ class InviteLink : Extension() {

inner class InviteLinkArgument : Arguments() {
val inviteLink by string {
name = "url"
description = "Provide Permanent invite link for this server."
name = "url".toKey()
description = "Provide Permanent invite link for this server.".toKey()
}
}

override suspend fun setup() {
val globalGuildRepository: GlobalGuildRepository by inject()
publicSlashCommand(::InviteLinkArgument) {
name = "invite-link"
description = "Setup invite link for this server"
name = "invite-link".toKey()
description = "Setup invite link for this server".toKey()
check { hasPermission(Permission.Administrator) }
action {
val guildId = guild?.id?.toString().orEmpty()
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/troy/commands/funstuff/Burn.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.user
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import org.koin.core.component.inject
import troy.utils.DataProvider
import troy.utils.isGirlfriend
Expand All @@ -19,15 +20,15 @@ class Burn : Extension() {

class BurnArguments : Arguments() {
val user by user {
name = "user"
description = "Which user do you want to light on fire?"
name = "user".toKey()
description = "Which user do you want to light on fire?".toKey()
}
}

override suspend fun setup() {
publicSlashCommand(Burn::BurnArguments) {
name = "burn"
description = "Lights fire to mentioned user."
name = "burn".toKey()
description = "Lights fire to mentioned user.".toKey()
action {
val burnList = DataProvider.getBurnData()
val randomBurn = burnList[kotlin.math.floor(Math.random() * burnList.size).toInt()]
Expand Down
23 changes: 9 additions & 14 deletions src/main/kotlin/troy/commands/funstuff/Dictionary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import dev.kordex.core.utils.env
import io.ktor.client.call.body
import io.ktor.client.request.get
import io.ktor.client.request.headers
import io.ktor.http.HttpHeaders
import io.ktor.http.HttpStatusCode
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.http.*
import kotlinx.datetime.Clock
import org.koin.core.component.inject
import troy.apiModels.OwlDictModel
import troy.utils.Environment
import troy.utils.commonLogger
import troy.utils.getEmbedFooter
import troy.utils.httpClient
import troy.utils.requestAndCatch
import troy.utils.*

class Dictionary : Extension() {

Expand All @@ -30,15 +25,15 @@ class Dictionary : Extension() {

class DictionaryArguments : Arguments() {
val word by string {
name = "word"
description = "Which word do you wanna search?"
name = "word".toKey()
description = "Which word do you wanna search?".toKey()
}
}

override suspend fun setup() {
publicSlashCommand(Dictionary::DictionaryArguments) {
name = "dictionary"
description = "Finds definition for given word with image, emoji and examples."
name = "dictionary".toKey()
description = "Finds definition for given word with image, emoji and examples.".toKey()
action {
val url = "https://owlbot.info/api/v4/dictionary/" + arguments.word
httpClient.requestAndCatch({
Expand Down
15 changes: 8 additions & 7 deletions src/main/kotlin/troy/commands/funstuff/Doggo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.defaultingString
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import io.ktor.client.call.body
import io.ktor.client.request.get
import io.ktor.http.HttpStatusCode
import dev.kordex.core.i18n.toKey
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.http.*
import kotlinx.datetime.Clock
import org.koin.core.component.inject
import troy.apiModels.DoggoModel
Expand All @@ -27,16 +28,16 @@ class Doggo : Extension() {

class DoggoArguments : Arguments() {
val breed by defaultingString {
name = "breed"
description = "Which breed of good boi you want to see?"
name = "breed".toKey()
description = "Which breed of good boi you want to see?".toKey()
defaultValue = "random"
}
}

override suspend fun setup() {
publicSlashCommand(Doggo::DoggoArguments) {
name = "doggo"
description = "Finds some cute doggo images."
name = "doggo".toKey()
description = "Finds some cute doggo images.".toKey()
action {
val url = if (arguments.breed == "random") {
"https://dog.ceo/api/breeds/image/random"
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/troy/commands/funstuff/Emoji.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.coalescingString
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import kotlinx.coroutines.flow.count
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.first
Expand All @@ -15,15 +16,15 @@ class Emoji : Extension() {

inner class EmojiArguments : Arguments() {
val emoji by coalescingString {
name = "emoji-name"
description = "Which emoji would you like me to send? PS: Animated emoji are supported."
name = "emoji-name".toKey()
description = "Which emoji would you like me to send? PS: Animated emoji are supported.".toKey()
}
}

override suspend fun setup() {
publicSlashCommand(::EmojiArguments) {
name = "emoji"
description = "Sends server custom emoji, Also supports animated emojis."
name = "emoji".toKey()
description = "Sends server custom emoji, Also supports animated emojis.".toKey()
action {
if (
guild?.emojis?.filter { it.name == arguments.emoji }?.count() != 0
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/troy/commands/funstuff/Fact.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import dev.kord.core.Kord
import dev.kord.rest.builder.message.embed
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import io.ktor.client.call.body
import io.ktor.client.request.get
import dev.kordex.core.i18n.toKey
import io.ktor.client.call.*
import io.ktor.client.request.*
import kotlinx.datetime.Clock
import org.koin.core.component.inject
import troy.apiModels.FactModel
Expand All @@ -23,8 +24,8 @@ class Fact : Extension() {

override suspend fun setup() {
publicSlashCommand {
name = "fact"
description = "Finds some useless facts."
name = "fact".toKey()
description = "Finds some useless facts.".toKey()
action {
val url = "https://uselessfacts.jsph.pl/random.json?language=en"
httpClient.requestAndCatch({
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/troy/commands/funstuff/Flip.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package troy.commands.funstuff

import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import kotlin.math.floor

class Flip : Extension() {
Expand All @@ -11,8 +12,8 @@ class Flip : Extension() {

override suspend fun setup() {
publicSlashCommand {
name = "flip"
description = "Flips a coin for you."
name = "flip".toKey()
description = "Flips a coin for you.".toKey()
action {
respond {
val result = if (floor(Math.random() * 2).toInt() == 0) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/troy/commands/funstuff/ItsOur.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dev.kord.core.Kord
import dev.kord.rest.builder.message.embed
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import kotlinx.datetime.Clock
import org.koin.core.component.inject
import troy.utils.getEmbedFooter
Expand All @@ -19,8 +20,8 @@ class ItsOur : Extension() {

override suspend fun setup() {
publicSlashCommand {
name = "our"
description = "Firmly states that it is ours in this soviet soil."
name = "our".toKey()
description = "Firmly states that it is ours in this soviet soil.".toKey()
action {
respond {
embed {
Expand Down
13 changes: 7 additions & 6 deletions src/main/kotlin/troy/commands/funstuff/Poll.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import dev.kordex.core.commands.Arguments
import dev.kordex.core.commands.converters.impl.string
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import org.koin.core.component.inject
import troy.utils.getEmbedFooter

Expand All @@ -42,19 +43,19 @@ class Poll : Extension() {

inner class PollArguments : Arguments() {
val title by string {
name = "title"
description = "Title for poll"
name = "title".toKey()
description = "Title for poll".toKey()
}
val options by string {
name = "options"
description = "Options for poll separated by comma"
name = "options".toKey()
description = "Options for poll separated by comma".toKey()
}
}

override suspend fun setup() {
publicSlashCommand(::PollArguments) {
name = "poll"
description = "Gives a poll for provided options"
name = "poll".toKey()
description = "Gives a poll for provided options".toKey()
action {
val optionList = arguments.options.split(",")
respond {
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/troy/commands/funstuff/Pun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package troy.commands.funstuff

import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import io.ktor.client.call.body
import io.ktor.client.request.get
import dev.kordex.core.i18n.toKey
import io.ktor.client.call.*
import io.ktor.client.request.*
import troy.apiModels.PunsModel
import troy.utils.commonLogger
import troy.utils.httpClient
Expand All @@ -18,8 +19,8 @@ class Pun : Extension() {

override suspend fun setup() {
publicSlashCommand {
name = "pun"
description = "Sends a pun"
name = "pun".toKey()
description = "Sends a pun".toKey()
action {
val url = "https://icanhazdadjoke.com/"
httpClient.requestAndCatch(
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/troy/commands/funstuff/SarcasticCatNo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dev.kord.core.Kord
import dev.kord.rest.builder.message.embed
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey
import kotlinx.datetime.Clock
import org.koin.core.component.inject
import troy.utils.getEmbedFooter
Expand All @@ -19,8 +20,8 @@ class SarcasticCatNo : Extension() {

override suspend fun setup() {
publicSlashCommand {
name = "sarno"
description = "Summons a sarcastic catto to say no."
name = "sarno".toKey()
description = "Summons a sarcastic catto to say no.".toKey()
action {
respond {
embed {
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/troy/commands/funstuff/Sike.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package troy.commands.funstuff

import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.toKey

class Sike : Extension() {

Expand All @@ -10,8 +11,8 @@ class Sike : Extension() {

override suspend fun setup() {
publicSlashCommand {
name = "sike"
description = "Sends sike whenever someone requests for it."
name = "sike".toKey()
description = "Sends sike whenever someone requests for it.".toKey()
action {
respond { content = "** _S I K E_ **" }
}
Expand Down
Loading

0 comments on commit 23d3935

Please sign in to comment.