add zero-width space

master
Chloe Fontenot 🏳️‍⚧️ 2023-04-09 09:20:06 +07:00
parent 0d7c7b6647
commit 2745467dbb
1 changed files with 42 additions and 41 deletions

@ -48,7 +48,7 @@ module.exports = {
//await interaction.reply('Error: String is too big. Resultant output would be too big to send to Discord. (the output length was ' + (output.length + testLength.length) + " characters.)");
let replyString = "output length was " + (output.length) + " characters.";
let filePath = writeFile(output);
await interaction.reply({content:replyString, files: [filePath] });
await interaction.reply({ content: replyString, files: [filePath] });
fs.unlinkSync(filePath); // Delete file once we're done with it
} else {
await interaction.reply(codeBlock("", output) + testLength);
@ -60,7 +60,7 @@ module.exports = {
function writeFile(content) {
//console.log(content);
console.log("Attempting to write string to file...");
let filename = Date.now()+'.txt';
let filename = Date.now() + '.txt';
console.log(filename);
var filePath = path.join(__dirname, '..', filename);
console.log(filePath);
@ -69,7 +69,7 @@ function writeFile(content) {
console.error(err);
}
});
return filePath;
return filePath;
}
function design1(input) {
@ -179,24 +179,24 @@ function design4(input) {
for (i = 0; i <= 2 * radius; i++) {
lineHasInput = false;
if (Math.trunc(i) != mid) {
// for vertical movement
for (j = 0; j <= 2 * radius; j++) {
dist = Math.sqrt(
((i - radius) * (i - radius) * 4) + // (* 4) accounts for the offset between lines
(j - radius) * (j - radius)
);
//console.log(i, j, radius, dist);
// dist should be in the range (radius - 0.5)
// and (radius + 0.5) to print stars(*)
if (dist > radius - 1 && dist < radius + 1) { //&& dist > radius - 1
lineHasInput = true;
outputLine += "​·"; //zero-width space
} else {
outputLine += " ";
}
// for vertical movement
for (j = 0; j <= 2 * radius; j++) {
dist = Math.sqrt(
((i - radius) * (i - radius) * 4) + // (* 4) accounts for the offset between lines
(j - radius) * (j - radius)
);
//console.log(i, j, radius, dist);
// dist should be in the range (radius - 0.5)
// and (radius + 0.5) to print stars(*)
if (dist > radius - 1 && dist < radius + 1) { //&& dist > radius - 1
lineHasInput = true;
outputLine += "​·"; //zero-width space
} else {
outputLine += " ";
}
}
} else {
lineHasInput = true;
outputLine += "​·" + space + input + space + spaceOffset + "·"; //zero-width space
@ -214,11 +214,12 @@ var charIterateState;
function charIterate(input) {
if (charIterateState == undefined) {
charIterateState = 0;
}
if (charIterateState < (input.length - 1)) {
charIterateState++;
} else {
charIterateState = 0;
if (charIterateState < (input.length - 1)) {
charIterateState++;
} else {
charIterateState = 0;
}
}
console.log(charIterateState, input.charAt(charIterateState));
return charIterateState;
@ -248,24 +249,24 @@ function design5(input) {
for (i = 0; i <= 2 * radius; i++) {
lineHasInput = false;
if (Math.trunc(i) != mid) {
// for vertical movement
for (j = 0; j <= 2 * radius; j++) {
dist = Math.sqrt(
((i - radius) * (i - radius) * 4) + // (* 4) accounts for the offset between lines
(j - radius) * (j - radius)
);
//console.log(i, j, radius, dist);
// dist should be in the range (radius - 0.5)
// and (radius + 0.5) to print stars(*)
if (dist > radius - 1 && dist < radius + 1) { //&& dist > radius - 1
lineHasInput = true;
outputLine += ""+ input.charAt(charIterate(input)); //zero-width space
} else {
outputLine += " ";
}
// for vertical movement
for (j = 0; j <= 2 * radius; j++) {
dist = Math.sqrt(
((i - radius) * (i - radius) * 4) + // (* 4) accounts for the offset between lines
(j - radius) * (j - radius)
);
//console.log(i, j, radius, dist);
// dist should be in the range (radius - 0.5)
// and (radius + 0.5) to print stars(*)
if (dist > radius - 1 && dist < radius + 1) { //&& dist > radius - 1
lineHasInput = true;
outputLine += "" + input.charAt(charIterate(input)); //zero-width space
} else {
outputLine += " ";
}
}
} else {
lineHasInput = true;
outputLine += input.charAt(charIterate(input)) + space + input + space + spaceOffset + input.charAt(charIterate(input));