Skip to content

Commit

Permalink
✨ z̴̥̔a̷̠͂ḷ̵̎ġ̴͉o̷̻̐ ̶̢̃d̵̹̊ė̴̘e̸͓͘z̸̙͊ ̸̡͒ǹ̴-
Browse files Browse the repository at this point in the history
  • Loading branch information
asoji committed Aug 12, 2024
1 parent fd3f1ef commit 1c317f2
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 11 deletions.
20 changes: 20 additions & 0 deletions yiski3/src/main/kotlin/one/devos/yiski3/commands/silly/Zalgo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package one.devos.yiski3.commands.silly

import one.devos.yiski3.utils.Zalgo.zalgolize
import org.jetbrains.kotlin.backend.common.bridges.findAllReachableDeclarations
import xyz.artrinix.aviation.command.message.annotations.Greedy
import xyz.artrinix.aviation.command.slash.SlashContext
import xyz.artrinix.aviation.command.slash.annotations.Description
import xyz.artrinix.aviation.command.slash.annotations.SlashCommand
import xyz.artrinix.aviation.entities.Scaffold

class Zalgo : Scaffold {
@SlashCommand(name = "zalgo", description = "f̶̝͘ũ̷͈̬̫̭̅ċ̵̨̈́͘͘k̸̮̍ì̷̛̜̾n̷̬̽͆ ̶̖̉ỳ̴̨͌̐͌i̷̠͝p̷̜̥̅̈̒ĕ̶̯ḙ̸̠͔͂͋̄")
suspend fun zalgo(ctx: SlashContext, @Greedy @Description("What text do you want to zalgoify") input: String) {
ctx.sendEmbed {
setTitle("Zalgo")
addField("Input", input, false)
addField("Result", zalgolize(input), false)
}
}
}
11 changes: 0 additions & 11 deletions yiski3/src/main/kotlin/one/devos/yiski3/utils/uwu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,6 @@ private val words = mapOf(
Pair("stupid", "baka"),
Pair("what", "nani"),
Pair("meow", "nya~"),
Pair("storm", "stworm"), // i apologize for everything here and below for pairs
Pair("aubrey", "aubwee"),
Pair("carter", "cwartwer"),
Pair("jay", "redacted"),
Pair("owlie", "uwulie"),
Pair("stereo", "sterweo"),
Pair("studio", "stwudiwo"),
Pair("cylon", "pwossom mwan"),
Pair("dynamyc", "dwyn"),
Pair("dyn", "dwyn"),
Pair("hunter", "hwuntwer")
)

private val emojis = listOf(
Expand Down
95 changes: 95 additions & 0 deletions yiski3/src/main/kotlin/one/devos/yiski3/utils/zalgo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package one.devos.yiski3.utils

/*
* MIT License
*
* Copyright (c) 2018-2019 Nicholas Sylke
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

// converted to kotlin by asojidev
// orig: https://github.com/nsylke/Zalgo4J/blob/master/src/main/java/me/nsylke/zalgo4j/Zalgo4J.java

import kotlin.random.Random

object Zalgo {
private val ZALGO_UP = charArrayOf(
'̍', '̎', '̄', '̅',
'̿', '̑', '̆', '̐',
'͒', '͗', '͑', '̇',
'̈', '̊', '͂', '̓',
'̈́', '͊', '͋', '͌',
'̃', '̂', '̌', '͐',
'̀', '́', '̋', '̏',
'̒', '̓', '̔', '̽',
'̉', 'ͣ', 'ͤ', 'ͥ',
'ͦ', 'ͧ', 'ͨ', 'ͩ',
'ͪ', 'ͫ', 'ͬ', 'ͭ',
'ͮ', 'ͯ', '̾', '͛',
'͆', '̚'
)

private val ZALGO_MIDDLE = charArrayOf(
'̕', '̛', '̀', '́',
'͘', '̡', '̢', '̧',
'̨', '̴', '̵', '̶',
'͏', '͜', '͝', '͞',
'͟', '͠', '͢', '̸',
'̷', '͡', '҉'
)

private val ZALGO_DOWN = charArrayOf(
'̖', '̗', '̘', '̙',
'̜', '̝', '̞', '̟',
'̠', '̤', '̥', '̦',
'̩', '̪', '̫', '̬',
'̭', '̮', '̯', '̰',
'̱', '̲', '̳', '̹',
'̺', '̻', '̼', 'ͅ',
'͇', '͈', '͉', '͍',
'͎', '͓', '͔', '͕',
'͖', '͙', '͚', '̣'
)

fun zalgolize(text: String): String {
val builder = StringBuilder()
val random: Random = Random

for (i in 0 until text.length) {
var temp = text[i].toString()

for (j in 0 until (random.nextInt(8) / 2 + 1)) {
temp += ZALGO_UP[random.nextInt(ZALGO_UP.size)]
}

for (j in 0 until (random.nextInt(6) / 2)) {
temp += ZALGO_MIDDLE[random.nextInt(ZALGO_MIDDLE.size)]
}

for (j in 0 until (random.nextInt(8) / 2 + 1)) {
temp += ZALGO_DOWN[random.nextInt(ZALGO_DOWN.size)]
}

builder.append(temp)
}

return builder.toString()
}
}

0 comments on commit 1c317f2

Please sign in to comment.