Octanite-Bot/commands/weebify.js

56 lines
939 B
JavaScript
Raw Normal View History

2019-02-12 00:07:50 +01:00
function weebify(text) {
const dict = {
a : "卂",
b : "乃",
c : "匚",
d : "刀",
e : "乇",
f : "下",
g : "厶",
h : "卄",
i : "工",
j : "丁",
k : "长",
l : "乚",
m : "从",
n : "𠘨",
o : "口",
p : "尸",
q : "㔿",
r : "尺",
s : "丂",
t : "丅",
u : "凵",
v : "リ",
w : "山",
x : "乂",
y : "丫",
z : "乙"
};
const text_array = text.toLowerCase().split("");
return text_array.map((character) =>
dict[character] ? dict[character] : character)
.join("");
}
module.exports = () => (ctx) => {
const message = ctx.message.text.replace(/^[^ ]+/, "");
if (message) {
return weebify(message);
} else {
2024-01-24 20:08:35 +01:00
if (ctx.message.reply_to_message && !ctx.message.reply_to_message.is_topic_message)
2019-02-12 00:07:50 +01:00
return weebify(ctx.message.reply_to_message.text);
else
2019-02-12 00:15:02 +01:00
return "Need text to weebify. Send /weebify text or reply to a "
+ "message with /weebify";
2019-02-12 00:07:50 +01:00
}
};