Skip to content

Instantly share code, notes, and snippets.

@Benricheson101
Last active September 5, 2023 16:19
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Benricheson101/6a16ff2c1f1c208ac1e17e3f9571e66d to your computer and use it in GitHub Desktop.
Save Benricheson101/6a16ff2c1f1c208ac1e17e3f9571e66d to your computer and use it in GitHub Desktop.
i need help
{
const mods = webpackChunkdiscord_app.push([
[Date.now()],
{},
e => Object.values(e.c),
]);
const provider = mods.find(
m => m?.exports?.Z?.getLanguages && Object.keys(m.exports.Z.Messages).length
).exports.Z._provider;
const strs = mods.find(m => m?.exports?.COMMAND_NICK_SUCCESS);
const getGuilds = mods.find(m => m?.exports?.Z?.getGuildCount).exports.Z
.getGuilds;
const getMutableGuildChannelsForGuild = mods.find(
m => m?.exports?.Z?.getMutableGuildChannelsForGuild
).exports.Z.getMutableGuildChannelsForGuild;
const defaultStrs = provider._context.defaultMessages;
let newDefaultStrs = {...defaultStrs};
let newStrs = {...strs.exports};
const transform = text => {
const gte200 = String.fromCodePoint(0x1fac2);
const gte50 = String.fromCodePoint(0x1f496);
const gte10 = String.fromCodePoint(0x2728);
const gte5 = String.fromCodePoint(0x1f97a);
const gte1 = String.fromCodePoint(0x002c);
const zero = String.fromCodePoint(0x2764);
const sep = String.fromCodePoint(0x1f449, 0x1f448);
const bottom = text => {
let out = '';
let chr = text.charCodeAt(0);
if (chr === 0) {
out += zero;
} else {
while (chr) {
if (chr >= 200) {
out += gte200;
chr -= 200;
} else if (chr >= 50) {
out += gte50;
chr -= 50;
} else if (chr >= 10) {
out += gte10;
chr -= 10;
} else if (chr >= 5) {
out += gte5;
chr -= 5;
} else if (chr >= 1) {
out += gte1;
chr -= 1;
} else {
break;
}
}
out += sep;
}
return out;
};
const into = (str, f) => {
let out = '';
let level = 0;
const chars = str.split('');
for (let i = 0; i < chars.length; i++) {
switch (chars[i]) {
case '(':
case '{':
out += chars[i];
level++;
break;
case ')':
case '}':
out += chars[i];
level--;
break;
default: {
if (level == 0) {
out += f(chars[i]);
} else {
out += chars[i];
}
break;
}
}
}
return out.trim();
};
return into(text, bottom);
};
newStrs = Object.fromEntries(
Object.entries(newStrs).map(([name, str]) =>
typeof str === 'string' ? [name, transform(str)] : [name, str]
)
);
newDefaultStrs = Object.fromEntries(
Object.entries(newDefaultStrs).map(([name, str]) =>
typeof str === 'string' ? [name, transform(str)] : [name, str]
)
);
provider.refresh({
messages: newStrs,
defaultMessages: newDefaultStrs,
locale: 'en-US',
});
Object.values(getGuilds()).forEach(g => {
g.name = transform(g.name);
channels = getMutableGuildChannelsForGuild(g.id);
Object.values(channels).forEach(c => {
c.name = transform(c.name).replace(/\s+/g, '-');
});
});
}
{
const mods = webpackChunkdiscord_app.push([
[Date.now()],
{},
e => Object.values(e.c),
]);
const provider = mods.find(
m => m?.exports?.Z?.getLanguages && Object.keys(m.exports.Z.Messages).length
).exports.Z._provider;
const strs = mods.find(m => m?.exports?.COMMAND_NICK_SUCCESS);
const getGuilds = mods.find(m => m?.exports?.Z?.getGuildCount).exports.Z
.getGuilds;
const getMutableGuildChannelsForGuild = mods.find(
m => m?.exports?.Z?.getMutableGuildChannelsForGuild
).exports.Z.getMutableGuildChannelsForGuild;
const defaultStrs = provider._context.defaultMessages;
let newDefaultStrs = {...defaultStrs};
let newStrs = {...strs.exports};
const FACE_CHANCE = 40;
const faces = [
'(o´∀`o)',
'(#`ε´)',
'(๑•̀ㅁ•́๑)✧',
'(*≧m≦*)',
'(・`ω´・)',
'UwU',
'OwO',
'>w<',
'。゚( ゚^∀^゚)゚。',
'ヾ(`ε´)ノ',
'(´• ω •`)',
'o(>ω<)o',
'(ノ◕ヮ◕)ノ*:・゚✧',
'(⁀ᗢ⁀)',
'( ̄ε ̄@)',
'( 〃▽〃)',
'(o^ ^o)',
"ヾ(*'▽'*)",
];
const transform = text => {
const intoOWO = str => {
let out = '';
let level = 0;
const chars = str.split('');
for (let i = 0; i < chars.length; i++) {
switch (chars[i]) {
case '(':
case '{':
out += chars[i];
level++;
break;
case ')':
case '}':
out += chars[i];
level--;
break;
case '!': {
out += chars[i];
if (
level !== 0 ||
!(
chars[i - 1] !== '}' &&
chars[i - 2] !== '}' &&
chars[i + 1] !== '{' &&
chars[i + 2] !== '{'
) ||
chars[i + 1] === '!'
) {
break;
}
const face = faces[Math.floor(Math.random() * faces.length)];
out += ' ' + face + ' ';
continue;
}
default: {
if (level == 0) {
out += chars[i].replace(/[rl]/g, 'w').replace(/[RL]/g, 'W');
} else {
out += chars[i];
}
break;
}
}
if (i === chars.length - 1) {
if (Math.floor(Math.random() * 100) < FACE_CHANCE) {
const face = faces[Math.floor(Math.random() * faces.length)];
out += ' ' + face + ' ';
}
}
}
return out.trim();
};
return intoOWO(text);
};
newStrs = Object.fromEntries(
Object.entries(newStrs).map(([name, str]) =>
typeof str === 'string' ? [name, transform(str)] : [name, str]
)
);
newDefaultStrs = Object.fromEntries(
Object.entries(newDefaultStrs).map(([name, str]) =>
typeof str === 'string' ? [name, transform(str)] : [name, str]
)
);
provider.refresh({
messages: newStrs,
defaultMessages: newDefaultStrs,
locale: 'en-US',
});
Object.values(getGuilds()).forEach(g => {
g.name = transform(g.name);
channels = getMutableGuildChannelsForGuild(g.id);
Object.values(channels).forEach(c => {
c.name = transform(c.name).replace(/\s+/g, '-');
});
});
}
@Compwnter
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment