diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 94687dc..6ad0035 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -15,13 +15,14 @@ jobs: java-version: [ 11, 18 ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'zulu' java-version: ${{ matrix.java-version }} - name: Grant execute permission for gradlew @@ -29,23 +30,14 @@ jobs: - name: Cache SonarCloud packages if: matrix.java-version == env.SONAR_JDK - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - name: Cache Gradle packages - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle-${{ matrix.java-version }}- - - name: Test with Gradle + uses: gradle/gradle-build-action@v2 env: CI_NAME: "GitHub CI" ALPHAVANTAGE_API_KEY: ${{ secrets.ALPHAVANTAGE_API_KEY }} @@ -60,17 +52,12 @@ jobs: MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} MASTODON_HANDLE: ${{ secrets.MASTODON_HANDLE }} MASTODON_INSTANCE: ${{ secrets.MASTODON_INSTANCE }} - - run: ./gradlew build check --stacktrace + with: + arguments: build check --stacktrace - name: SonarCloud if: success() && matrix.java-version == env.SONAR_JDK env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./gradlew sonar - - - name: Cleanup Gradle Cache - run: | - rm -f ~/.gradle/caches/modules-2/modules-2.lock - rm -f ~/.gradle/caches/modules-2/gc.properties + run: ./gradlew sonar --info diff --git a/build.gradle b/build.gradle index 70e3d46..8b7827f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'application' - id 'com.github.ben-manes.versions' version '0.44.0' + id 'com.github.ben-manes.versions' version '0.45.0' id 'idea' id 'io.gitlab.arturbosch.detekt' version '1.22.0' id 'java' diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Addons.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Addons.kt index 020edf4..1127f02 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Addons.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Addons.kt @@ -74,7 +74,10 @@ class Addons(private val props: Properties) { if (logger.isDebugEnabled) { logger.debug("Module $name is disabled.") } + names.disabledModules.add(name) } + } else { + names.disabledModules.add(name) } } return enabled @@ -106,7 +109,10 @@ class Addons(private val props: Properties) { if (logger.isDebugEnabled) { logger.debug("Command $name is disabled.") } + names.disabledCommands.add(name) } + } else { + names.disabledCommands.add(name) } } return enabled @@ -168,12 +174,16 @@ class Addons(private val props: Properties) { */ object Names { val modules: MutableList = mutableListOf() + val disabledModules: MutableList = mutableListOf() val commands: MutableList = mutableListOf() + val disabledCommands: MutableList = mutableListOf() val ops: MutableList = mutableListOf() fun sort() { modules.sort() + disabledModules.sort() commands.sort() + disabledCommands.sort() ops.sort() } } diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt index f811764..2dff959 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt @@ -148,6 +148,10 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro event.sendMessage("The commands are:") event.sendList(addons.names.commands, 8, isBold = true, isIndent = true) if (event.isChannelOp(channel)) { + if (addons.names.disabledCommands.isNotEmpty()) { + event.sendMessage("The disabled commands are:") + event.sendList(addons.names.disabledCommands, 8, isBold = false, isIndent = true) + } event.sendMessage("The op commands are:") event.sendList(addons.names.ops, 8, isBold = true, isIndent = true) } @@ -412,7 +416,7 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro addons.add(Ignore()) addons.add(LinksManager()) addons.add(Me()) - addons.add(Modules(addons.names.modules)) + addons.add(Modules(addons.names.modules, addons.names.disabledModules)) addons.add(Msg()) addons.add(Nick()) addons.add(Posting()) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Modules.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Modules.kt index f64178d..b2293b0 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Modules.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Modules.kt @@ -36,9 +36,9 @@ import net.thauvin.erik.mobibot.Utils.isChannelOp import net.thauvin.erik.mobibot.Utils.sendList import org.pircbotx.hooks.types.GenericMessageEvent -class Modules(private val modules: List) : AbstractCommand() { +class Modules(private val modules: List, private val disabledModules: List) : AbstractCommand() { override val name = "modules" - override val help = listOf("To view a list of enabled modules:", helpFormat("%c $name")) + override val help = listOf("To view a list of enabled/disabled modules:", helpFormat("%c $name")) override val isOpOnly = true override val isPublic = false override val isVisible = true @@ -51,6 +51,10 @@ class Modules(private val modules: List) : AbstractCommand() { event.respondPrivateMessage("The enabled modules are: ") event.sendList(modules, 7, isIndent = true) } + if (disabledModules.isNotEmpty()) { + event.respondPrivateMessage("The disabled modules are: ") + event.sendList(disabledModules, 7, isIndent = true) + } } else { helpResponse(channel, args, event) } diff --git a/version.properties b/version.properties index fb36533..693db4f 100644 --- a/version.properties +++ b/version.properties @@ -1,9 +1,9 @@ #Generated by the Semver Plugin for Gradle -#Sat Jan 28 23:17:39 PST 2023 -version.buildmeta=983 +#Mon Jan 30 22:08:48 PST 2023 +version.buildmeta=986 version.major=0 version.minor=8 version.patch=0 version.prerelease=rc version.project=mobibot -version.semver=0.8.0-rc+983 +version.semver=0.8.0-rc+986