Compare commits

...
3 Commits
Author SHA1 Message Date
Parker2991 6d43ecc249 v7.0.1, build: 2055 2025-02-11 06:41:30 -06:00
Parker2991 7eadb4eccd v7.0.0, build: 2050 2025-02-05 10:11:22 -06:00
Parker2991 59ab5966c4 v7.0.0-beta, build: 2030 2025-02-03 09:15:29 -06:00
25 changed files with 923 additions and 685 deletions
+55
View File
@@ -0,0 +1,55 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: "kick",
description: "kick a player from the server",
aliases: [
],
trustLevel: 2,
usages: [
"invalidstring",
"item"
]
},
execute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
if (!args && !args[0] && !args[1] && !args[2]) return;
switch (args[1]?.toLowerCase()) {
case "invalidstring":
bot.exploits.crashes.invalidString(args[2]);
bot.chat.message(`crashing ${args[2]}`)
break;
case "item":
bot.exploits.kicks.item(args[2]);
bot.chat.message(`kicking ${args[2]}`)
break;
default:
throw new CommandError('invalid argument')
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const config = context.config;
if (!args && !args[0] && !args[1] && !args[2]) return;
switch (args[0]?.toLowerCase()) {
case "invalidstring":
bot.exploits.crashes.invalidString(args[1]);
bot?.discord?.message?.reply(`crashing ${args[1]}`)
break;
case "item":
bot.exploits.kicks.item(args[1]);
bot?.discord?.message?.reply(`kicking ${args[1]}`)
break;
default:
throw new CommandError('invalid argument')
}
}
}
+7 -1
View File
@@ -15,4 +15,10 @@ module.exports = {
bot._client.end();
bot.chat.message('reconnecting')
},
}
discordExecute (context) {
const bot = context.bot;
bot._client.end();
bot?.discord?.message?.reply('reconnecting');
}
}
+13 -20
View File
@@ -24,31 +24,24 @@ module.exports = {
try {
if (source.sources.console) {
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
} else if (bot.options.useChat || bot.options.isSavage) {
} else if (bot.options.mode === "savageFriends") {
bot.chat.message(bot.getMessageAsPrismarine({ text: util.inspect(eval(script), { stylize }).substring(0, 32700) })?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw(`@a[name="${source.player.profile.name}"]`, new MessageBuilder()
.setText(util.inspect(eval(script), { stylize }).substring(0, 32700))
)
/* bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
{
text: util.inspect(eval(script), { stylize }).substring(0, 32700),
hoverEvent: {
action: 'show_text',
contents: [{
text: 'click here to copy the code input',
color: 'gray'
}]
},
clickEvent: {
action: 'copy_to_clipboard',
value: `${script}`
}
}
]);*/
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`
});
}
} catch (e) {
throw new CommandError(e.toString())
}
},
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
try {
bot?.discord?.message?.reply(`\`\`\`js\n${util.inspect(eval(args.join(' '))).toString().substring(0, 1980)}\`\`\``);
} catch (e) {
throw new CommandError(e.toString());
}
}
}
+2 -1
View File
@@ -19,6 +19,7 @@ module.exports = {
discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
bot.chat.send(args.join(' '));
bot.discord.message.channel.send(args.join(' '));
// bot.chat.send(args.join(' '));
}
}
+98 -93
View File
@@ -1,3 +1,74 @@
function commandListComponent (commands, config, public, trusted, admin, owner, Console) {
switch (commands.data.trustLevel) {
case 0:
public.push({
text: commands.data.name + ' ',
color: config.colors.help.public
});
break;
case 1:
trusted.push({
text: commands.data.name + ' ',
color: config.colors.help.trusted
});
break;
case 2:
admin.push({
text: commands.data.name + ' ',
color: config.colors.help.admin
});
break;
case 3:
owner.push({
text: commands.data.name + ' ',
color: config.colors.help.owner
});
break;
case 4:
Console.push({
text: commands.data.name + ' ',
color: config.colors.help.console
});
break;
default:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
}
function infoComponents (commands, config, infoComponent, usagesComponent) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: `${usages}`, color: config.colors.commands.secondary },
]
});
usagesComponent.push('\n');
};
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Usages", color: config.colors.commands.primary },
]
});
infoComponent.push(usagesComponent);
}
module.exports = {
data: {
name: "help",
@@ -26,7 +97,7 @@ module.exports = {
let admin = [];
let owner = [];
let Console = [];
const { MessageBuilder } = require('prismarine-chat')(bot._client.version);
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
@@ -36,72 +107,12 @@ module.exports = {
]
});
for (const commands of bot.commandManager.commandlist) {
switch (commands.data.trustLevel) {
case 0:
public.push({
text: commands.data.name + ' ',
color: config.colors.help.public
});
break;
case 1:
trusted.push({
text: commands.data.name + ' ',
color: config.colors.help.trusted
});
break;
case 2:
admin.push({
text: commands.data.name + ' ',
color: config.colors.help.admin
});
break;
case 3:
owner.push({
text: commands.data.name + ' ',
color: config.colors.help.owner
});
break;
case 4:
Console.push({
text: commands.data.name + ' ',
color: config.colors.help.console
});
break;
default:
bot.chat.message(`fuck you ${commands.data.name} has a invalid trust level`);
};
commandListComponent(commands, config, public, trusted, admin, owner, Console);
if (args[0] === commands.data.name) {
for (const usages of commands.data.usages) {
usagesComponent.push({
translate: "%s%s %s",
with: [
{ text: `${config.prefixes[0]}`, color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: `${usages}`, color: config.colors.commands.secondary },
]
})
usagesComponent.push('\n');
}
infoComponent.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s:\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Name", color: config.colors.commands.primary },
{ text: `${commands.data.name}`, color: config.colors.commands.secondary },
{ text: "Aliases", color: config.colors.commands.primary },
{ text: `${commands.data.aliases.toString().replaceAll(',',' ')}`, color: config.colors.commands.secondary },
{ text: "Description", color: config.colors.commands.primary },
{ text: `${commands.data.description}`, color: config.colors.commands.secondary },
{ text: "Trust Level", color: config.colors.commands.primary },
{ text: `${commands.data.trustLevel}`, color: config.colors.integer },
{ text: "Usages", color: config.colors.commands.primary },
]
});
infoComponent.push(usagesComponent);
infoComponents(commands, config, infoComponent, usagesComponent);
bot.tellraw(`@a`, infoComponent);
return;
}
}
@@ -115,48 +126,42 @@ module.exports = {
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const EmbedBuilder = context.EmbedBuilder
const fixansi = context.fixansi;
const args = context.arguments;
let infoComponent = [];
let usagesComponent = [];
let public = [];
let trusted = [];
let admin = [];
let owner = [];
let Console = [];
let component = [];
component.push({
translate: "%s: (%s) \u203a\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Commands", color: config.colors.commands.secondary },
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
]
});
for (const commands of bot.commandManager.commandlist) {
switch (commands.data.trustLevel) {
case 0:
public.push(commands.data.name);
break;
case 1:
trusted.push(commands.data.name);
break;
case 2:
admin.push(commands.data.name);
break;
case 3:
owner.push(commands.data.name);
break;
case 4:
Console.push(commands.data.name);
break;
commandListComponent(commands, config, public, trusted, admin, owner, Console);
if (args[0] === commands.data.name) {
infoComponents(commands, config, infoComponent, usagesComponent);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
return;
}
}
let commandsEmbed = new EmbedBuilder()
.setColor(config.colors.discord.embed)
.setTitle(`${this.data.name} Command`)
.setDescription(`Commands (${bot.commandManager.commandlist.length})`)
.addFields(
{ name: "Public", value: public.toString().replaceAll(',',' '), inline: false },
{ name: "Trusted", value: trusted.toString().replaceAll(',',' '), inline: false },
{ name: "Admin", value: admin.toString().replaceAll(',',' '), inline: false },
{ name: "Owner", value: owner.toString().replaceAll(',',' '), inline: false },
{ name: "Console", value: Console.toString().replaceAll(',',' '), inline: false },
);
bot.discord.message.reply({ embeds: [ commandsEmbed ] });
component.push(public);
component.push(trusted);
component.push(admin);
component.push(owner);
component.push(Console);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
}
+349 -329
View File
@@ -17,6 +17,336 @@ function format(seconds) {
pad(`${seconds} Seconds`))
}
function componentPush (bot, args, config, discordClient, source, component) {
switch (args[0]?.toLowerCase()) {
case "about":
component.push({
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
color: `${config.colors.commands.primary}`,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{ text: "click here to view bots source code", color: `${config.colors.commands.primary}` }
]
},
clickEvent: {
action: "open_url",
value: `${botInfo.buildstring.url}`
}
})
break;
case "config":
if (bot.options.isKaboom) {
mode = "Kaboom";
} if (bot.options.useChat && bot.options.isKaboom) {
mode = "Kaboom/Coreless";
} if (bot.options.isSavage) {
mode = "Savage";
} if (bot.options.isCreayun) {
mode = "Creayun";
}
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "client":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.integer },
]
})
break;
case "discord":
if (!config.discord.enabled || discordClient.user === null) {
throw new CommandError('Token is incorrect or discord isnt enabled!')
} else {
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
]
})
}
break;
case "options":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${bot.options.mode}`, color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "contributors":
case "credits":
component.push({
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Parker", color: "dark_red" },
{ text: "2991", color: "black" },
{ text: "Owner" },
{ text: "Contributors" },
{ text: "_ChipMC_", color: "dark_blue" },
{ text: "chayapak", color: "yellow" },
{ text: "_yfd", color: "light_purple" },
{ text: "aaa", color: "gold" },
{ text: "Morgan", color: "green" },
{ text: "Ankan", color: "dark_green" },
{ text: "TurtleKid", color: "green" },
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
]
})
break;
case "discord":
component.push({
text: `the discord server invite is ${config.discord.invite}`,
color: config.colors.commands.primary,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: "click here to join the discord server!",
color: config.colors.commands.secondary,
}
]
},
clickEvent: {
action: "open_url",
value: `${config.discord.invite}`
}
})
break;
case "loaded":
component.push({
translate: "%s %s\n%s %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
{ text: "Commands", color: config.colors.commands.primary },
{ text: `${bot.modules.length}`, color: config.colors.integer },
{ text: "Modules", color: config.colors.commands.primary }
]
});
break;
case "usages":
case "usage":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
})
break;
case "server":
component.push({
translate: "%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "uptimes":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "server":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "server":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Hostname", color: config.colors.commands.primary },
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
{ text: "User", color: config.colors.commands.primary },
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
{ text: "Working Directory", color: config.colors.commands.primary },
{ text: `${require.main.path}`, color: config.colors.commands.secondary },
{ text: "Arch", color: config.colors.commands.primary },
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
{ text: "OS", color: config.colors.commands.primary },
{ text: `${os.platform}`, color: config.colors.commands.secondary },
{ text: "OS Version", color: config.colors.commands.primary },
{ text: `${os.version()}`, color: config.colors.commands.secondary },
{ text: "Kernel Version", color: config.colors.commands.primary },
{ text: `${os.release()}`, color: config.colors.commands.secondary },
{ text: "CPU", color: config.colors.commands.primary },
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
{ text: "CPU cores", color: config.colors.commands.primary },
{ text: `${os.cpus().length}`, color: config.colors.integer },
{ text: "Node Version", color: config.colors.commands.primary },
{ text: `${process.version}`, color: config.colors.commands.secondary },
{ text: "NPM Version", color: config.colors.commands.primary },
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
]
})
break;
case "version":
case "ver":
if (botInfo.buildstring.codename.length > 0) {
component.push({
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
botInfo.buildstring.codename,
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
});
} else {
component.push({
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
});
}
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
}
module.exports = {
data: {
name: 'info',
@@ -44,338 +374,28 @@ module.exports = {
const discordClient = context.discordClient;
const source = context.source;
let component = [];
switch (args[0]?.toLowerCase()) {
case "about":
component.push({
text: `FNFBoyfriendBot is a kaboom bot created by Parker2991\nThe source code and changelog can be found here ${botInfo.buildstring.url}`,
color: `${config.colors.commands.primary}`,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{ text: "click here to view bots source code", color: `${config.colors.commands.primary}` }
]
},
clickEvent: {
action: "open_url",
value: `${botInfo.buildstring.url}`
}
})
break;
case "config":
if (bot.options.isKaboom) {
mode = "Kaboom";
} if (bot.options.useChat && bot.options.isKaboom) {
mode = "Kaboom/Coreless";
} if (bot.options.isSavage) {
mode = "Savage";
} if (bot.options.isCreayun) {
mode = "Creayun";
}
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "client":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.integer },
]
})
break;
case "discord":
if (!config.discord.enabled || discordClient.user === null) {
throw new CommandError('Token is incorrect or discord isnt enabled!')
} else {
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary },
]
})
}
break;
case "options":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${mode}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s:%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server", color: config.colors.commands.primary },
{ text: `${bot.options.host}`, color: config.colors.commands.secondary },
{ text: `${bot.options.port}`, color: config.colors.integer },
{ text: "Server Name", color: config.colors.commands.primary },
{ text: `${bot.options.serverName}`, color: config.colors.commands.secondary },
{ text: "Minecraft Username", color: config.colors.commands.primary },
{ text: `${bot.options.username}`, color: config.colors.commands.secondary },
{ text: "Version", color: config.colors.commands.primary },
{ text: `${bot.options.version}`, color: config.colors.commands.secondary },
{ text: "Discord Username", color: config.colors.commands.primary },
{ text: `${discordClient.user?.tag}`, color: config.colors.commands.secondary },
{ text: "Discord Channel", color: config.colors.commands.primary },
{ text: `${bot.discord.channel?.name}`, color: config.colors.commands.secondary },
{ text: "Server Count", color: config.colors.commands.primary },
{ text: `${bot.bots.length}`, color: config.colors.integer },
{ text: "Prefixes", color: config.colors.commands.primary },
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary },
{ text: "Mode", color: config.colors.commands.primary },
{ text: `${mode}`, color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "contributors":
case "credits":
component.push({
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s %s\n%s\n%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Parker", color: "dark_red" },
{ text: "2991", color: "black" },
{ text: "Owner" },
{ text: "Contributors" },
{ text: "_ChipMC_", color: "dark_blue" },
{ text: "chayapak", color: "yellow" },
{ text: "_yfd", color: "light_purple" },
{ text: "aaa", color: "gold" },
{ text: "Morgan", color: "green" },
{ text: "Ankan", color: "dark_green" },
{ text: "TurtleKid", color: "green" },
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
]
})
break;
case "discord":
component.push({
text: `the discord server invite is ${config.discord.invite}`,
color: config.colors.commands.primary,
translate: "",
hoverEvent: {
action: "show_text",
value: [
{
text: "click here to join the discord server!",
color: config.colors.commands.secondary,
}
]
},
clickEvent: {
action: "open_url",
value: `${config.discord.invite}`
}
})
break;
case "loaded":
component.push({
translate: "%s %s\n%s %s",
color: config.colors.commands.tertiary,
with: [
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
{ text: "Commands", color: config.colors.commands.primary },
{ text: `${bot.modules.length}`, color: config.colors.integer },
{ text: "Modules", color: config.colors.commands.primary }
]
});
break;
case "usages":
case "usage":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
})
break;
case "server":
component.push({
translate: "%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
})
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "uptimes":
switch (args.slice(1).join(' ')?.toLowerCase()) {
case "bot":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "server":
component.push({
translate: "%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
case "all":
component.push({
translate: "%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Bot Uptime", color: config.colors.commands.primary },
{ text: `${format(process.uptime())}`, color: config.colors.commands.secondary },
{ text: "Server Uptime", color: config.colors.commands.primary },
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary },
]
})
break;
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
break;
case "server":
component.push({
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{ text: "Hostname", color: config.colors.commands.primary },
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
{ text: "User", color: config.colors.commands.primary },
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary },
{ text: "Working Directory", color: config.colors.commands.primary },
{ text: `${require.main.path}`, color: config.colors.commands.secondary },
{ text: "Arch", color: config.colors.commands.primary },
{ text: `${os.arch()}`, color: config.colors.commands.secondary },
{ text: "OS", color: config.colors.commands.primary },
{ text: `${os.platform}`, color: config.colors.commands.secondary },
{ text: "OS Version", color: config.colors.commands.primary },
{ text: `${os.version()}`, color: config.colors.commands.secondary },
{ text: "Kernel Version", color: config.colors.commands.primary },
{ text: `${os.release()}`, color: config.colors.commands.secondary },
{ text: "CPU", color: config.colors.commands.primary },
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary },
{ text: "CPU cores", color: config.colors.commands.primary },
{ text: `${os.cpus().length}`, color: config.colors.integer },
{ text: "Node Version", color: config.colors.commands.primary },
{ text: `${process.version}`, color: config.colors.commands.secondary },
{ text: "NPM Version", color: config.colors.commands.primary },
{ text: `${execSync('npm -v').toString().replaceAll('\n', '')}`, color: config.colors.commands.secondary },
]
})
break;
case "version":
case "ver":
if (botInfo.buildstring.codename.length > 0) {
component.push({
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
botInfo.buildstring.codename,
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
});
} else {
component.push({
translate: "%s %s %s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
color: config.colors.commands.tertiary,
with: [
{ text: "Friday Night Funkin", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: `${botInfo.buildstring.version}`, color: config.colors.integer },
{ text: "Build", color: config.colors.commands.primary },
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer },
{ text: "Repo Build", color: config.colors.commands.primary },
{ text: `${execSync('git rev-list --count --all').toString().replaceAll('\n','')}`, color: config.colors.integer },
{ text: "Version Release Date", color: config.colors.commands.primary },
{ text: `${new Date(execSync('git log -1 --format=%ci').toString()).toLocaleString("en-US", {timeZone: "America/CHICAGO"})}`, color: config.colors.commands.secondary },
{ text: "Commit", color: config.colors.commands.primary },
{ text: `${execSync("git rev-parse HEAD").toString().substring(0, 10)}`, color: config.colors.commands.secondary },
{ text: "11/22/22", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleDateString("en-US",{timeZone:"America/CHICAGO"})}`, color: config.colors.commands.secondary },
]
});
}
break;
default:
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
}
if (bot.options.isSavage) {
componentPush(bot, args, config, discordClient, source, component);
if (bot.options.mode === "savageFriends") {
bot.chat.message(bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&'));
} else {
bot.tellraw(`@a`, component);
}
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const EmbedBuilder = context.EmbedBuilder
const fixansi = context.fixansi;
const args = context.arguments;
const discordClient = context.discordClient;
const source = context.source;
let component = [];
componentPush(bot, args, config, discordClient, source, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
}
}
+39 -1
View File
@@ -1,4 +1,5 @@
const CommandError = require('../../util/command_error');
module.exports = {
data: {
name: "list",
@@ -15,7 +16,7 @@ module.exports = {
execute (context) {
const bot = context.bot;
const args = context.arguments;
const confix = context.config;
const config = context.config;
let component = [];
let infoComponent = [];
@@ -47,5 +48,42 @@ module.exports = {
}
component.pop();
bot.tellraw("@a", component);
},
discordExecute (context) {
const bot = context.bot;
const config = context.config;
const fixansi = context.fixansi;
let component = [];
let playerCount = [];
playerCount.push({
translate: "%s: (%s)\n",
color: config.colors.commands.tertiary,
with: [
{ text: "Players", color: config.colors.commands.primary },
{ text: `${bot.players.length}`, color: config.colors.integer },
]
});
component.push(playerCount);
for (const player of bot.players) {
component.push({
translate: "%s \u203a %s [%s: %s]",
color: config.colors.commands.tertiary,
with: [
player.displayName ?? player.profile.name,
{ text: `${player.uuid}`, color: config.colors.commands.primary },
{ text: "Latency", color: config.colors.commands.primary },
{ text: `${player.latency}`, color: config.colors.integer }
]
});
component.push("\n");
};
component.pop();
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``);
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ module.exports = {
}
for (const eachBot of bot.bots) {
if (eachBot.options.isSavage === true || eachBot.options.isCreayun === true) {
if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
} else {
eachBot.tellraw("@a", component)
+90 -8
View File
@@ -1,19 +1,101 @@
const CommandError = require('../../util/command_error');
const CommandError = require('../../util/command_error')
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
const { request } = require('undici');
module.exports = {
data: {
name: "urban",
name: 'urban',
description: 'urban dictionary',
aliases: [
"urbandictionary"
'urbandictionary'
],
description: "look up definitions on urban dictionary",
trustLevel: 0,
usages: [
"<definition>"
]
"<definition>",
],
},
async execute (context) {
const source = context.source
const args = context.arguments
const bot = context.bot
const prefix = [
{ text: '[', color: 'dark_gray' },
{ text: 'Urban', color: '#B72A00' },
{ text: '] ', color: 'dark_gray'}
]
let component = [];
let term = `${args.join(' ')}`
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
if (!list.length) {
bot.tellraw('@a', { text: 'No results found', color: 'dark_red' });
}
for (definitions of list) {
component.push(prefix, [
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
underlined: false,
italic: false,
translate: "",
hoverEvent: {
action:"show_text",
value: [
{
text: `Example \u203a \n ${definitions.example.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Word \u203a ${definitions.word.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray',
},
{
text: `Author \u203a ${definitions.author.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `written on \u203a ${definitions.written_on.replaceAll('\r', '').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`,
color: 'gray'
},
{
text: `Rating \u203a Thumbs-Up ${definitions.thumbs_up} / Thumbs-Down ${definitions.thumbs_down}`,
color: 'gray'
}
]
},
clickEvent: {
action: 'open_url',
value: `${definitions.permalink}`
}
},
])
}
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
let component = [];
let term = `${args.join(' ')}`
const query = new URLSearchParams({ term });
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
const { list } = await dictResult.body.json();
try {
for (definitions of list) {
component.push([
{
text: `${definitions.definition.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77').substring(0, 1950)}\n`,
color: 'gray',
}
]);
}
bot.discord.message.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}
}
+71 -48
View File
@@ -1,6 +1,56 @@
const CommandError = require('../../util/command_error');
const { request } = require('undici');
function components (config, info, component) {
component.push({
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{
translate: "%s: %s, %s %s",
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
]
},
{ text: "Coords", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{
translate: "%s: %s (%s), %s (%s)",
with: [
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary }
]
},
{
translate: "%s: %s (%s, %s), %s (%s, %s)",
with: [
{ text: "Wind Speed", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.wind_kph)}`, color: config.colors.integer },
{ text: "kph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.wind_mph)}`, color: config.colors.integer },
{ text: "mph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary }
]
},
{ text: "Condition", color: config.colors.commands.primary },
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
{ text: "Humidity", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
]
});
}
module.exports = {
data: {
name: "weather",
@@ -22,57 +72,30 @@ module.exports = {
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
component.push({
translate: "%s\n%s: %s, %s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s",
color: config.colors.commands.tertiary,
with: [
{
translate: "%s: %s, %s %s",
with: [
{ text: "Location", color: config.colors.commands.primary },
{ text: `${info.location.name}`, color: config.colors.commands.secondary },
{ text: `${info.location.region}`, color: config.colors.commands.secondary },
{ text: `${info.location.country}`, color: config.colors.commands.secondary },
]
},
{ text: "Coords", color: config.colors.commands.primary },
{ text: `${info.location.lat}`, color: config.colors.integer },
{ text: `${info.location.lon}`, color: config.colors.integer },
{ text: "Time", color: config.colors.commands.primary },
{ text: `${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`, color: config.colors.commands.secondary },
{ text: `${info.location.tz_id}`, color: config.colors.commands.secondary },
{
translate: "%s: %s (%s), %s (%s)",
with: [
{ text: "Temp", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.temp_c)}`, color: config.colors.integer },
{ text: "\u00b0C", color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.temp_f)}`, color: config.colors.integer },
{ text: "\u00b0F", color: config.colors.commands.secondary }
]
},
{
translate: "%s: %s (%s, %s), %s (%s, %s)",
with: [
{ text: "Wind Speed", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.wind_kph)}`, color: config.colors.integer },
{ text: "kph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary },
{ text: `${Math.floor(info.current.wind_mph)}`, color: config.colors.integer },
{ text: "mph", color: config.colors.commands.secondary },
{ text: `${info.current.wind_dir}`, color: config.colors.commands.secondary }
]
},
{ text: "Condition", color: config.colors.commands.primary },
{ text: `${info.current.condition.text}`, color: config.colors.commands.secondary },
{ text: "Humidity", color: config.colors.commands.primary },
{ text: `${Math.floor(info.current.humidity)}`, color: config.colors.integer }
]
});
components(config, info, component);
bot.tellraw("@a", component);
} catch (e) {
bot.chat.message(e.toString());
}
},
async discordExecute (context) {
const config = context.config;
const bot = context.bot;
const fixansi = context.fixansi;
const args = context.arguments;
let component = [];
try {
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
const info = await url.body.json();
components(config, info, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
bot?.discord?.message?.reply(e.toString());
}
}
}
}
+56 -6
View File
@@ -1,16 +1,66 @@
const wiki = require('wikipedia');
const CommandError = require('../../util/command_error');
async function components (config, summary, component) {
component.push({ text: summary, color: config.colors.commands.primary })
}
module.exports = {
data: {
name: "wiki",
name: 'wiki',
description: 'wikipedia',
trustLevel: 0,
aliases: [
"wikipedia"
'wikipedia'
],
description: "look up articles on wikipedia",
usages: [
usages:[
"<article>"
],
trustLevel: 0
},
async execute (context) {
const source = context.source;
const args = context.arguments;
const bot = context.bot;
const config = context.config;
let component = [];
try {
const page = await wiki.page(args.join(' '));
const summary = await page.intro();
components(config, summary, component);
bot.tellraw("@a", component);
} catch (e) {
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot.chat.message('&cArticle not found!');
} else {
bot.tellraw(`@a`, `${e.toString()}`)
}
}
},
async discordExecute (context) {
const bot = context.bot;
const args = context.arguments;
const fixansi = context.fixansi;
let component = [];
try {
const page = await wiki.page(args.join(' '));
const summary = await page.intro();
components(config, summary, component);
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
} catch (e) {
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
bot?.discord?.message?.reply('Article not found!');
} else {
bot?.discord?.message?.reply(`${e.toString()}`);
}
}
}
}
}
+4 -3
View File
@@ -1,7 +1,8 @@
{
"buildstring": {
"build": "2010",
"codename": "§aGame §aTheory",
"version": "v7.0.0-alpha"
"build": "2055",
"codename": "",
"version": "v7.0.1",
"url":"https://code.chipmunk.land/Parker2991/FridayNightFunkinBoyfriendBot"
}
}
+32 -1
View File
@@ -6,6 +6,7 @@ const path = require('path');
const { Client, GatewayIntentBits } = require('discord.js');
const { MessageContent, GuildMessages, Guilds } = GatewayIntentBits;
const discordClient = new Client({ intents: [Guilds, GuildMessages, MessageContent] });
const CommandSource = require('./util/command_source');
console.log('Starting FNFBoyfriendBot');
process.stdout.write('\x1b]2;Starting FNFBoyfriendBot please wait,.....\x1b\x5c');
@@ -32,10 +33,40 @@ const rl = readline.createInterface({
if (config.discord.enabled) discordClient.login(config.discord.token);
const bots = [];
let bot;
for (const options of config.bots) {
const bot = new createBot(options, config);
bot = new createBot(options, config);
bots.push(bot);
bot.bots = bots;
require('./util/loadModules')(bot, options, config, discordClient);
bot.console.readlineInterface(rl);
}
discordClient.on('messageCreate', (message) => {
try {
if (message.author.id === bot.discord.client.user.id) return;
const ChatMessage = require('prismarine-chat')('1.20.2');
bot.getMessageAsPrismarine = (message) => {
return new ChatMessage(message);
}
config.prefixes.map((prefix) => {
if (message.content.startsWith(prefix)) {
const source = new CommandSource({
profile: {
name: `${message?.member.nickname || message?.author.displayName}`
}
}, {
discord: true,
console: false
}, false, message);
bot.commandManager.executeString(source, message.content.substring(prefix.length));
return;
}
});
} catch (e) {
console.log(e.stack);
}
});
+1 -1
View File
@@ -4,7 +4,7 @@ function inject (context) {
const options = context.options;
const info = require('../data/info.json');
bot.on("packet.login", (data) => {
if (bot.options.isCreayun === true) return
if (bot.options.mode === "creayun") return
if (new Date().getDay() === 5) {
bot.chat.message('Gettin\' freaky on a friday night!');
} else {
+3 -3
View File
@@ -24,7 +24,7 @@ function inject (context) {
const { start, end } = bot.core.area
if (!pos) return
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (isNaN(pos.x + start.x)) {
bot.chat.command('spawn');
return
@@ -44,7 +44,7 @@ function inject (context) {
const itemPosition = bot.core.itemPosition;
if (!pos) return;
if (bot.options.useChat || bot.options.isCreayun || bot.options.isSavage) return;
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") return;
if (isNaN(pos.x + pos.x)) {
bot.chat.command('spawn');
return
@@ -149,7 +149,7 @@ function inject (context) {
const itemPosition = bot.core.itemPosition;
if (!location) return;
if (bot.options.isCreayun || bot.options.useChat || bot.options.isSavage) {
if (bot.options.mode === "creayun" || bot.options.mode === "savageFriends") {
return
} else {
if (bot.core.usePlacedCommandBlock) {
+1 -2
View File
@@ -19,8 +19,7 @@ function inject (context) {
ratelimit--
}, 1000)
if (ratelimit > 2) {
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, new MessageBuilder().setText("You are using commands too fast!").setColor("dark_red").toJSON())
// bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'You are using commands too fast!', color: 'dark_red'})
} else if (command.split(" ")[0].length === 0) {
} else {
bot.commandManager.executeString(source, command)
+62 -90
View File
@@ -4,6 +4,8 @@ const CommandError = require('../util/command_error.js');
const CommandSource = require('../util/command_source');
const { EmbedBuilder } = require('discord.js');
const fixansi = require('../util/ansi');
const cmdMgrUtil = require('../util/command_manager_util');
async function inject (context) {
const bot = context.bot;
const config = context.config;
@@ -16,100 +18,48 @@ async function inject (context) {
execute (source, commandName, args) {
const command = this.getCommand(commandName.toLowerCase());
try {
if (source?.sources?.discord && !source?.sources?.console) {
if (!command || !command?.execute) {
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`)
.setTitle("Unknown command")
.setDescription(`Unknown command: ${commandName}`)
bot?.discord?.message?.reply({ embeds: [Embed] })
}
} else if (!source?.sources?.discord && !source?.sources?.console) {
if (!command || !command.execute)
if (bot.options.isSavage) {
bot.chat.message(bot.getMessageAsPrismarine({
translate: "%s",
if (!command) {
if (source?.sources?.console) {
bot.console.warn(bot.getMessageAsPrismarine({
translate: "%s%s%s %s",
color: "dark_gray",
with: [
{ translate: "command.unknown.command", color: "red" },
]
})?.toMotd().replaceAll('§','&'));
bot.chat.message(bot.getMessageAsPrismarine({
translate: "%s %s",
color: "dark_gray",
with: [
{ text: "\n" },
{ text: `${commandName}` },
{ translate: "command.context.here", color: "red" }
]
})?.toMotd().replaceAll('§','&'));
})?.toAnsi());
} else {
bot.tellraw("@a", new MessageBuilder()
.setTranslate("%s%s%s %s")
.setColor("dark_gray")
.addWith(new MessageBuilder().setTranslate("command.unknown.command").setColor("red"))
.addWith(new MessageBuilder().setText("\n"))
.addWith(new MessageBuilder().setText(`${commandName}`))
.addWith(new MessageBuilder().setTranslate("command.context.here").setColor("red"))
)
}
} else if (source?.sources?.console && !source?.sources?.discord) {
if (!command || !command.execute)
bot.console.warn(bot.getMessageAsPrismarine({
translate: "%s%s%s %s",
color: "dark_gray",
with: [
{ translate: "command.unknown.command", color: "red" },
{ text: "\n" },
{ text: `${commandName}` },
{ translate: "command.context.here", color: "red" }
]
})?.toAnsi())
};
require('../util/command_manager_util')(bot, command, args, source);
// require('../util/command_manager_arguments')(bot, args, command);
if (!command?.discordExecute && command && source?.sources?.discord) {
throw new CommandError(`${command.data.name} command is not supported in discord!`)
} else if (command?.discordExecute && command && source?.sources?.discord) {
return command.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi })
} else if (!command?.execute && command && !source?.sources?.discord) {
throw new CommandError(`${command.data.name} command is not supported in game!`)
} else if (command?.execute && command && !source?.sources?.discord) {
return command?.execute({ bot, source, arguments: args, config, discordClient });
}
} catch (error) {
console.error(error)
if (source?.sources?.discord && !source?.sources?.console) {
const Embed = new EmbedBuilder()
.setColor(`${config.colors.discord.error}`)
.setTitle(`${command?.data?.name} command`)
.setDescription(`\`\`\`${error}\`\`\``)
bot?.discord?.message?.reply({
embeds: [
Embed
bot.tellraw("@a", {
translate: "%s%s%s %s",
color: "dark_gray",
with: [
{ translate: "command.unknown.command", color: "red" },
{ text: "\n" },
{ text: `${commandName}` },
{ translate: "command.context.here", color: "red" }
]
})
} else if (!source?.sources?.discord && !source?.sources?.console) {
if (error instanceof CommandError) {
if (bot.options.isSavage || bot.options.isCreayun) {
bot.chat.message(`&4${error.message}`)
} else {
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
} else if (error.toString().length < 256) {
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`)
} else {
bot.tellraw("@a", error._message);
}
}
});
}
}
cmdMgrUtil(bot, command, args, source);
return command?.execute({ bot, source, arguments: args, config, discordClient });
} catch (error) {
console.error(error);
if (error instanceof CommandError) {
if (options.mode !== "kaboom") {
bot.chat.message(`&4${error._message}`);
} else {
if (bot.options.isSavage || bot.options.isCreayun) {
bot.chat.message(`${bot.getMessageAsPrismarine({ translate: "command.failed", color: "dark_red" })?.toMotd().replaceAll('§','&')}`)
if (error.toString().length > 256) {
bot.tellraw("@a", error._message);
} else if (error.toString().length < 256) {
bot.chat.message(`${bot.getMessageAsPrismarine(error._message)?.toMotd().replaceAll('§','&')}`);
} else {
bot.tellraw("@a", [{ translate: 'command.failed', color: "dark_red", hoverEvent: { action: 'show_text', contents: `${error.stack}` } }])
bot.tellraw("@a", error._message);
}
}
}
@@ -117,14 +67,36 @@ async function inject (context) {
},
executeString (source, command) {
const [commandName, ...args] = command.split(' ')
return this.execute(source, commandName, args)
const [commandName, ...args] = command.split(' ');
if (source?.sources?.discord) {
return this.discordExecute(source, commandName, args);
} else {
return this.execute(source, commandName, args);
}
},
discordExecute(source, command) {
const [commandName, ...args] = command.split(" ");
if (source?.sources?.discord && !source?.sources?.console) {
return this.discordExecute(source, commandName, args)
discordExecute(source, commandName, args) {
const command = this.getCommand(commandName.toLowerCase());
try {
if (!command) {
throw new CommandError(`Unknown Command: ${commandName}`);
}
cmdMgrUtil(bot, command, args, source);
if (!command?.discordExecute) {
throw new CommandError(`${command.data.name} command is not supported in discord!`);
} else {
return command?.discordExecute({ bot, source, arguments: args, config, discordClient, EmbedBuilder, fixansi });
}
} catch (error) {
console.error(error);
if (error instanceof CommandError) {
bot?.discord?.message?.reply(`${bot.getMessageAsPrismarine(error._message)}`);
} else {
bot?.discord?.message?.reply(`\`\`\`${error}\`\`\``);
}
}
},
+1 -1
View File
@@ -154,7 +154,7 @@ function inject (context) {
} else if (message?.reference?.type === 1) {
// this is for messages that are forwarded
} else {
if (options.useChat || options.isSavage || options.isCreayun) {
if (options.mode === "savageFriends" || options.mode === "creayun") {
bot.chat.message(bot.getMessageAsPrismarine(`&7[&9FNF&3Boyfriend&1Bot Discord&7] ${message?.member?.displayName} \u203a ${message?.content}`)?.toMotd().replaceAll('§','&'))
} else {
bot.tellraw('@a', [tag, message.content]);
+21 -59
View File
@@ -2,71 +2,32 @@ const os = require('os');
function inject (context) {
const bot = context.bot;
const config = context.config;
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
let timer;
bot.memUsage = {
enabled: false
}
timer = setInterval(() => {
component = new MessageBuilder()
.setTranslate("%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |")
.setColor(config.colors.commands.tertiary)
.addWith(new MessageBuilder()
.setColor("dark_blue")
.setText("FNF")
)
.addWith(new MessageBuilder()
.setColor("dark_aqua")
.setText("Boyfriend")
)
.addWith(new MessageBuilder()
.setColor("blue")
.setText("Bot")
)
.addWith(new MessageBuilder()
.setText("Memory Usage")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Free Server Memory")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(os.freemem() / 1048576)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("MiB")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(os.totalmem() / 1048576)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("MiB")
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.primary)
.setText("Bot Memory Usage")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(process.memoryUsage().heapUsed / 1048576)}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("MiB")
)
.addWith(new MessageBuilder()
.setColor(config.colors.integer)
.setText(`${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`)
)
.addWith(new MessageBuilder()
.setColor(config.colors.commands.secondary)
.setText("MiB")
)
component = {
translate: "%s%s%s %s | %s: %s%s / %s%s | %s: %s%s / %s%s |",
color: config.colors.commands.tertiary,
with: [
{ text: "FNF", color: "dark_blue" },
{ text: "Boyfriend", color: "dark_aqua" },
{ text: "Bot", color: "blue" },
{ text: "Memory Usage" },
{ text: "Free Server Memory", color: config.colors.commands.primary },
{ text: `${Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: "Bot Memory Usage", color: config.colors.commands.primary },
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary },
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576 )}`, color: config.colors.integer },
{ text: "MiB", color: config.colors.commands.secondary }
]
}
if (!bot.memUsage.enabled) return;
bot.core.run(`minecraft:title @a[tag=!memusage] actionbar ${JSON.stringify(component)}`)
}, 100)
@@ -75,6 +36,7 @@ function inject (context) {
})
}
module.exports = {
data: {
enabled: true,
+4 -4
View File
@@ -5,10 +5,10 @@ function inject (context) {
bot.on('packet.position', packet => {
bot.position = {
x: packet.flags & 1 ? (this.x + packet.x) : packet.x,
y: packet.flags & 2 ? (this.y + packet.y) : packet.y,
z: packet.flags & 4 ? (this.z + packet.z) : packet.z
};
x: packet.x,
y: packet.y,
z: packet.z
}
bot._client.write('teleport_confirm', { teleportId: packet.teleportId })
+4 -4
View File
@@ -21,7 +21,7 @@ function inject (context) {
bot.vanished = true
bot.on('system_chat', (data) => {
const stringMessage = bot.getMessageAsPrismarine(data.message)?.toString();
if (options.isSavage) {
if (options.mode === "savageFriends") {
if (stringMessage === "Please, login with the command: /login <password>") login = true;
else if (stringMessage === "Successful login!") login = false;
else if (stringMessage === "You're already logged in!") login = false;
@@ -33,7 +33,7 @@ function inject (context) {
else if (stringMessage === "You're already logged in!") register = false;
else if (stringMessage === "Successful login!") register = false;
} else if (options.isKaboom) {
} else if (options.mode === "kaboom") {
if (stringMessage === "Successfully enabled CommandSpy") commandSpy = true;
else if (stringMessage === "Successfully enabled CommandSpy.") commandSpy = true;
else if (stringMessage === "Successfully disabled CommandSpy") commandSpy = false;
@@ -94,7 +94,7 @@ function inject (context) {
gameMode = packet.gameMode;
clientLock = packet.gameMode;
timer = setInterval(() => {
if (bot.options.isSavage && !bot.options.isKaboom && !bot.options.isCreayun) {
if (bot.options.mode === "savageFriends") {
if (login) bot.chat.command('login amogusissus');
else if (register) bot.chat.command('register amogusissus amogusissus');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
@@ -102,7 +102,7 @@ function inject (context) {
else if (clientLock !== 4) bot._client.write("client_command", { actionId: 0 });
} else if (bot.options.isCreayun && !bot.options.isKaboom && !bot.options.isSavage) {
} else if (bot.options.isKaboom && !bot.options.isSavage) {
} else if (bot.options.mode === "kaboom") {
if (permissionLevel < 2) bot.chat.command('op @s[type=player]');
else if (gameMode !== 1) bot.chat.command('minecraft:gamemode creative');
else if (!commandSpy) bot.chat.command('commandspy on');
+2 -2
View File
@@ -5,9 +5,9 @@ function inject (context) {
const options = context.options;
const config = context.config;
if (options.isKaboom === false || config.team.enabled === false) return;
if (options.mode !== "kaboom" || config.team.enabled === false) return;
bot.on("packet.login", async () => {
if (options.isKaboom) {
if (options.mode === "kaboom") {
await sleep(100);
bot.chat.command(`minecraft:team add ${config.team.name}`);
await sleep(100);
+3 -3
View File
@@ -4,9 +4,9 @@ function inject (context) {
const config = context.config;
setInterval(() => {
bot.validation = {
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.trusted).digest('hex').substring(0, 16),
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.admin).digest('hex').substring(0, 16),
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 1000) + config.keys.owner).digest('hex').substring(0, 16),
trusted: crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.keys.trusted).digest('hex').substring(0, 16),
admin: crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.keys.admin).digest('hex').substring(0, 16),
owner: crypto.createHash('sha256').update(Math.floor(Date.now() / 2000) + config.keys.owner).digest('hex').substring(0, 16),
}
}, 100)
}
+3 -3
View File
@@ -10,7 +10,7 @@ module.exports = (bot, command, args, source) => {
case 1:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.trusted}` || role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` || role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
if (!hasRole) throw new CommandError({ translate: 'You dont have the trusted, admin, or owner role!', color: "dark_red" })
} else if (!source?.sources.console) {
if (args.length === 0) throw new CommandError({ text: "Please provide a trusted, admin or owner hash", color: "dark_red" });
if (args[0] !== bot.validation.trusted && args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid trusted, admin or owner hash', color: 'dark_red' });
@@ -19,7 +19,7 @@ module.exports = (bot, command, args, source) => {
case 2:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.admin}` || role.name === `${config.discord.roles.fullAccess}` ||role.name === `${config.discord.roles.owner}`)
if (!hasRole) throw new CommandError({ translate: 'You are not trusted or the owner!', color: "dark_red" })
if (!hasRole) throw new CommandError({ translate: 'You dont have the admin, or owner role!', color: "dark_red" })
} else if (!source?.sources?.console) {
if (args.length === 0) throw new CommandError({ text: "Please provide an admin or owner hash", color: 'dark_red' })
if (args[0] !== bot.validation.admin && args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid admin or owner hash', color: 'dark_red' });
@@ -28,7 +28,7 @@ module.exports = (bot, command, args, source) => {
case 3:
if (source?.sources?.discord) {
const hasRole = roles?.some(role => role.name === `${config.discord.roles.owner}` || role.name === `${config.discord.roles.fullAccess}`)
if (!hasRole) throw new CommandError({ translate: 'You are not the owner!', color: "dark_red" })
if (!hasRole) throw new CommandError({ translate: 'You do not have the owner role!', color: "dark_red" })
} else if (!source?.sources?.console) {
if (args.length === 0 && bot.validation.owner) throw new CommandError({ text: "Please provide an owner hash", color: "dark_red" })
if (args[0] !== bot.validation.owner) throw new CommandError({ translate: 'Invalid owner hash', color: 'dark_red' })
+1 -1
View File
@@ -1,6 +1,6 @@
function usernameGen (bot, config) {
// const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
if (bot.options.isSavage || bot.options.isCreayun && !bot.options.isKaboom) {
if (bot.options.mode === "savageFriends" || bot.options.mode === "creayun") {
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
} else {
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_-+={]}[|\\:;>.<,/?ඞ♋'