mirror of
https://github.com/HMCore/Orbot.git
synced 2025-12-12 13:56:18 +00:00
Update Json Serialization
This commit is contained in:
16
.idea/codeStyles/Project.xml
generated
16
.idea/codeStyles/Project.xml
generated
@@ -1,22 +1,6 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
|
||||||
<value>
|
|
||||||
<package name="java.util" alias="false" withSubpackages="false" />
|
|
||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
|
||||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="kotlin">
|
<codeStyleSettings language="kotlin">
|
||||||
|
|||||||
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
@@ -21,5 +21,10 @@
|
|||||||
<option name="name" value="BintrayJCenter" />
|
<option name="name" value="BintrayJCenter" />
|
||||||
<option name="url" value="https://jcenter.bintray.com/" />
|
<option name="url" value="https://jcenter.bintray.com/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://m2.dv8tion.net/releases" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
30
.idea/workspace.xml
generated
30
.idea/workspace.xml
generated
@@ -4,15 +4,14 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="no idea what that did">
|
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="Update dependencies">
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/org/hmcore/TwitterJob.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.kt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.kt" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DiscordRpc.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DiscordRpc.kt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -78,10 +77,10 @@
|
|||||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/build/libs" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$/build/libs" />
|
||||||
<property name="project.structure.last.edited" value="Modules" />
|
<property name="project.structure.last.edited" value="Project" />
|
||||||
<property name="project.structure.proportion" value="0.15" />
|
<property name="project.structure.proportion" value="0.15" />
|
||||||
<property name="project.structure.side.proportion" value="0.2" />
|
<property name="project.structure.side.proportion" value="0.2" />
|
||||||
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.gradle" />
|
<property name="settings.editor.selected.configurable" value="preferences.pluginManager" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="MoveKotlinTopLevelDeclarationsDialog.RECENTS_KEY">
|
<key name="MoveKotlinTopLevelDeclarationsDialog.RECENTS_KEY">
|
||||||
@@ -96,7 +95,7 @@
|
|||||||
<recent name="E:\Projects\Kotlin_Proj\HytaleUpdateBot\src\main\kotlin\de\wulkanat" />
|
<recent name="E:\Projects\Kotlin_Proj\HytaleUpdateBot\src\main\kotlin\de\wulkanat" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Application.MainKt">
|
<component name="RunManager" selected="Gradle.HytaleUpdateBot [build]">
|
||||||
<configuration name="HytaleUpdateBot [build]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
|
<configuration name="HytaleUpdateBot [build]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
|
||||||
<ExternalSystemSettings>
|
<ExternalSystemSettings>
|
||||||
<option name="executionName" />
|
<option name="executionName" />
|
||||||
@@ -165,14 +164,8 @@
|
|||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="MainKt" type="JetRunConfigurationType" temporary="true" nameIsGenerated="true">
|
<configuration name="MainKt" type="JetRunConfigurationType" temporary="true" nameIsGenerated="true">
|
||||||
<module name="HytaleUpdateBot.main" />
|
|
||||||
<option name="VM_PARAMETERS" />
|
|
||||||
<option name="PROGRAM_PARAMETERS" />
|
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
|
||||||
<option name="ALTERNATIVE_JRE_PATH" />
|
|
||||||
<option name="PASS_PARENT_ENVS" value="true" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="de.wulkanat.MainKt" />
|
<option name="MAIN_CLASS_NAME" value="de.wulkanat.MainKt" />
|
||||||
<option name="WORKING_DIRECTORY" />
|
<module name="HytaleUpdateBot.main" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
@@ -257,15 +250,6 @@
|
|||||||
<option name="LAST_COMMIT_MESSAGE" value="prepare twitter integration" />
|
<option name="LAST_COMMIT_MESSAGE" value="prepare twitter integration" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
|
||||||
<breakpoints>
|
|
||||||
<line-breakpoint enabled="true" type="kotlin-line">
|
|
||||||
<url>file://$PROJECT_DIR$/src/main/kotlin/de/wulkanat/AdminCli.kt</url>
|
|
||||||
<line>22</line>
|
|
||||||
<option name="timeStamp" value="1" />
|
|
||||||
</line-breakpoint>
|
|
||||||
</breakpoints>
|
|
||||||
</breakpoint-manager>
|
|
||||||
<watches-manager>
|
<watches-manager>
|
||||||
<configuration name="JetRunConfigurationType">
|
<configuration name="JetRunConfigurationType">
|
||||||
<watch expression="((org.jsoup.nodes.Element.NodeList)((Document)doc).childNodes).get(2)" custom="org.jsoup.nodes.Element.NodeList,org.jsoup.nodes.Document" />
|
<watch expression="((org.jsoup.nodes.Element.NodeList)((Document)doc).childNodes).get(2)" custom="org.jsoup.nodes.Element.NodeList,org.jsoup.nodes.Document" />
|
||||||
|
|||||||
@@ -9,14 +9,17 @@ version '2.0.0'
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
maven {
|
||||||
|
url 'https://m2.dv8tion.net/releases'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||||
|
|
||||||
implementation 'net.dv8tion:JDA:4.2.0_189'
|
implementation 'net.dv8tion:JDA:4.2.1_253'
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0"
|
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1'
|
||||||
|
|
||||||
implementation 'com.github.redouane59.twitter:twittered:1.20'
|
implementation 'com.github.redouane59.twitter:twittered:1.20'
|
||||||
implementation group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
|
implementation group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
@file:JvmName("Admin")
|
@file:JvmName("Admin")
|
||||||
|
|
||||||
package de.wulkanat
|
package de.wulkanat
|
||||||
|
|
||||||
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonConfiguration
|
|
||||||
import net.dv8tion.jda.api.EmbedBuilder
|
import net.dv8tion.jda.api.EmbedBuilder
|
||||||
import net.dv8tion.jda.api.JDA
|
|
||||||
import net.dv8tion.jda.api.entities.Activity
|
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed
|
import net.dv8tion.jda.api.entities.MessageEmbed
|
||||||
import net.dv8tion.jda.api.entities.User
|
import net.dv8tion.jda.api.entities.User
|
||||||
import java.awt.Color
|
import java.awt.Color
|
||||||
|
|
||||||
object Admin {
|
object Admin {
|
||||||
@JvmField
|
@JvmField
|
||||||
val adFile = Json(JsonConfiguration.Stable).parse(AdminFile.serializer(), ADMIN_FILE.readText())
|
val adFile = Json.decodeFromString<AdminFile>(ADMIN_FILE.readText())
|
||||||
val userId: Long = adFile.adminId
|
val userId: Long = adFile.adminId
|
||||||
val token: String = adFile.token
|
val token: String = adFile.token
|
||||||
val updateMs: Long = adFile.updateMs
|
val updateMs: Long = adFile.updateMs
|
||||||
@@ -21,8 +20,8 @@ object Admin {
|
|||||||
|
|
||||||
fun connectToUser() {
|
fun connectToUser() {
|
||||||
Main.jdas.forEach {
|
Main.jdas.forEach {
|
||||||
if(admin != null) return;
|
admin ?: return;
|
||||||
admin = it.retrieveUserById(userId)?.complete()
|
admin = it.retrieveUserById(userId).complete()
|
||||||
}
|
}
|
||||||
if (admin == null) {
|
if (admin == null) {
|
||||||
kotlin.io.println("Connection to de.wulkanat.Admin failed!")
|
kotlin.io.println("Connection to de.wulkanat.Admin failed!")
|
||||||
@@ -30,6 +29,7 @@ object Admin {
|
|||||||
kotlin.io.println("Connected to ${admin!!.name}. No further errors will be printed here.")
|
kotlin.io.println("Connected to ${admin!!.name}. No further errors will be printed here.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var admin: User? = null
|
var admin: User? = null
|
||||||
|
|
||||||
fun println(msg: String) {
|
fun println(msg: String) {
|
||||||
@@ -65,8 +65,7 @@ object Admin {
|
|||||||
this.setAuthor(author.asTag, author.avatarUrl, author.avatarUrl)
|
this.setAuthor(author.asTag, author.avatarUrl, author.avatarUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.build()
|
.build(), "$msg\n\n${error}"
|
||||||
, "$msg\n\n${error}"
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,8 +75,7 @@ object Admin {
|
|||||||
.setTitle(msg)
|
.setTitle(msg)
|
||||||
.setDescription(error.message)
|
.setDescription(error.message)
|
||||||
.setColor(Color.RED)
|
.setColor(Color.RED)
|
||||||
.build()
|
.build(), "$msg\n\n${error.message}"
|
||||||
, "$msg\n\n${error.message}"
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,12 +93,14 @@ object Admin {
|
|||||||
sendDevMessage(
|
sendDevMessage(
|
||||||
EmbedBuilder()
|
EmbedBuilder()
|
||||||
.setTitle("Now watching for new Hytale Blogposts every ${updateMs / 1000}s")
|
.setTitle("Now watching for new Hytale Blogposts every ${updateMs / 1000}s")
|
||||||
.setDescription("""
|
.setDescription(
|
||||||
|
"""
|
||||||
${Channels.getServerNames().joinToString("\n")}
|
${Channels.getServerNames().joinToString("\n")}
|
||||||
|
|
||||||
**_Service Channels_**
|
**_Service Channels_**
|
||||||
${Channels.getServiceChannelServers().joinToString("\n")}
|
${Channels.getServiceChannelServers().joinToString("\n")}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
.setColor(Color.GREEN)
|
.setColor(Color.GREEN)
|
||||||
.build(),
|
.build(),
|
||||||
"Now watching for new Hytale BlogPosts"
|
"Now watching for new Hytale BlogPosts"
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
@file:JvmName("Channels")
|
@file:JvmName("Channels")
|
||||||
|
|
||||||
package de.wulkanat
|
package de.wulkanat
|
||||||
|
|
||||||
import de.wulkanat.extensions.crosspost
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.list
|
import kotlinx.serialization.encodeToString
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
import net.dv8tion.jda.api.EmbedBuilder
|
import net.dv8tion.jda.api.EmbedBuilder
|
||||||
import net.dv8tion.jda.api.JDA
|
|
||||||
import net.dv8tion.jda.api.Permission
|
import net.dv8tion.jda.api.Permission
|
||||||
import net.dv8tion.jda.api.entities.Message
|
import net.dv8tion.jda.api.entities.Message
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed
|
|
||||||
import net.dv8tion.jda.api.entities.TextChannel
|
import net.dv8tion.jda.api.entities.TextChannel
|
||||||
import java.awt.Color
|
import java.awt.Color
|
||||||
|
|
||||||
@@ -75,7 +75,8 @@ object Channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Admin.println("Service message distributed to ${serviceChannels.size} channels.")
|
Admin.println("Service message distributed to ${serviceChannels.size} channels.")
|
||||||
Admin.sendDevMessage(serviceMessage, """
|
Admin.sendDevMessage(
|
||||||
|
serviceMessage, """
|
||||||
***************
|
***************
|
||||||
SERVICE MESSAGE
|
SERVICE MESSAGE
|
||||||
|
|
||||||
@@ -83,7 +84,8 @@ object Channels {
|
|||||||
-------
|
-------
|
||||||
$message
|
$message
|
||||||
***************
|
***************
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkEveryonePermission() {
|
fun checkEveryonePermission() {
|
||||||
@@ -103,23 +105,15 @@ object Channels {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refreshChannelsFromDisk(): MutableList<DiscordChannel> {
|
fun refreshChannelsFromDisk() =
|
||||||
return json.parse(
|
Json.decodeFromString<List<DiscordChannel>>(SERVERS_FILE.readText()).toMutableList()
|
||||||
DiscordChannel.serializer().list, (SERVERS_FILE).readText()
|
|
||||||
).toMutableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun refreshServiceChannelsFromDisk(): MutableList<ServiceChannel> {
|
fun refreshServiceChannelsFromDisk() =
|
||||||
return json.parse(
|
Json.decodeFromString<List<ServiceChannel>>(SERVICE_CHANNELS_FILE.readText()).toMutableList()
|
||||||
ServiceChannel.serializer().list, (SERVICE_CHANNELS_FILE).readText()
|
|
||||||
).toMutableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getServerNames(server: Long? = null): List<String> {
|
fun getServerNames(server: Long? = null) = Main.jdas.flatMap { jda ->
|
||||||
|
channels.filter { server == null || (jda.getTextChannelById(it.id)?.guild?.idLong == server) }.map {
|
||||||
return Main.jdas.flatMap { jda ->
|
val channel = jda.getTextChannelById(it.id)
|
||||||
channels.filter { server == null || (jda!!.getTextChannelById(it.id)?.guild?.idLong == server) }.map {
|
|
||||||
val channel = jda!!.getTextChannelById(it.id)
|
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
Admin.warning("Channel ${it.id} is no longer active!")
|
Admin.warning("Channel ${it.id} is no longer active!")
|
||||||
return@map "**${it.id}** *(inactive)*"
|
return@map "**${it.id}** *(inactive)*"
|
||||||
@@ -140,7 +134,6 @@ object Channels {
|
|||||||
}"
|
}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun getServiceChannelServers(server: Long? = null): List<String> {
|
fun getServiceChannelServers(server: Long? = null): List<String> {
|
||||||
|
|
||||||
@@ -153,13 +146,8 @@ object Channels {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testServerId(id: Long): TextChannel? {
|
fun testServerId(id: Long) =
|
||||||
|
Main.jdas.map { it.getTextChannelById(id) }.firstOrNull()
|
||||||
return Main.jdas.map {
|
|
||||||
it.getTextChannelById(id)
|
|
||||||
}.firstOrNull()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addChannel(id: Long, role: String?): DiscordChannel? {
|
fun addChannel(id: Long, role: String?): DiscordChannel? {
|
||||||
if (channels.find { it.id == id } != null) {
|
if (channels.find { it.id == id } != null) {
|
||||||
@@ -172,17 +160,7 @@ object Channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun saveChannels() {
|
fun saveChannels() {
|
||||||
SERVERS_FILE.writeText(
|
SERVERS_FILE.writeText(Json.encodeToString(channels))
|
||||||
json.stringify(
|
SERVICE_CHANNELS_FILE.writeText(Json.encodeToString(serviceChannels))
|
||||||
DiscordChannel.serializer().list,
|
|
||||||
channels
|
|
||||||
)
|
|
||||||
)
|
|
||||||
SERVICE_CHANNELS_FILE.writeText(
|
|
||||||
json.stringify(
|
|
||||||
ServiceChannel.serializer().list,
|
|
||||||
serviceChannels
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,8 @@ package de.wulkanat
|
|||||||
|
|
||||||
import de.wulkanat.extensions.ensureExists
|
import de.wulkanat.extensions.ensureExists
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.encodeToString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonConfiguration
|
|
||||||
import kotlinx.serialization.list
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@@ -45,9 +44,7 @@ data class TwitterApi(
|
|||||||
val apiKeySecret: String = "Api Key secret here"
|
val apiKeySecret: String = "Api Key secret here"
|
||||||
)
|
)
|
||||||
|
|
||||||
val json = Json(JsonConfiguration.Stable)
|
val SERVERS_FILE = File("servers.json").ensureExists(Json.encodeToString(listOf<DiscordChannel>()))
|
||||||
|
|
||||||
val SERVERS_FILE = File("servers.json").ensureExists(json.stringify(DiscordChannel.serializer().list, listOf()))
|
|
||||||
val SERVICE_CHANNELS_FILE =
|
val SERVICE_CHANNELS_FILE =
|
||||||
File("service_channels.json").ensureExists(json.stringify(ServiceChannel.serializer().list, listOf()))
|
File("service_channels.json").ensureExists(Json.encodeToString(listOf<ServiceChannel>()))
|
||||||
val ADMIN_FILE = File("admin.json").ensureExists(json.stringify(AdminFile.serializer(), AdminFile()))
|
val ADMIN_FILE = File("admin.json").ensureExists(Json.encodeToString(AdminFile()))
|
||||||
|
|||||||
Reference in New Issue
Block a user