cleanup
This commit is contained in:
parent
9ac62fdf89
commit
c31e22c082
2 changed files with 96 additions and 96 deletions
|
@ -14,7 +14,6 @@ import io.ktor.server.plugins.contentnegotiation.*
|
||||||
import io.ktor.server.plugins.cors.routing.*
|
import io.ktor.server.plugins.cors.routing.*
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import observer.nelle.personalSiteAPI.plugins.configureRouting
|
import observer.nelle.personalSiteAPI.plugins.configureRouting
|
||||||
import kotlin.streams.asSequence
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
embeddedServer(
|
embeddedServer(
|
||||||
|
@ -50,98 +49,3 @@ fun Application.module() {
|
||||||
configureRouting(client)
|
configureRouting(client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMeow(): String {
|
|
||||||
val meowLength = (0..42).random()
|
|
||||||
val isNeoCat = (0..69).random()
|
|
||||||
val isBubble = (0..2).random()
|
|
||||||
|
|
||||||
val mainSrc = "meowrp"
|
|
||||||
val beginSrc = "m"
|
|
||||||
val eow = "eow"
|
|
||||||
|
|
||||||
var neoCat = ""
|
|
||||||
|
|
||||||
val thoughtBalloon = "\uD83D\uDCAD "
|
|
||||||
val speechBalloon = "\uD83D\uDCAC"
|
|
||||||
var balloon = " "
|
|
||||||
when (isBubble) {
|
|
||||||
0 -> balloon = " "
|
|
||||||
1 -> balloon = thoughtBalloon
|
|
||||||
2 -> balloon = speechBalloon
|
|
||||||
}
|
|
||||||
|
|
||||||
val mainMeow =
|
|
||||||
java.util
|
|
||||||
.Random()
|
|
||||||
.ints(meowLength.toLong(), 0, mainSrc.length)
|
|
||||||
.asSequence()
|
|
||||||
.map(mainSrc::get)
|
|
||||||
.joinToString("")
|
|
||||||
|
|
||||||
when (isNeoCat) {
|
|
||||||
0 -> neoCat = ""
|
|
||||||
1 -> neoCat = " :neocat:$balloon"
|
|
||||||
2 -> neoCat = " :neocat_3c:$balloon"
|
|
||||||
3 -> neoCat = " :neocat__w_:$balloon"
|
|
||||||
4 -> neoCat = " :neocat_fox:$balloon"
|
|
||||||
5 -> neoCat = " :neocat_box:$balloon"
|
|
||||||
6 -> neoCat = " :neocat_gun:$balloon"
|
|
||||||
7 -> neoCat = " :neocat_sip:$balloon"
|
|
||||||
8 -> neoCat = " :neocat_mug:$balloon"
|
|
||||||
9 -> neoCat = " :neocat_pat:$balloon"
|
|
||||||
10 -> neoCat = " :neocat_owo:$balloon"
|
|
||||||
11 -> neoCat = " :neocat_melt:$balloon"
|
|
||||||
12 -> neoCat = " :neocat_evil:$balloon"
|
|
||||||
13 -> neoCat = " :neocat_evil_3c:$balloon"
|
|
||||||
14 -> neoCat = " :neocat_smol:$balloon"
|
|
||||||
15 -> neoCat = " :neocat_smoller:$balloon"
|
|
||||||
16 -> neoCat = ""
|
|
||||||
17 -> neoCat = " :neocat_comfy__w_:$balloon"
|
|
||||||
18 -> neoCat = " :neocat_comfy_shy:$balloon"
|
|
||||||
19 -> neoCat = " :neocat_comfy_sip:$balloon"
|
|
||||||
20 -> neoCat = " :neocat_comfy_happy:$balloon"
|
|
||||||
21 -> neoCat = " :neocat_comfy_shy_smoller:$balloon"
|
|
||||||
22 -> neoCat = " :neocircle:$balloon"
|
|
||||||
23 -> neoCat = " :neocircle_forwards:$balloon"
|
|
||||||
24 -> neoCat = " :neocircle_smoller_forwards:$balloon"
|
|
||||||
25 -> neoCat = " :neocircle_smoller:$balloon"
|
|
||||||
26 -> neoCat = " :neocat_floof:$balloon"
|
|
||||||
27 -> neoCat = " :neocat_floof__w_:$balloon"
|
|
||||||
28 -> neoCat = " :neocat_floof_mug:$balloon"
|
|
||||||
29 -> neoCat = " :neocat_floof_owo:$balloon"
|
|
||||||
30 -> neoCat = " :neocat_floof_cute:$balloon"
|
|
||||||
31 -> neoCat = " :neocat_floof_angel:$balloon"
|
|
||||||
32 -> neoCat = " :neocat_floof_devil:$balloon"
|
|
||||||
33 -> neoCat = " :neocat_floof_happy:$balloon"
|
|
||||||
34 -> neoCat = " :neocat_floof_reach:$balloon"
|
|
||||||
35 -> neoCat = " :neocat_floof_explode:$balloon"
|
|
||||||
36 -> neoCat = " :neocat_astronaut:$balloon"
|
|
||||||
37 -> neoCat = " :neocat_astronaut_gun:$balloon"
|
|
||||||
38 -> neoCat = " :neocat_cofe:$balloon"
|
|
||||||
39 -> neoCat = " :neocat_melt_blep:$balloon"
|
|
||||||
40 -> neoCat = " :neocat_melt_happy:$balloon"
|
|
||||||
41 -> neoCat = " :neocat_melt_reach:$balloon"
|
|
||||||
42 -> neoCat = ""
|
|
||||||
43 -> neoCat = ""
|
|
||||||
44 -> neoCat = ""
|
|
||||||
45 -> neoCat = ""
|
|
||||||
46 -> neoCat = ""
|
|
||||||
47 -> neoCat = ""
|
|
||||||
48 -> neoCat = ""
|
|
||||||
49 -> neoCat = ""
|
|
||||||
50 -> neoCat = ""
|
|
||||||
51 -> neoCat = ""
|
|
||||||
52 -> neoCat = ""
|
|
||||||
53 -> neoCat = ""
|
|
||||||
54 -> neoCat = ""
|
|
||||||
55 -> neoCat = ""
|
|
||||||
56 -> neoCat = ""
|
|
||||||
57 -> neoCat = ""
|
|
||||||
58 -> neoCat = ""
|
|
||||||
59 -> neoCat = ""
|
|
||||||
60 -> neoCat = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return "$neoCat$beginSrc$mainMeow$eow"
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,102 @@ import io.ktor.client.*
|
||||||
import io.ktor.client.request.forms.*
|
import io.ktor.client.request.forms.*
|
||||||
import io.ktor.client.statement.*
|
import io.ktor.client.statement.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
|
import kotlin.streams.asSequence
|
||||||
|
|
||||||
|
// Other Shit
|
||||||
|
fun getMeow(): String {
|
||||||
|
// source of characters to randomize
|
||||||
|
val mainSrc = "meowrp"
|
||||||
|
// length of meow
|
||||||
|
val meowLength = (0..42).random()
|
||||||
|
// generate meow based on length and randomized characters
|
||||||
|
val mainMeow =
|
||||||
|
java.util
|
||||||
|
.Random()
|
||||||
|
.ints(meowLength.toLong(), 0, mainSrc.length)
|
||||||
|
.asSequence()
|
||||||
|
.map(mainSrc::get)
|
||||||
|
.joinToString("")
|
||||||
|
|
||||||
|
// Get balloons (only called if the neocat is called)
|
||||||
|
val balloon = listOf(" \uD83D\uDCAC ", " \uD83D\uDCAD ")
|
||||||
|
// choose a random balloon out of list
|
||||||
|
val randomBalloon = balloon.asSequence().shuffled().find { true }
|
||||||
|
|
||||||
|
// get neocat
|
||||||
|
val neoCat =
|
||||||
|
listOf(
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
":neocat:",
|
||||||
|
":neocat_3c:",
|
||||||
|
":neocat__w_:",
|
||||||
|
":neocat_fox:",
|
||||||
|
":neocat_box:",
|
||||||
|
":neocat_gun:",
|
||||||
|
":neocat_sip:",
|
||||||
|
":neocat_mug:",
|
||||||
|
":neocat_pat:",
|
||||||
|
":neocat_owo:",
|
||||||
|
":neocat_melt:",
|
||||||
|
":neocat_evil:",
|
||||||
|
":neocat_evil_3c:",
|
||||||
|
":neocat_smol:",
|
||||||
|
":neocat_smoller:",
|
||||||
|
":neocat_comfy__w_:",
|
||||||
|
":neocat_comfy_shy:",
|
||||||
|
":neocat_comfy_sip:",
|
||||||
|
":neocat_comfy_happy:",
|
||||||
|
":neocat_comfy_shy_smoller:",
|
||||||
|
":neocircle:",
|
||||||
|
":neocircle_forwards:",
|
||||||
|
":neocircle_smoller_forwards:",
|
||||||
|
":neocircle_smoller:",
|
||||||
|
":neocat_floof:",
|
||||||
|
":neocat_floof__w_:",
|
||||||
|
":neocat_floof_mug:",
|
||||||
|
":neocat_floof_owo:",
|
||||||
|
":neocat_floof_cute:",
|
||||||
|
":neocat_floof_angel:",
|
||||||
|
":neocat_floof_devil:",
|
||||||
|
":neocat_floof_happy:",
|
||||||
|
":neocat_floof_reach:",
|
||||||
|
":neocat_floof_explode:",
|
||||||
|
":neocat_astronaut:",
|
||||||
|
":neocat_astronaut_gun:",
|
||||||
|
":neocat_cofe:",
|
||||||
|
":neocat_melt_blep:",
|
||||||
|
":neocat_melt_happy:",
|
||||||
|
":neocat_melt_reach:",
|
||||||
|
)
|
||||||
|
// choose a random cat emote out of list
|
||||||
|
val randomCat = neoCat.asSequence().shuffled().find { true }
|
||||||
|
|
||||||
|
// if the neocat returns empty, don't use a balloon, else return cat and random balloon
|
||||||
|
return if (randomCat == "") {
|
||||||
|
"m" + mainMeow + "eow"
|
||||||
|
} else {
|
||||||
|
"$randomCat$randomBalloon" + "m" + mainMeow + "eow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Outgoing API Calls
|
||||||
|
|
||||||
|
// Make a post with mastodon API
|
||||||
|
// TODO: Replace this with a MastodonAPI Library (that i have not finished making)
|
||||||
suspend fun makePost(
|
suspend fun makePost(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
postContent: String,
|
postContent: String,
|
||||||
|
@ -29,5 +124,6 @@ suspend fun makePost(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send a ntfy message
|
||||||
suspend fun ntfyMsg() {
|
suspend fun ntfyMsg() {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue