...
 
Commits (2)
......@@ -28,7 +28,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("com.jessecorbett:diskord-jvm:$diskordVersion")
implementation("com.jessecorbett:diskord:$diskordVersion")
implementation("org.slf4j:slf4j-simple:$slf4jVersion")
implementation("commons-io:commons-io:$commonsIoVersion")
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
......@@ -52,11 +52,11 @@ val jar by tasks.getting(Jar::class) {
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xuse-experimental=kotlin.Experimental"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xuse-experimental=kotlin.Experimental"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
val createDependenciesFile by creating {
......
......@@ -4,16 +4,15 @@ import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.ClientStore
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.dsl.message as dslmessage
import kotlinx.serialization.UnstableDefault
import org.apache.commons.io.FileUtils
import pw.modder.answernator.utils.*
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.CommandList
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.Utils
import pw.modder.answernator.utils.extensions.bot.getMe
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class About: Command {
override val name: String = "about"
override val userGroup = Command.UserGroup.ADMIN
......
......@@ -6,15 +6,13 @@ import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.authorId
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.CommandList
import java.util.*
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.CommandList
import pw.modder.answernator.utils.extensions.bot.getMe
import pw.modder.answernator.utils.extensions.computePermissions
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class CommandInfo: Command {
private fun getCommandTypeString(command: Command): String {
return when(command.userGroup) {
......
......@@ -7,16 +7,16 @@ import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.ClientStore
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.db.Db
import pw.modder.answernator.db.GuildConfig
import pw.modder.answernator.utils.*
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.LocalizedCommand
import pw.modder.answernator.utils.extensions.toChannelMention
import pw.modder.answernator.utils.extensions.toRoleMention
import com.jessecorbett.diskord.dsl.message as dslmessage
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class Config: LocalizedCommand {
override val name = "config"
......
......@@ -8,15 +8,13 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.cache.GuildCache.getCached
import pw.modder.answernator.db.Db
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import pw.modder.answernator.utils.extensions.isAdmin
import pw.modder.answernator.cache.GuildCache.getCached
import java.util.*
@UnstableDefault
class DefRole: LocalizedCommand {
override val name = "defrole"
override val channels = EnumSet.of(Command.ChannelTypes.GUILD)
......
......@@ -7,15 +7,16 @@ import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.authorId
import com.jessecorbett.diskord.util.words
import pw.modder.answernator.utils.extensions.joinToStrings
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.*
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.CommandList
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.LocalizedCommand
import pw.modder.answernator.utils.extensions.computePermissions
import pw.modder.answernator.utils.extensions.joinToStrings
import pw.modder.answernator.utils.extensions.removeGraves
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class Help: LocalizedCommand {
override val name: String = "help"
override val cmdType = Command.CommandGroup.USER
......
......@@ -4,11 +4,9 @@ import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import java.util.*
@UnstableDefault
class Leave: Command {
override val name = "leave"
override val userGroup = Command.UserGroup.OWNER
......
......@@ -5,17 +5,15 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import org.jetbrains.exposed.sql.Column
import pw.modder.answernator.db.Db
import pw.modder.answernator.db.LogConfigs
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import pw.modder.answernator.utils.extensions.toChannelMention
import com.jessecorbett.diskord.dsl.message as dslmessage
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class Log: LocalizedCommand {
override val name = "log"
override val userGroup = Command.UserGroup.ADMIN
......
......@@ -9,13 +9,12 @@ import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.sendMessage
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import mu.KotlinLogging
import pw.modder.answernator.db.Db.muteMember
import pw.modder.answernator.db.Db.unmuteMember
import pw.modder.answernator.db.Db.memberIsMuted
import pw.modder.answernator.cache.GuildCache.getCached
import pw.modder.answernator.db.Db
import pw.modder.answernator.db.Db.memberIsMuted
import pw.modder.answernator.db.Db.muteMember
import pw.modder.answernator.db.Db.unmuteMember
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.LocalizedCommand
......@@ -25,7 +24,6 @@ import pw.modder.answernator.utils.extensions.isUserMention
import java.util.*
private val logger = KotlinLogging.logger { }
@UnstableDefault
class Mute: LocalizedCommand {
override val name = "mute"
override val userGroup = Command.UserGroup.PERMISSION
......
......@@ -3,13 +3,10 @@ package pw.modder.answernator.commands
import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.ClientStore
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.CommandList
import java.util.*
@UnstableDefault
class Reload: Command {
override val name: String = "reload"
override val userGroup = Command.UserGroup.OWNER
......
......@@ -4,13 +4,11 @@ import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.CommandList
import pw.modder.answernator.utils.extensions.removeGraves
import java.util.*
@UnstableDefault
class Sudo: Command {
override val name = "sudo"
override val cmdType = Command.CommandGroup.DEBUG
......
......@@ -4,13 +4,11 @@ import com.google.common.cache.CacheBuilder
import com.google.common.cache.CacheLoader
import com.jessecorbett.diskord.api.model.Guild
import com.jessecorbett.diskord.api.rest.client.GuildClient
import kotlinx.serialization.UnstableDefault
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.statements.UpdateStatement
import org.jetbrains.exposed.sql.transactions.transaction
import java.util.concurrent.TimeUnit
@UnstableDefault
object Db {
private const val guildConfigCacheSize = 32L
private const val guildLogsConfigCacheSize = 32L
......
package pw.modder.answernator.db
import kotlinx.serialization.UnstableDefault
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.id.EntityID
@UnstableDefault
class GuildConfig(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<GuildConfig>(GuildConfigs)
......
package pw.modder.answernator.db
import kotlinx.serialization.UnstableDefault
import org.jetbrains.exposed.dao.id.IntIdTable
import pw.modder.answernator.utils.Globals
@UnstableDefault
object GuildConfigs: IntIdTable() {
val guildId = varchar("guild_id", 18).index(isUnique = true)
val lang = varchar("lang", 2).default(Globals.config.lang)
......
package pw.modder.answernator
import com.jessecorbett.diskord.dsl.bot
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.cache.GuildCache.enableGuildCache
import pw.modder.answernator.utils.CommandList
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.extensions.bot.*
@UnstableDefault
suspend fun main() {
CommandList.load()
......
package pw.modder.answernator.utils
import com.jessecorbett.diskord.api.model.*
import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.api.model.Permission
import com.jessecorbett.diskord.api.model.Permissions
import com.jessecorbett.diskord.api.rest.client.GuildClient
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.message as dslmessage
import com.jessecorbett.diskord.util.authorId
import kotlinx.serialization.UnstableDefault
import mu.KLogger
import mu.KotlinLogging
import java.util.*
import pw.modder.answernator.utils.extensions.computePermissions
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
private val logger: KLogger = KotlinLogging.logger {}
@UnstableDefault
interface Command {
val name: String
val userGroup: UserGroup get() = UserGroup.ALL
......
package pw.modder.answernator.utils
import kotlinx.serialization.UnstableDefault
import mu.KotlinLogging
import java.io.File
import java.net.URLClassLoader
import java.util.*
private val logger = KotlinLogging.logger { }
@UnstableDefault
object CommandList {
var commands: List<Command> = listOf()
var modules: List<ModuleInfoProvider> = listOf()
......
......@@ -24,7 +24,7 @@ open class Config(
companion object {
val DEFAULT = Config()
@UnstableDefault
@OptIn(UnstableDefault::class)
fun loadFrom(file: File): Config {
return Json.parse(serializer(), file.readText(Charsets.UTF_8))
}
......
......@@ -7,7 +7,8 @@ import kotlinx.serialization.json.JsonConfiguration
import java.io.File
import kotlin.random.Random
@UnstableDefault
@OptIn(UnstableDefault::class)
object Globals {
private const val configFileName = "config.json"
......
......@@ -3,13 +3,11 @@ package pw.modder.answernator.utils
import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.extensions.getStringSafe
import pw.modder.answernator.utils.extensions.getStringOrKey as getStringOrKey1
import java.util.*
import pw.modder.answernator.utils.extensions.getStringOrKey as getStringOrKey1
//private val logger: KLogger = KotlinLogging.logger {}
@UnstableDefault
interface LocalizedCommand: Command {
fun getTexts(locale: Locale): ResourceBundle {
return ResourceBundle.getBundle("locale.$name", locale, javaClass.classLoader, UTF8Control())
......
package pw.modder.answernator.utils
import kotlinx.serialization.UnstableDefault
interface ModuleInfoProvider {
val name: String
val version: String
......@@ -16,6 +14,5 @@ interface ModuleInfoProvider {
class ModuleInfo: ModuleInfoProvider {
override val name = "Base"
@UnstableDefault
override val version = Globals.getDependencyVersion("pw.modder", "Answernator")
}
\ No newline at end of file
......@@ -2,7 +2,8 @@ package pw.modder.answernator.utils.auditLog
import com.jessecorbett.diskord.api.model.User
import com.jessecorbett.diskord.api.model.Webhook
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement
@Serializable
......
......@@ -5,12 +5,9 @@ import io.ktor.client.request.get
import io.ktor.client.request.url
import io.ktor.http.cookies
import io.ktor.http.userAgent
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Globals
@UnstableDefault
private val userAgent = "DiscordBot: (https://gitlab.com/jesselcorbett/diskord, ${Globals.getDependencyVersion("com.jessecorbett", "diskord-jvm")})"
@UnstableDefault
suspend fun Attachment.downloadAsString(): String {
return Globals.httpClient.get<String> {
userAgent(userAgent)
......
......@@ -5,5 +5,5 @@ import com.jessecorbett.diskord.util.DiskordInternals
import pw.modder.answernator.utils.auditLog.AuditLog
@Suppress("UNUSED_PARAMETER")
@UseExperimental(DiskordInternals::class)
@OptIn(DiskordInternals::class)
suspend fun GuildClient.getAuditLog(useCustom: Boolean = true) = getRequest("/guilds/$guildId/audit-logs", AuditLog.serializer())
\ No newline at end of file
......@@ -5,7 +5,6 @@ import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.DiskordDsl
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import mu.KotlinLogging
import pw.modder.answernator.db.Db
import pw.modder.answernator.utils.Command
......@@ -18,7 +17,6 @@ import pw.modder.answernator.utils.extensions.getStringSafe
import java.util.*
private val logger = KotlinLogging.logger {}
@UnstableDefault
@DiskordDsl
fun Bot.commandService() {
val config = Globals.config
......
......@@ -2,10 +2,8 @@ package pw.modder.answernator.utils.extensions.bot
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.DiskordDsl
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.db.Db
@UnstableDefault
@DiskordDsl
fun Bot.defaultRoleService() {
userJoinedGuild {
......
......@@ -5,10 +5,8 @@ import com.jessecorbett.diskord.api.websocket.model.ActivityType
import com.jessecorbett.diskord.api.websocket.model.UserStatusActivity
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.DiskordDsl
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Globals
@UnstableDefault
@DiskordDsl
fun Bot.defaultStatusService() {
started {
......
......@@ -4,10 +4,8 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.DiskordDsl
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.sendMessage
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.db.Db
@UnstableDefault
@DiskordDsl
fun Bot.greetingService() {
userJoinedGuild {
......
......@@ -6,7 +6,6 @@ import com.jessecorbett.diskord.dsl.DiskordDsl
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.sendMessage
import kotlinx.coroutines.delay
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.db.Db
import pw.modder.answernator.utils.UTF8Control
import pw.modder.answernator.utils.extensions.getAuditLog
......@@ -14,7 +13,6 @@ import pw.modder.answernator.utils.extensions.getStringOrKey
import pw.modder.answernator.utils.extensions.toUserMention
import java.util.*
@UnstableDefault
@DiskordDsl
fun Bot.logService() {
userBanned { ban ->
......
......@@ -4,7 +4,6 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.DiskordDsl
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.sendMessage
import kotlinx.serialization.UnstableDefault
import mu.KotlinLogging
import pw.modder.answernator.db.Db
import pw.modder.answernator.db.Db.memberIsMuted
......@@ -16,7 +15,6 @@ import pw.modder.answernator.utils.extensions.getStringOrKey
import java.util.*
private val logger = KotlinLogging.logger {}
@UnstableDefault
@DiskordDsl
fun Bot.muteService() {
userJoinedGuild {
......
plugins {
kotlin("jvm") version "1.3.61"
kotlin("plugin.serialization") version "1.3.61" apply false
kotlin("jvm") version "1.3.72"
kotlin("plugin.serialization") version "1.3.72" apply false
id("com.palantir.git-version") version "0.12.2" apply false
id("com.github.johnrengelman.shadow") version "5.2.0" apply false
}
......
......@@ -25,7 +25,7 @@ repositories {
dependencies {
implementation(project(":Answernator"))
implementation(kotlin("stdlib-jdk8"))
implementation("com.jessecorbett:diskord-jvm:$diskordVersion")
implementation("com.jessecorbett:diskord:$diskordVersion")
implementation("commons-io:commons-io:$commonsIoVersion")
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
implementation("com.google.guava:guava:$guavaVersion")
......@@ -40,9 +40,11 @@ dependencies {
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
val createModuleVersionFile by creating {
......
......@@ -6,13 +6,11 @@ import com.jessecorbett.diskord.api.rest.client.GuildClient
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.db.Db
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Globals
import java.util.*
@UnstableDefault
class DChar: Command {
override val name = "буквахуй"
override fun getHelp(locale: Locale) = "х̆уй!"
......
......@@ -18,14 +18,13 @@ import pw.modder.answernator.db.Db
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.extensions.setTimestamp
import pw.modder.answernator.`fun`.utils.Quote as QuoteData
import com.jessecorbett.diskord.dsl.message as dslmessage
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
import pw.modder.answernator.`fun`.utils.Quote as QuoteData
@UnstableDefault
private val json = Json(JsonConfiguration(strictMode = false))
@OptIn(UnstableDefault::class)
private val json = Json(JsonConfiguration(ignoreUnknownKeys = true))
@UnstableDefault
class Quote: Command {
override val name = "quote"
override val cmdType = Command.CommandGroup.FUN
......
......@@ -9,18 +9,16 @@ import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.dsl.footer
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.db.Db
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.LocalizedCommand
import pw.modder.answernator.utils.extensions.setCurrentTimestamp
import com.jessecorbett.diskord.dsl.message as dslmessage
import java.util.*
import kotlin.random.Random
import com.jessecorbett.diskord.dsl.message as dslmessage
private val random = Random(System.currentTimeMillis())
@UnstableDefault
class Tsar: LocalizedCommand {
override val name = "царь"
override val cmdType = Command.CommandGroup.FUN
......
......@@ -5,22 +5,21 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.mention
import kotlinx.serialization.UnstableDefault
import kotlinx.serialization.builtins.list
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration
import kotlinx.serialization.list
import pw.modder.answernator.`fun`.utils.UbuntuWord
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import java.util.*
@UnstableDefault
class Ubuntu: LocalizedCommand {
override val name: String = "ubuntu"
override val cmdType = Command.CommandGroup.FUN
@OptIn(UnstableDefault::class)
private val data = Json(JsonConfiguration.Default)
.parse(UbuntuWord.serializer().list, javaClass.classLoader.getResourceAsStream("ubuntu.json").reader().readText())
@UnstableDefault
override suspend fun action(bot: Bot, message: Message, texts: ResourceBundle): CombinedMessageEmbed {
return textMessage("${message.author.mention}, ${data.random().run { first.random() + ' ' + second.random() }}")
}
......
kotlin.code.style=official
diskordVersion=1.5.3
diskordVersion=1.6.2
kotlinxCoroutinesVersion=1.3.3
kotlinSerializationVersion=0.14.0
ktorVersion=1.2.6
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
......@@ -26,7 +26,7 @@ repositories {
dependencies {
implementation(project(":Answernator"))
implementation(kotlin("stdlib-jdk8"))
implementation("com.jessecorbett:diskord-jvm:$diskordVersion")
implementation("com.jessecorbett:diskord:$diskordVersion")
implementation("commons-io:commons-io:$commonsIoVersion")
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
implementation("com.google.guava:guava:$guavaVersion")
......@@ -42,9 +42,11 @@ dependencies {
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
val createModuleVersionFile by creating {
......
package pw.modder.answernator.tools.commandTypes
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import java.util.*
@UnstableDefault
interface LocalizedGuildOnlyCommand: LocalizedCommand {
override val channels: EnumSet<Command.ChannelTypes>
get() = EnumSet.of(Command.ChannelTypes.GUILD)
......
......@@ -5,17 +5,15 @@ import com.jessecorbett.diskord.api.model.Permission
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.cache.GuildCache.getCached
import pw.modder.answernator.tools.commandTypes.LocalizedGuildOnlyCommand
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.extensions.isUserMention
import pw.modder.answernator.utils.extensions.toUserMention
import pw.modder.answernator.cache.GuildCache.getCached
import pw.modder.answernator.utils.extensions.bot.isMe
import pw.modder.answernator.utils.extensions.isAdmin
import pw.modder.answernator.utils.extensions.isUserMention
import pw.modder.answernator.utils.extensions.toUserMention
import java.util.*
@UnstableDefault
class Ban: LocalizedGuildOnlyCommand {
override val name = "ban"
override val userGroup = Command.UserGroup.PERMISSION
......
......@@ -7,16 +7,13 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.authorId
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import java.time.Instant
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
import java.util.*
@UnstableDefault
class Clear: LocalizedCommand {
override val name = "clear"
......
......@@ -5,9 +5,7 @@ import com.jessecorbett.diskord.api.rest.EmbedImage
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.ClientStore
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import java.util.*
......@@ -15,7 +13,6 @@ import kotlin.random.Random
import com.jessecorbett.diskord.dsl.message as dslmessage
private val random = Random(System.currentTimeMillis())
@UnstableDefault
class Dice: LocalizedCommand {
override val name: String = "dice"
private val diceLimit: Int
......
......@@ -9,7 +9,6 @@ import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.words
import pw.modder.answernator.cache.GuildCache.getCached
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.tools.commandTypes.LocalizedGuildOnlyCommand
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Utils
......@@ -18,7 +17,6 @@ import pw.modder.answernator.utils.extensions.toUserMention
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class Guild: LocalizedGuildOnlyCommand {
override val name = "guild"
override val userGroup = Command.UserGroup.ADMIN
......
......@@ -7,19 +7,17 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.dsl.field
import com.jessecorbett.diskord.util.toRoleMention
import com.jessecorbett.diskord.dsl.message as dslmessage
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.tools.commandTypes.LocalizedGuildOnlyCommand
import pw.modder.answernator.utils.Command
import pw.modder.answernator.cache.GuildCache.getCached
import pw.modder.answernator.db.Db
import pw.modder.answernator.db.Db.memberIsMuted
import pw.modder.answernator.tools.commandTypes.LocalizedGuildOnlyCommand
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.Globals
import pw.modder.answernator.utils.Utils
import pw.modder.answernator.utils.extensions.*
import java.util.*
import com.jessecorbett.diskord.dsl.message as dslmessage
@UnstableDefault
class Info: LocalizedGuildOnlyCommand {
override val name = "info"
override val userGroup = Command.UserGroup.PERMISSION
......
......@@ -5,7 +5,6 @@ import com.jessecorbett.diskord.api.model.Permission
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.cache.GuildCache.getCached
import pw.modder.answernator.tools.commandTypes.LocalizedGuildOnlyCommand
import pw.modder.answernator.utils.Command
......@@ -15,7 +14,6 @@ import pw.modder.answernator.utils.extensions.isUserMention
import pw.modder.answernator.utils.extensions.toUserMention
import java.util.*
@UnstableDefault
class Kick: LocalizedGuildOnlyCommand {
override val name = "kick"
override val userGroup = Command.UserGroup.PERMISSION
......
......@@ -3,17 +3,14 @@ package pw.modder.answernator.tools.commands.localized
import com.jessecorbett.diskord.api.model.Message
import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.ClientStore
import com.jessecorbett.diskord.util.mention
import com.jessecorbett.diskord.util.words
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.tools.utils.RandomGames
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import java.util.*
internal val gamesdb = RandomGames()
@UnstableDefault
class RandomGame: LocalizedCommand {
override val name = "randomgame"
override val cmdType = Command.CommandGroup.FUN
......
......@@ -8,13 +8,11 @@ import com.jessecorbett.diskord.dsl.Bot
import com.jessecorbett.diskord.dsl.CombinedMessageEmbed
import com.jessecorbett.diskord.util.words
import kotlinx.coroutines.*
import kotlinx.serialization.UnstableDefault
import pw.modder.answernator.utils.Command
import pw.modder.answernator.utils.LocalizedCommand
import java.util.*
private var randomGamesTimer: Job? = null
@UnstableDefault
class Status: LocalizedCommand {
override val name = "status"
......