mirror of
https://code.chipmunk.land/Parker2991/NitoriBot/
synced 2026-11-29 13:45:38 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcbd9f983c | ||
|
|
fa15c03c6d | ||
|
|
5d5700b61d | ||
|
|
2f21f670e0 | ||
|
|
e33988d103 | ||
|
|
e7a8aa226c | ||
|
|
881c2a8d0e | ||
|
|
f9e0406143 | ||
|
|
232546aeab | ||
|
|
68e4836359 | ||
|
|
b71f4a2ab0 | ||
|
|
872cf09c6a | ||
|
|
a76e65b18f | ||
|
|
d2e2124fbe | ||
|
|
c99d3ab302 | ||
|
|
9d1d818d30 | ||
|
|
d7f216e441 | ||
|
|
127ec9eb42 | ||
|
|
346f1eb0de | ||
|
|
cee0a22f55 | ||
|
|
422db19bdb | ||
|
|
06258b3a0c | ||
|
|
dc08bcad37 | ||
|
|
28be25d2e6 | ||
|
|
c1c09466b4 | ||
|
|
c0149e36d1 | ||
|
|
a7c9a37481 | ||
|
|
8bd1e92381 | ||
|
|
7cb0524f24 | ||
|
|
a8a0b210be | ||
|
|
229f4c5664 | ||
|
|
37e19521a4 | ||
|
|
799b49569e | ||
|
|
c522270815 | ||
|
|
e92153bb81 | ||
|
|
25ee0ce1e4 | ||
|
|
b9ae2a3bf7 | ||
|
|
3a1d335753 | ||
|
|
668312461f |
+2
-5
@@ -1,7 +1,4 @@
|
||||
node_modules
|
||||
config.yml
|
||||
config.js
|
||||
.git
|
||||
src/modules/exploits.js
|
||||
logs
|
||||
src/modules/custom_chat.js
|
||||
src/util/core_util.js
|
||||
src/modules/exploits.js
|
||||
@@ -1,3 +1,17 @@
|
||||
# FNFBoyfriendBot
|
||||
|
||||
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
|
||||
some things were git ignored from the repo that are needed for some things to work so you gotta recreate them
|
||||
|
||||
|
||||
FNFBoyfriendBot is a minecraft java bot made for the server kaboom.pw
|
||||
|
||||
# Setup:
|
||||
1. make sure to have nodejs npm and git installed
|
||||
|
||||
2. run npm i
|
||||
|
||||
3. fix some modules and stuff
|
||||
|
||||
4. edit the config
|
||||
|
||||
5. node src
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Note: each time changes are made push them to the dev branch in the bots repo
|
||||
1. Rewrite the version argument of the info command
|
||||
2. Fix arguments for discord
|
||||
3. Try adding a argument limit for commands maybe
|
||||
4. Use the nbt parser that chayapak wrote for the bot for 1.21.5 command block output
|
||||
5. Completely remove tptoggle selfcare since it’s no longer used
|
||||
- 6. Have the bot get output from the actual core instead of a command block it places
|
||||
- 7. Add support for 1.21 and 1.21.1 while keeping support for 1.19.3 to 1.20.2
|
||||
8. Add a server check
|
||||
9. Add source.sendfeedback back maybe
|
||||
10. Add a check to sendFeedback for discord to see if the message length is longer than discord’s max message limit to output it to a file and then reply with the file in discord
|
||||
11. Add a embed function for discord maybe
|
||||
12. Have the bot output errors to a seperate file to make debugging easier
|
||||
- 13. Revert class changes for usernameGen, loadModules, between, and ansi since it wouldn’t make much sense to make them classes instead of functions (chayapaks suggestion)
|
||||
- 14. Have the bot.js class extend the event emitter (chayapak suggestion)
|
||||
15. Maybe parse cspy in the chat module and emit it as a packet maybe
|
||||
16. For the owner check module have the bot send a message to the player username thats in the config if the 18. username name is online and if theres no reply back in discord within 10 seconds (10000 ms) to start deoping, muting, kicking, and changing their gamemode
|
||||
Generated
+317
-368
File diff suppressed because it is too large
Load Diff
+5
-7
@@ -1,13 +1,11 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"discord.js": "^14.17.3",
|
||||
"js-yaml": "^4.1.0",
|
||||
"matrix-js-sdk": "^36.2.0",
|
||||
"minecraft-data": "^3.83.1",
|
||||
"minecraft-protocol": "^1.54.0",
|
||||
"prismarine-chat": "^1.10.1",
|
||||
"discord.js": "^14.22.1",
|
||||
"minecraft-data": "^3.99.1",
|
||||
"minecraft-protocol": "^1.62.0",
|
||||
"prismarine-chat": "^1.12.0",
|
||||
"prismarine-registry": "^1.11.0",
|
||||
"undici": "^7.3.0",
|
||||
"undici": "^7.16.0",
|
||||
"wikipedia": "^2.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
this folder is for removed / scrapped concepts just in case people want to reimplement them
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
const nbt = require('prismarine-nbt');
|
||||
async function aaa () {
|
||||
console.log(await nbt.stringify("e"));
|
||||
}
|
||||
aaa()
|
||||
@@ -1,64 +0,0 @@
|
||||
const bots = require('../../data/bots.json');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "bots",
|
||||
description: "shows a list of known bots",
|
||||
aliases: [
|
||||
"knownbots"
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
async execute(context) {
|
||||
const query = context.arguments.join(" ").toLowerCase();
|
||||
const bot = context.bot;
|
||||
if (query.length === 0) {
|
||||
const list = [];
|
||||
for (const info of bots) {
|
||||
if (list.length !== 0) {
|
||||
list.push({ text: ", ", color: "gray" });
|
||||
}
|
||||
list.push(info.name);
|
||||
|
||||
}
|
||||
bot.tellraw("@a",
|
||||
["Known bots (", { text: JSON.stringify(bots.length), color: 'gold' }, { text: ") - ", color: 'gray' }, ...list],
|
||||
false,
|
||||
);
|
||||
return;
|
||||
}
|
||||
for (const info of bots) {
|
||||
const plainName = String(
|
||||
context.bot.getMessageAsPrismarine(info.name),
|
||||
).toLowerCase();
|
||||
if (plainName.includes(query)) this.sendBotInfo(info, context.bot);
|
||||
}
|
||||
},
|
||||
|
||||
sendBotInfo(info, bot) {
|
||||
const component = [""];
|
||||
component.push("Name: ", info.name);
|
||||
if (info.exclaimer) component.push("\n", "Exclaimer: ", info.exclaimer);
|
||||
if (info.authors && info.authors.length !== 0) {
|
||||
component.push("\n", "Authors: ");
|
||||
for (const author of info.authors) {
|
||||
component.push(author, { text: ", ", color: "gray" });
|
||||
}
|
||||
component.pop();
|
||||
}
|
||||
if (info.foundation) component.push("\n", "Foundation: ", info.foundation);
|
||||
if (info.prefixes && info.prefixes.length !== 0) {
|
||||
component.push("\n", "Prefixes: ");
|
||||
for (const prefix of info.prefixes) {
|
||||
component.push(prefix, { text: ", ", color: "gray" });
|
||||
}
|
||||
component.pop();
|
||||
}
|
||||
bot.tellraw("@a", [component]);
|
||||
},
|
||||
};
|
||||
//it doing it just for the ones i added lol
|
||||
// prob a replit moment, it probably thinks there are regexes in the strings
|
||||
@@ -1,65 +0,0 @@
|
||||
const bots = require('../data/changelog.json');
|
||||
module.exports = {
|
||||
name: 'changelog',
|
||||
description: ['check the bots changelog'],
|
||||
trustLevel: 0,
|
||||
aliases: ['clv', 'changes'],
|
||||
usage:[""],
|
||||
execute (context) {
|
||||
const query = context.arguments.join(' ').toLowerCase()
|
||||
const bot = context.bot
|
||||
if (query.length === 0) {
|
||||
const list = []
|
||||
|
||||
for (const info of bots) {
|
||||
if (list.length !== 0) list.push({ text: ', ', color: 'gray' })
|
||||
list.push(info.name)
|
||||
}
|
||||
const category = {
|
||||
translate: ' (%s%s%s%s%s%s%s%s%s) ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: 'aqua', text: 'Alpha Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'blue', text: 'Beta Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'green', text: 'Minor release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'gold', text: 'Revision Release' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: 'dark_red', text: 'Major Release' }
|
||||
]
|
||||
}
|
||||
bot.tellraw("@a", [{ text: 'Changelogs (', color: 'gray' }, { text: JSON.stringify(bots.length), color: 'gold' }, { text: ')', color: 'gray' }, category, ' - ', ...list])
|
||||
return
|
||||
}
|
||||
|
||||
for (const info of bots) {
|
||||
const plainName = String(context.bot.getMessageAsPrismarine(info.name)).toLowerCase()
|
||||
if (plainName.includes(query)) this.sendBotInfo(info, context.bot)
|
||||
}
|
||||
},
|
||||
|
||||
sendBotInfo (info, bot) {
|
||||
const component = ['']
|
||||
component.push('', info.name)
|
||||
if (info.exclaimer) component.push('\n', ' ', info.exclaimer)
|
||||
if (info.authors && info.authors.length !== 0) {
|
||||
component.push('\n', 'Codename ')
|
||||
for (const author of info.authors) {
|
||||
component.push(author, { text: ', ', color: 'gray' })
|
||||
}
|
||||
component.pop()
|
||||
}
|
||||
if (info.foundation) component.push('\n', 'Date: ', info.foundation)
|
||||
if (info.prefixes && info.prefixes.length !== 0) {
|
||||
component.push('\n', '')
|
||||
for (const prefix of info.prefixes) {
|
||||
component.push(prefix, { text: ' ', color: 'gray' })
|
||||
}
|
||||
component.pop()
|
||||
}
|
||||
bot.tellraw('@a', [component])
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
const https = require('node:https');
|
||||
|
||||
https.get('https://encrypted.google.com/', (res) => {
|
||||
console.log('statusCode:', res.statusCode);
|
||||
// console.log('headers:', res.headers);
|
||||
console.log((res.complete))
|
||||
let data;
|
||||
res.on('data', (d) => {
|
||||
process.stdout.write(d);
|
||||
// if (data === undefined) data = chunk;
|
||||
// else data += chunk;
|
||||
// console.log(data);
|
||||
});
|
||||
|
||||
}).on('error', (e) => {
|
||||
console.error(e);
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* This is a general purpose Gradle build.
|
||||
* To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.5/samples
|
||||
*/
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
}
|
||||
|
||||
group = 'land.chipmunk.parker2991'
|
||||
version = 'v6.0.0-alpha(ff08479)'
|
||||
description = 'FNFBoyfriendBot'
|
||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.opencollab.dev/maven-snapshots/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.opencollab.dev/maven-releases/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://repo.maven.apache.org/maven2/')
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri('https://maven.maxhenkel.de/repository/public')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.steveice10:mcprotocollib:1.20.2-1-SNAPSHOT'
|
||||
implementation 'net.kyori:adventure-text-serializer-ansi:4.14.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'com.google.guava:guava:31.1-jre'
|
||||
implementation 'org.jline:jline:3.23.0'
|
||||
implementation 'org.yaml:snakeyaml:2.0'
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Main-Class': 'land.chipmunk.parker2991.fnfboyfriendbot.Main'
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
voiding interger will return a number
|
||||
public static void functionName() {} has the funcion return nothing
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# This file was generated by the Gradle 'init' task.
|
||||
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
Vendored
-249
@@ -1,249 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
-92
@@ -1,92 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.5/userguide/building_swift_projects.html in the Gradle documentation.
|
||||
*/
|
||||
|
||||
rootProject.name = 'fnfboyfriendbot'
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
|
||||
import land.chipmunk.parker2991.fnfboyfriendbot.*;
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference;
|
||||
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
|
||||
import com.github.steveice10.mc.protocol.data.game.setting.SkinPart;
|
||||
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
||||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.*;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.github.steveice10.packetlib.tcp.TcpClientSession;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Bot {
|
||||
private final ArrayList<ClientListener> listeners = new ArrayList<>();
|
||||
|
||||
public final String host;
|
||||
|
||||
public final int port;
|
||||
|
||||
public final List<Bot> bots;
|
||||
|
||||
public final Options.bots options;
|
||||
|
||||
public Bot (Options.bots options, List<Bot> bots) {
|
||||
this.host = options.host;
|
||||
this.port = options.port;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
public class ClientListener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Bot config = null;
|
||||
Path configPath = Paths.get("config.yml");
|
||||
try {
|
||||
Yaml yaml = new Yaml();
|
||||
config = yaml.load(Files.readString(configPath));
|
||||
System.out.println(config);
|
||||
} catch (IOException e) {
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
List<Bots> bots = new ArrayList<>();
|
||||
for (Options options : config.bots) {
|
||||
final Bot client = new Bot(options, bots);
|
||||
bots.add(client);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Options {
|
||||
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
|
||||
public class Options {
|
||||
public static class bots {
|
||||
public String host = "127.0.0.1";
|
||||
public int port = 25565;
|
||||
public long reconnectDelay;
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.commands;
|
||||
|
||||
|
||||
public class SayCommand {
|
||||
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class BruhifyModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ChatCommandHandlerModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ChatModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandCoreModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandLoopManagerModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class CommandManagerModule {
|
||||
|
||||
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ConsoleModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class DiscordModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class PlayerListModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class SelfcareModule {
|
||||
|
||||
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot.modules;
|
||||
|
||||
|
||||
public class ValidationModule {
|
||||
|
||||
|
||||
}
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class servershit {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||
System.out.println("Hostname \u203a " + inetAddress.getHostName());
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println("Working Directory \u203a " + System.getProperty("user.dir"));
|
||||
System.out.println(System.getProperty("os.arch"));
|
||||
System.out.println("OS \u203a " + System.getProperty("os.name"));
|
||||
System.out.println("OS Version/distro \u203a " + System.getProperty("os.version"));
|
||||
System.out.println("Kernel Version \u203a " + System.getProperty("os.kernel.version"));
|
||||
System.out.println("Cores \u203a " + Runtime.getRuntime().availableProcessors());
|
||||
System.out.println("CPU \u203a " + System.getProperty("sun.cpu.isalist"));
|
||||
System.out.println("Server Free memory " + (Runtime.getRuntime().freeMemory() / 1048576) + " MiB " +
|
||||
Runtime.getRuntime().totalMemory() / 1048576 + " MiB");
|
||||
System.out.println("Device uptime \u203a " + formatUptime(System.currentTimeMillis() / 1000L));
|
||||
System.out.println("Java version \u203a " + System.getProperty("java.version"));
|
||||
}
|
||||
|
||||
private static String formatUptime(long uptime) {
|
||||
long days = uptime / 86400;
|
||||
long hours = (uptime % 86400) / 3600;
|
||||
long minutes = ((uptime % 86400) % 3600) / 60;
|
||||
long seconds = ((uptime % 86400) % 3600) % 60;
|
||||
|
||||
return days + "d " + hours + "h " + minutes + "m " + seconds + "s";
|
||||
}
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package land.chipmunk.parker2991.fnfboyfriendbot;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class serverterminal {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(Arrays.asList("ash", "-c", "ls"));
|
||||
Process process = processBuilder.start();
|
||||
|
||||
InputStream inputStream = process.getInputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
System.out.println(new String(buffer, 0, bytesRead));
|
||||
}
|
||||
|
||||
int exitCode = process.waitFor();
|
||||
System.out.println("Child process close all stdio with code " + exitCode);
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
Commands:
|
||||
prefixes:
|
||||
- "~"
|
||||
- "fnfbfbot "
|
||||
- "&"
|
||||
- "\ufffc"
|
||||
- "\u202e"
|
||||
- "\u2588"
|
||||
@@ -1,26 +0,0 @@
|
||||
const CommandError = require('../util/command_error.js');
|
||||
module.exports = {
|
||||
name: 'json',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'placeholder text here',
|
||||
usages: [
|
||||
],
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
try {
|
||||
// bot.tellraw("@a", [
|
||||
// { text: `Result \u203a` },
|
||||
//JSON.parse(args.join(' ')),
|
||||
// ])
|
||||
// bot.tellraw("@a", `Result ${JSON.stringify(JSON.parse(args.join(' ')))}` )
|
||||
bot.tellraw("@a", JSON.parse(JSON.stringify(args.join(' '))))
|
||||
// console.log([ { text: `Result \u203a` }, { text: JSON.parse(args.join(' ')) } ])
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", { text: e.toString(), color: "dark_red" })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
const sdk = require("matrix-js-sdk");
|
||||
const { logger } = require('matrix-js-sdk/lib/logger');
|
||||
async function matrix (bot, options, config, discordClient) {
|
||||
if (!options.roomId) return
|
||||
if (!config.matrix.enabled) return
|
||||
const client = sdk.createClient({
|
||||
baseUrl: `${config.matrix.hostUrl}`,
|
||||
accessToken: `${config.matrix.token}`,
|
||||
userId: `${config.matrix.userId}`,
|
||||
})
|
||||
bot.matrix = {
|
||||
client,
|
||||
roomId: options.roomId,
|
||||
prefix: config.matrix.prefix || undefined,
|
||||
inviteUrl: config.matrix.invite || undefined
|
||||
}
|
||||
bot.matrix.client.on('Room.timeline', (event, room, toStartOfTimeline) => {
|
||||
if (event.getRoomId() !== bot.matrix.roomId
|
||||
|| event.getType() !== 'm.room.message'
|
||||
|| event.getTs() < startTime
|
||||
|| event.sender.userId === bot.matrix.client.getUserId()) return
|
||||
const content = event.getContent()
|
||||
const permissionLevel = event.sender.powerLevelNorm
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: "gray",
|
||||
with: [
|
||||
{
|
||||
translate: "%s%s%s %s",
|
||||
with: [
|
||||
{
|
||||
text: "FNF",
|
||||
color: "blue",
|
||||
},
|
||||
{
|
||||
text: "Boyfriend",
|
||||
color: "dark_aqua",
|
||||
},
|
||||
{
|
||||
text: "Bot",
|
||||
color: "dark_blue",
|
||||
},
|
||||
{
|
||||
text: "Matrix",
|
||||
color: "#0dbd8b"
|
||||
}
|
||||
],
|
||||
// clickEvent: config.matrix.invite ? { action: 'open_url', value: config.matrix.invite } : undefined,
|
||||
// hoverEvent: { action: 'show_text', contents: 'Click to join the matrix' }
|
||||
},
|
||||
{
|
||||
// text: event.sender.rawDisplayName || event.sender.name || event.sender.userId
|
||||
},
|
||||
// content.body
|
||||
event.getContent().body,
|
||||
]
|
||||
}
|
||||
])
|
||||
console.log(
|
||||
// the room name will update with m.room.name events automatically
|
||||
"(%s) %s :: %s",
|
||||
room.name,
|
||||
event.getSender(),
|
||||
event.getContent().body,
|
||||
)
|
||||
})
|
||||
bot.on('message', (message) => {
|
||||
const stringMessage = bot.getMessageAsPrismarine(message)?.toString()
|
||||
const content = {
|
||||
body: '```ansi' + stringMessage + '```',
|
||||
msgtype: "m.text",
|
||||
}
|
||||
let queue = [];
|
||||
setInterval(() => {
|
||||
// if (queue.length === 0) return
|
||||
try {
|
||||
bot.matrix.client.sendEvent(bot.options.roomId, 'm.room.message', content);
|
||||
} catch (e) {
|
||||
bot.console.logs(error.toString());
|
||||
}
|
||||
queue = [];
|
||||
}, 5000)
|
||||
})
|
||||
await client.startClient()
|
||||
}
|
||||
module.exports = matrix;
|
||||
@@ -1,114 +0,0 @@
|
||||
const trustedPlayers = require('../data/trustedPlayers.json');
|
||||
module.exports = (bot, options, config) => {
|
||||
let component;
|
||||
trustedPlayers.map((trusted) => {
|
||||
/*component.push({
|
||||
translate: "%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "ea" }
|
||||
]
|
||||
})*/
|
||||
bot.on('message', (data) => {
|
||||
try {
|
||||
let stringMessage = bot.getMessageAsPrismarine(data)?.toString();
|
||||
// console.log(JSON.stringify(data))
|
||||
// console.log(data?.with[0]?.clickEvent);
|
||||
// console.log(data.color);
|
||||
// for (const players of bot.players) {
|
||||
if (
|
||||
/*
|
||||
stringMessage.startsWith(`${trusted.player}`) &&
|
||||
data.translate === "multiplayer.player.joined" &&
|
||||
data.color === "yellow" &&
|
||||
data.with.insertion === `${trusted.player}` &&
|
||||
data?.with[0]?.clickEvent === `{action:'suggest_command',value:'/tell ${trusted.player} '}` &&*/
|
||||
JSON.stringify(data) ===
|
||||
JSON.stringify({
|
||||
color:'yellow',
|
||||
translate:'multiplayer.player.joined',
|
||||
with:[{insertion:`${trusted.player}`,
|
||||
clickEvent:{
|
||||
action:'suggest_command',
|
||||
value:`/tell ${trusted.player} `
|
||||
},
|
||||
hoverEvent:{
|
||||
action:'show_entity',
|
||||
contents:{
|
||||
type:'minecraft:player',
|
||||
id:`${bot.players.find((player) => player.profile.name === trusted.player)?.uuid}`,
|
||||
name:{
|
||||
text:`${trusted.player}`
|
||||
}
|
||||
}
|
||||
},
|
||||
text:`${trusted.player}`
|
||||
}]
|
||||
})
|
||||
) {
|
||||
if (bot.players.map((e) => { e.profile.name === trusted.player })) {
|
||||
bot.tellraw(`@a[name="${trusted.player}"]`, "e");
|
||||
component = "e";
|
||||
}
|
||||
}
|
||||
// bot.tellraw(`@a[name="${bot.players.find((player) => player.profile.name === trusted.player).profile.name}"]`, component);
|
||||
/* for (const players of bot.players) {
|
||||
// console.log(players);
|
||||
if (players.profile.name === trusted.player) {
|
||||
let e = players.profile.name === trusted.player;
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw(`@a[name="${trusted.player}"]`, "e");
|
||||
}
|
||||
}*/
|
||||
// }
|
||||
//if (bot.players.find((player) => player.profile.name !== trusted.player)) return
|
||||
//for (const eachBot of bot.bots) {
|
||||
// if (bot.players.find((player) => player.profile.name === trusted.player)) {
|
||||
// bot.tellraw(`@a[name="${bot.players.find((player) => player.profile.name === trusted.player).profile.name}"]`, "e");
|
||||
// }
|
||||
//}
|
||||
// bot.chat.message(`${trusted.player} joined the game`);
|
||||
// }
|
||||
// }
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
})
|
||||
})
|
||||
/* bot.on('packet.login', (data) => {
|
||||
console.log(bot.players.find((players) => players.profile.name === trusted.player))
|
||||
console.log(bot.players)
|
||||
if (bot.players.find((player) => player.profile.name === trusted.player)) {
|
||||
bot.chat.message('player joined the game')
|
||||
}
|
||||
})
|
||||
multiplayer.player.joined
|
||||
[{"insertion":"Parker2991","clickEvent":{"action":"suggest_command",
|
||||
"value":"/tell Parker2991 "},"hoverEvent":{"action":"show_entity",
|
||||
"contents":{"type":"minecraft:player",
|
||||
"id":"85f5b68d-a567-3877-9701-3cd7404bc9d9",
|
||||
"name":{"text":"Parker2991"}}},"text":"Parker2991"}]
|
||||
[
|
||||
{
|
||||
insertion: 'Parker2991',
|
||||
clickEvent: { action: 'suggest_command', value: '/tell Parker2991 ' },
|
||||
hoverEvent: { action: 'show_entity', contents: [Object] },
|
||||
text: 'Parker2991'
|
||||
}
|
||||
]
|
||||
yellow
|
||||
*/
|
||||
/*for (const trusted in trustedPlayers) {
|
||||
component.push({
|
||||
translate: '%s',
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: 'e' }
|
||||
]
|
||||
})
|
||||
// console.log(component)
|
||||
}*/
|
||||
|
||||
// bot.tellraw("@a", component)
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
const { request } = require("undici");
|
||||
// https://en.wikipedia.org/w/api.php
|
||||
async function sus () {
|
||||
const query = new URLSearchParams("sus");
|
||||
const wikiResult = await request(`https://en.wikipedia.org/wiki/sus`);
|
||||
const result = await wikiResult.body;
|
||||
console.log((await result.json()))
|
||||
}
|
||||
sus()
|
||||
+105
-66
@@ -1,78 +1,117 @@
|
||||
const mc = require('minecraft-protocol');
|
||||
const { EventEmitter } = require('events');
|
||||
EventEmitter.defaultMaxListeners = 5e6;
|
||||
const util = require('util');
|
||||
const ChatMessage = require('prismarine-chat');
|
||||
function createBot(options = {}, config) {
|
||||
let endCount = 0;
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
host: options.host ??= 'localhost',
|
||||
username: options.username ??= 'Player',
|
||||
hideErrors: options.hideErrors ??= true, // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
};
|
||||
bot.options = options;
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on('init_client', client => {
|
||||
client.on('packet', (data, meta) => {
|
||||
bot.emit('packet', data, meta)
|
||||
bot.emit('packet.' + meta.name, data);
|
||||
})
|
||||
const mc = require("minecraft-protocol");
|
||||
const { EventEmitter } = require("events");
|
||||
const ChatMessage = require("prismarine-chat");
|
||||
const usernameGen = require("./util/usernameGen");
|
||||
let disconnectCount = 0;
|
||||
|
||||
client.on('login', (data) => {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
})
|
||||
EventEmitter.defaultMaxListeners = Infinity;
|
||||
|
||||
client.on('disconnect', data => {
|
||||
bot.emit("disconnect", data);
|
||||
bot.console.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
|
||||
})
|
||||
class Bot {
|
||||
constructor(options = {}, config) {
|
||||
const bot = new EventEmitter();
|
||||
bot.options = {
|
||||
// Set some default values in options
|
||||
host: (options.host ??= "localhost"),
|
||||
username: (options.username ??= usernameGen()),
|
||||
version: (options.version ??= "1.21.8"),
|
||||
hideErrors: (options.hideErrors ??= true), // HACK: Hide errors by default as a lazy fix to console being spammed with them
|
||||
serverName: (options.serverName ??= "localhost"),
|
||||
private: (options.private ??= false),
|
||||
reconnectDelay: (options.reconnectDelay ??= 300),
|
||||
channelId: (options.channelId ??= "0000000000000000000"),
|
||||
logging: {
|
||||
file: (options.logging.file ??= false),
|
||||
console: (options.logging.console ??= false)
|
||||
},
|
||||
mode: (options.mode ??= "kaboom"),
|
||||
selfcareInterval: (options.selfcareInterval ??= 1000),
|
||||
itemRefill: (options.itemRefill ??= false),
|
||||
chatGamemodeChange: (options.chatGamemodeChange ??= false)
|
||||
};
|
||||
|
||||
client.on('end', reason => {
|
||||
bot.emit('end', reason);
|
||||
if (reason === "socketClosed") return;
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch(`§8[§bClient Reconnect§8]§r ${reason}`)?.toAnsi());
|
||||
})
|
||||
bot.options = options;
|
||||
|
||||
client.on('error', error => {
|
||||
endCount++
|
||||
if (endCount === 10) {
|
||||
bot.console.info('stopped logging disconnect messages for now...');
|
||||
bot?.discord?.channel?.send('stopped logging disconnect messages for now...');
|
||||
return;
|
||||
} else if (endCount > 10) {
|
||||
return;
|
||||
} else {
|
||||
bot.console.warn(ChatMessage(bot._client.version).fromNotch('§8[§bClient Reconnect§8]§r ')?.toAnsi() + util.inspect(error.toString()))
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
}
|
||||
})
|
||||
// Create our client object, put it on the bot, and register some events
|
||||
bot.on("init_client", (client) => {
|
||||
client.on("packet", (data, meta) => {
|
||||
bot.emit("packet", data, meta);
|
||||
bot.emit("packet." + meta.name, data);
|
||||
});
|
||||
|
||||
client.on("keep_alive", ({ keepAliveId }) => {
|
||||
bot.emit("keep_alive", { keepAliveId })
|
||||
})
|
||||
client.once("login", (data) => {
|
||||
bot.uuid = client.uuid;
|
||||
bot.username = client.username;
|
||||
bot.loggedIn = true;
|
||||
disconnectCount = 0
|
||||
bot.reconnectDelay = options.reconnectDelay;
|
||||
});
|
||||
|
||||
client.on('kick_disconnect', (data) => {
|
||||
bot.emit("kick_disconnect", data.reason)
|
||||
bot.console?.warn(`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`)
|
||||
bot?.discord?.channel?.send(util.inspect(data.reason))
|
||||
})
|
||||
client.on("disconnect", (data) => {
|
||||
try {
|
||||
if (
|
||||
JSON.parse(data.reason) ===
|
||||
"Wait 5 seconds before connecting, thanks! :)"
|
||||
)
|
||||
bot.reconnectDelay = 5000;
|
||||
bot.console.warn(
|
||||
`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`,
|
||||
);
|
||||
bot?.discord?.channel?.send(
|
||||
ChatMessage(bot._client.version).fromNotch(data.reason)?.toString(),
|
||||
);
|
||||
} catch {} // do nothing
|
||||
});
|
||||
|
||||
client.on('success', (data) => {
|
||||
endCount = 0;
|
||||
})
|
||||
client.on("end", (reason) => {
|
||||
bot.emit("end", reason);
|
||||
bot.loggedIn = false;
|
||||
disconnectCount++;
|
||||
});
|
||||
|
||||
client.on("error", (error) => {
|
||||
try {
|
||||
if (disconnectCount === 10) {
|
||||
bot.console.info("stopped logging disconnect messages for now...");
|
||||
bot?.discord?.channel?.send(
|
||||
"stopped logging disconnect messages for now...",
|
||||
);
|
||||
return;
|
||||
} else if (disconnectCount > 10) {
|
||||
return;
|
||||
} else {
|
||||
bot.console.warn(
|
||||
ChatMessage(bot._client.version)
|
||||
.fromNotch(`§8[§bClient Reconnect§8]§r ${error.stack}`)
|
||||
?.toAnsi(),
|
||||
);
|
||||
bot?.discord?.channel?.send(error.toString());
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
client.on("kick_disconnect", (data) => {
|
||||
bot.console.warn(
|
||||
`${ChatMessage(bot._client.version).fromNotch("§8[§bClient Reconnect§8]§r")?.toAnsi()} ${ChatMessage(bot._client.version).fromNotch(data.reason)?.toAnsi()}`,
|
||||
);
|
||||
bot?.discord?.channel?.send(
|
||||
ChatMessage(bot._client.version).fromNotch(data.reason)?.toString(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
// console?.warn(e.stack)
|
||||
//console.log('meow')
|
||||
console.warn(`${e.stack}`);
|
||||
});
|
||||
})
|
||||
|
||||
const client = options.client ?? new mc.createClient(bot.options)
|
||||
bot._client = client
|
||||
bot.emit('init_client', client)
|
||||
bot.bots = options.bots ?? [bot]
|
||||
return bot
|
||||
|
||||
const client = options.client ?? new mc.createClient(bot.options);
|
||||
bot._client = client;
|
||||
bot.emit("init_client", client);
|
||||
bot.bots = options.bots ?? [bot];
|
||||
return bot;
|
||||
}
|
||||
}
|
||||
module.exports = createBot;
|
||||
module.exports = Bot;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
function chipmunkmod(message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
if (
|
||||
message.with?.length < 3 ||
|
||||
(message.translate !== "[%s] %s › %s" &&
|
||||
message.translate !== "%s %s › %s")
|
||||
)
|
||||
return;
|
||||
|
||||
const senderComponent = message.with[1];
|
||||
const contents = message.with[2];
|
||||
let sender;
|
||||
const hoverEvent = senderComponent.hover_event;
|
||||
// console.log(hoverEvent)
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const id = hoverEvent.uuid;
|
||||
|
||||
sender = data.players.find((player) => player.entityUuid[0] === id[0])//.entityUuid //=== hoverEvent.uuid)//.entityUuid;
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
?.toString();
|
||||
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
|
||||
if (!sender) return null;
|
||||
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
senderComponent,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
module.exports = chipmunkmod;
|
||||
@@ -0,0 +1,26 @@
|
||||
const ChatMessage = require("prismarine-chat")("1.20.2");
|
||||
const util = require("util");
|
||||
function parseMessage(messageobj, data) {
|
||||
try {
|
||||
let match;
|
||||
let sender;
|
||||
const stringify = (message) => new ChatMessage(message).toString();
|
||||
const message = stringify(messageobj);
|
||||
const playerWithPrefix = /^(.*?) (\S*?) » (.*?)$/;
|
||||
const playerWithoutPrefix = /^(\S*?) » (.*?)$/;
|
||||
if (playerWithPrefix.test(message)) {
|
||||
match = message.match(playerWithPrefix);
|
||||
|
||||
sender = data.players.find((player) => player.profile.name === match[2]);
|
||||
return {
|
||||
sender,
|
||||
contents: match[3],
|
||||
type: "minecraft:chat",
|
||||
chatType: data.chatType
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e.stack);
|
||||
}
|
||||
}
|
||||
module.exports = parseMessage;
|
||||
@@ -21,8 +21,10 @@ function kaboom (message, data) {
|
||||
}
|
||||
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
|
||||
let sender
|
||||
if (data.uuid) {
|
||||
|
||||
if (data.senderUuid) {
|
||||
sender = data.players.find(player => player.uuid === data.senderUuid)
|
||||
} else {
|
||||
const playerListDisplayName = { extra: [prefix, displayName], text: '' }
|
||||
@@ -31,7 +33,7 @@ function kaboom (message, data) {
|
||||
|
||||
if (!sender) return undefined
|
||||
|
||||
return { sender, contents, type: 'minecraft:chat', displayName }
|
||||
return { sender, contents, type: "minecraft:chat", displayName, chatType: data.chatType }
|
||||
}
|
||||
|
||||
function isSeparatorAt (children, start) {
|
||||
@@ -0,0 +1,31 @@
|
||||
function me (message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
|
||||
if (message.with?.length > 2 || message.translate !== "chat.type.announcement") return;
|
||||
|
||||
const component = message.with[0];
|
||||
const contents = message.with[1];
|
||||
let sender;
|
||||
const hoverEvent = component.hover_event
|
||||
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const name = hoverEvent.name;
|
||||
sender = data.players.find((player) => player.profile.name === name)
|
||||
}
|
||||
|
||||
if (!sender) return;
|
||||
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
component,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.log(e.stack)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = me;
|
||||
@@ -0,0 +1,5 @@
|
||||
function say (message, data) {
|
||||
|
||||
}
|
||||
|
||||
module.exports = say;
|
||||
@@ -0,0 +1,37 @@
|
||||
function vanilla(message, data) {
|
||||
try {
|
||||
if (message === null || typeof message !== "object") return;
|
||||
|
||||
if (
|
||||
message.with?.length < 2 ||
|
||||
(message.translate !== "chat.type.text" && message.translate !== "%s %s")
|
||||
)
|
||||
return;
|
||||
const senderComponent = message.with[0];
|
||||
const contents = message.with[1];
|
||||
let sender;
|
||||
const hoverEvent = senderComponent.hoverEvent;
|
||||
if (hoverEvent?.action === "show_entity") {
|
||||
const id = hoverEvent.contents.id;
|
||||
sender = data.players.find((player) => player.uuid === id);
|
||||
} else {
|
||||
const stringUsername = data
|
||||
.getMessageAsPrismarine(senderComponent)
|
||||
.toString();
|
||||
sender = data.players.find(
|
||||
(player) => player.profile.name === stringUsername,
|
||||
);
|
||||
}
|
||||
if (!sender) return;
|
||||
return {
|
||||
sender,
|
||||
contents,
|
||||
type: "minecraft:chat",
|
||||
senderComponent,
|
||||
chatType: data.chatType
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(`${e.stack}`);
|
||||
}
|
||||
}
|
||||
module.exports = vanilla;
|
||||
@@ -0,0 +1,38 @@
|
||||
const CommandError = require('./CommandError');
|
||||
const translations = require('../data/translations.json');
|
||||
|
||||
class CommandArguments {
|
||||
static getInteger (integer) {
|
||||
if (isNaN(integer)) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${integer}` }
|
||||
]
|
||||
})
|
||||
else return String(Number(integer))
|
||||
}
|
||||
|
||||
static getJson (json) {
|
||||
|
||||
}
|
||||
|
||||
static getArguments () {
|
||||
|
||||
}
|
||||
|
||||
static getMaxArguments (commandArgs, args) {
|
||||
if (commandArgs < args) throw new CommandError({
|
||||
translate: "fnfboyfriendbot.arguments.max_exceeded",
|
||||
fallback: translations["fnfboyfriendbot.arguments.max_exceeded"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${commandArgs}` },
|
||||
{ text: `${args}` }
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CommandArguments;
|
||||
@@ -0,0 +1,12 @@
|
||||
class CommandContext {
|
||||
constructor(name, aliases, description, trustLevel, usages, playerChatOnly) {
|
||||
this.data = {};
|
||||
this.data.name = name;
|
||||
this.data.aliases = aliases;
|
||||
this.data.description = description;
|
||||
this.data.trustLevel = trustLevel;
|
||||
this.data.usages = usages;
|
||||
this.data.playerChatOnly = playerChatOnly
|
||||
}
|
||||
}
|
||||
module.exports = CommandContext;
|
||||
@@ -0,0 +1,15 @@
|
||||
const ChatMessage = require("prismarine-chat")("1.21.8");
|
||||
const stringify = (message) => new ChatMessage(message)?.toString();
|
||||
|
||||
class CommandError extends Error {
|
||||
constructor(message, filename, lineError) {
|
||||
super(stringify(message), filename, lineError);
|
||||
this.name = "CommandError";
|
||||
this._message = message;
|
||||
}
|
||||
|
||||
get message() {
|
||||
return stringify(this._message);
|
||||
}
|
||||
}
|
||||
module.exports = CommandError;
|
||||
@@ -0,0 +1,9 @@
|
||||
class CommandSource {
|
||||
constructor(player, sources, ChatType) {
|
||||
this.player = player;
|
||||
this.sources = sources;
|
||||
this.ChatType = ChatType;
|
||||
this.player.trustLevel = 0;
|
||||
}
|
||||
}
|
||||
module.exports = CommandSource;
|
||||
@@ -0,0 +1,10 @@
|
||||
class CommandTrustLevel {
|
||||
static public = 0;
|
||||
static trusted = 1;
|
||||
static admin = 2;
|
||||
static owner = 3;
|
||||
static console = 4;
|
||||
static disabled = 5;
|
||||
}
|
||||
|
||||
module.exports = CommandTrustLevel;
|
||||
@@ -0,0 +1,155 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class CoresettingsCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("coresettings", ["cbsettings"], "change the bots core settings", 2, [
|
||||
"useplacedcommandblock <on/off/true/false/enable/disable>",
|
||||
"area start <positions>",
|
||||
"area end <positions>",
|
||||
"refillmethod/rcmethod <item/chat>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "useplacedcommandblock":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "true":
|
||||
case "enable":
|
||||
bot.core.usePlacedCommandBlock = true;
|
||||
component.push({
|
||||
text: "now using the placed command block",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
case "off":
|
||||
case "false":
|
||||
case "disable":
|
||||
bot.core.usePlacedCommandBlock = false;
|
||||
component.push({
|
||||
text: "no longer using the placed command block",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
component.push({
|
||||
text: "the bot is currently using the placed command block to run its commands",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
text: "the bot is currently using its command block core to run its commands",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "area":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "start":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.start = config.core.area.start;
|
||||
component.push({
|
||||
text: "arguments were NaN, defaulting to config core start coords",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
bot.core.area.start = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5]),
|
||||
};
|
||||
component.push({
|
||||
text: `setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "end":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.end = config.core.area.end;
|
||||
throw new CommandError(
|
||||
"arguments were NaN, defaulting to config core end coords",
|
||||
);
|
||||
} else {
|
||||
bot.core.area.end = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5]),
|
||||
};
|
||||
|
||||
component.push({
|
||||
text: `setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
component.push({
|
||||
text: `core start pos: x: ${bot.core.area.start.x}, y: ${bot.core.area.start.y}, z: ${bot.core.area.start.z}, and end pos: x: ${bot.core.area.end.x}, y: ${bot.core.area.end.y}, z: ${bot.core.area.end.z}`,
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "refillmethod":
|
||||
case "rcmethod":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "item":
|
||||
config.core.itemRefill = true;
|
||||
component.push({
|
||||
text: "now refilling via item",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
case "chat":
|
||||
config.core.itemRefill = false;
|
||||
component.push({
|
||||
text: "now refilling via chat",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
if (config.core.itemRefill) {
|
||||
component.push({
|
||||
text: "currently filling core via item",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
text: "currently filling core via chat",
|
||||
color: config.colors.commands.primary,
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CoresettingsCommand;
|
||||
@@ -0,0 +1,37 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KickCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kick", [], "kick a player from the server", 2, [
|
||||
"invalidstring",
|
||||
"item",
|
||||
"te",
|
||||
]);
|
||||
}
|
||||
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.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KickCommand;
|
||||
@@ -0,0 +1,13 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ReconnectCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("reconnect", ["end"], "reconnects the bot", 2, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end();
|
||||
bot.chat.message("reconnecting");
|
||||
}
|
||||
}
|
||||
module.exports = ReconnectCommand;
|
||||
@@ -1,32 +0,0 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'vanish',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"vanishtoggle"
|
||||
],
|
||||
description: 'toggle the bots vanish selfcare',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join('') === 'true') {
|
||||
bot.vanished = true
|
||||
bot.chat.message('enabled vanish selfcare')
|
||||
}
|
||||
if (args.slice(1).join('') === 'false') {
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabled vanish selfcare')
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.vanished = false;
|
||||
bot.chat.message('disabling vanish selfcare,...');
|
||||
bot.chat.command('v off')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
|
||||
class ConsoleCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("console", ["c"], "runs commands made for the bots console", 4, [
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ConsoleCommand;
|
||||
@@ -0,0 +1,12 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class KillCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("kill", ["suicide", "quit"], "kill the bots process", 3, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = KillCommand;
|
||||
@@ -0,0 +1,42 @@
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { stylize } = require("../../util/stylizeEval");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ServerevalCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("servereval", ["se"], "run code unisolated", 4, ["<code>"]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(" ");
|
||||
const { MessageBuilder } = require("prismarine-chat")(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(
|
||||
bot
|
||||
.getMessageAsPrismarine({
|
||||
text: util.inspect(eval(args.join(" ")), { stylize }),
|
||||
})
|
||||
?.toAnsi(),
|
||||
);
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(
|
||||
`minecraft:tellraw @a ${JSON.stringify(util.inspect(eval(script), { stylize }).substring(0, 32700))}`,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, {
|
||||
text: `${util.inspect(eval(script), { stylize }).substring(0, 32700)}`,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
throw new CommandError(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ServerevalCommand;
|
||||
@@ -1,27 +1,36 @@
|
||||
const CommandError = require('../../util/command_error')
|
||||
const sleep = require("../../util/sleep");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'core',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"cb",
|
||||
"corerun",
|
||||
"commandcorerun",
|
||||
],
|
||||
description: 'run commands in core!',
|
||||
usages: [
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ');
|
||||
bot.core.run(message);
|
||||
},
|
||||
discordExecute (context) {
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super("core", ["cb", "cbrun", "corerun"], "run commands in core", 0, [
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.core.run(args.join(' '));
|
||||
const source = context.source;
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source,
|
||||
);
|
||||
// await sleep(1000)
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
const cowsay = require('cowsay2');
|
||||
const cows = require('cowsay2/cows');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'cowsay',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'cows',
|
||||
usages: [
|
||||
"<message>",
|
||||
"list"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (args[0]?.toLowerCase() === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
for (const value of list) {
|
||||
content.push([
|
||||
{
|
||||
text: value + ' ',
|
||||
color: (!((color = !color)) ? 'blue' : 'dark_blue'),
|
||||
}
|
||||
])
|
||||
}
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, content)
|
||||
} else if (cows[args[0]]) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
text: cowsay.say(args.slice(1).join(' '),
|
||||
{ cow: cows[args[0]] })
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: cowsay.say(args.slice(0).join(' ')) })
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
let Embed
|
||||
if (args[0] === "list") {
|
||||
const list = Object.keys(cows);
|
||||
let content = [];
|
||||
let color = true;
|
||||
for (const value of list) {
|
||||
content.push([
|
||||
{
|
||||
text: value + ' ',
|
||||
}
|
||||
])
|
||||
}
|
||||
const ansiList = bot.getMessageAsPrismarine(content)?.toString();
|
||||
const fixAnsiList = fixansi(ansiList.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiList}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else if (cows[args[0]]) {
|
||||
const ansiCow1 = bot.getMessageAsPrismarine({ text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })?.toAnsi()
|
||||
const fixAnsiCow1 = fixansi(ansiCow1.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fixAnsiCow1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
} else {
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${cowsay.say(args.slice(0).join(' '))}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class EchoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("echo", ["say", "botsay"], "make me say something!", 0, [
|
||||
"<message>",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EchoCommand;
|
||||
+432
-468
@@ -1,482 +1,446 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const sleep = require('../../util/sleep.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'help',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"hell",
|
||||
"hello",
|
||||
"helo",
|
||||
"commands",
|
||||
"commandshelp",
|
||||
],
|
||||
description: 'a list of the bots commands',
|
||||
usages: [
|
||||
"",
|
||||
"<command>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const commandList = [];
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class HelpCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
["heko", "?", "cmds", "commands", "hell"],
|
||||
"see a list of commands",
|
||||
0,
|
||||
["<command>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: "blue", text: "Admin" },
|
||||
{ color: "gray", text: " | " },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
let usagesComponent = [];
|
||||
let commandComponent = [];
|
||||
for (const usages of command.data.usages) {
|
||||
if (command?.data?.trustLevel === 1) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <trusted/admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 2) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <admin/owner hashes>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 3) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name} <owner hash>`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
} else if (command?.data.trustLevel === 0 || command.data.trustLevel === 4) {
|
||||
usagesComponent.push({
|
||||
translate: "%s%s %s",
|
||||
with: [
|
||||
{ text: `${config.prefixes[0]}`, color: "dark_blue" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: `${usages}`, color: "aqua" },
|
||||
]
|
||||
})
|
||||
}
|
||||
usagesComponent.push('\n');
|
||||
let Console = [];
|
||||
|
||||
let cat = {
|
||||
translate: "(%s | %s | %s | %s)",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "Public", color: config.colors.help.public },
|
||||
{ text: "Trusted", color: config.colors.help.trusted },
|
||||
{ text: "Admin", color: config.colors.help.admin },
|
||||
{ text: "Owner", color: config.colors.help.owner },
|
||||
],
|
||||
};
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%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,
|
||||
},
|
||||
cat,
|
||||
],
|
||||
});
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
switch (commands.data.trustLevel) {
|
||||
case 0:
|
||||
Public.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.public,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
trusted.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.trusted,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
admin.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.admin,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
owner.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.owner,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
Console.push({
|
||||
text: commands.data.name + " ",
|
||||
color: config.colors.help.console,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
translate: "%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s: %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
text: "Command Name",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{
|
||||
text: "Trust Level",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.trustLevel}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: "Description",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${commands.data.description}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Aliases", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.aliases}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "Usages", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${commands.data.usages}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: "suggest_command",
|
||||
value: `${config.prefixes[0]}${commands.data.name}`,
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(
|
||||
`fuck you ${commands.data.name} has a invalid trust level`,
|
||||
);
|
||||
}
|
||||
usagesComponent.pop();
|
||||
commandComponent.push({
|
||||
translate: "%s %s %s\n%s %s %s\n%s %s %s\n%s %s %s\n%s %s",
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: "Command Name", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.name}`, color: "blue" },
|
||||
{ text: "Aliases", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.aliases.toString().replaceAll(',',' ')}`, color: "blue" },
|
||||
{ text: "Description", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.description}`, color: "blue" },
|
||||
{ text: "Trust Level", color: "dark_blue" },
|
||||
{ text: "\u203a" },
|
||||
{ text: `${command.data.trustLevel}`, color: "gold" },
|
||||
{ text: "Usages", color: "dark_blue" },
|
||||
{ text: "\u203a" }
|
||||
]
|
||||
})
|
||||
commandComponent.push("\n");
|
||||
commandComponent.push(usagesComponent);
|
||||
// for (const aliases of command.aliases) {
|
||||
if (args[0]?.toLowerCase() === command.data.name) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return;
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
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");
|
||||
}
|
||||
/* } if (args[0]?.toLowerCase() === aliases) {
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine(commandComponent)?.toMotd().replaceAll('§','&')}`)
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, commandComponent)
|
||||
}
|
||||
return
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
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);
|
||||
|
||||
if (source?.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(infoComponent)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(infoComponent)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a`, infoComponent);
|
||||
}
|
||||
console.log(aliases)*/
|
||||
// }
|
||||
// tellraw @p {"text":"this","clickEvent":{"action":"suggest_command","value":"this"}}
|
||||
if (command.data.trustLevel === 0) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 1) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 2) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
} else if (command.data.trustLevel === 3) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: `Command: ${command.data.name}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Trust Level: `,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `${command.data.trustLevel}\n`,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: `${command.data.description}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: `Command Aliases: ${command.data.aliases}\n`,
|
||||
color: 'blue'
|
||||
},
|
||||
{
|
||||
text: 'click on me to use me :)',
|
||||
color: 'dark_blue',
|
||||
},
|
||||
],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${config.prefixes[0]}${command?.data.name}`
|
||||
}
|
||||
}
|
||||
])
|
||||
return;
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel != 4).length
|
||||
if (bot.options.useChat) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
text: 'Commands (',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: length,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: ') ',
|
||||
color: 'gray'
|
||||
},
|
||||
category,
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 300)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 300)
|
||||
} else if (bot.options.isSavage) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
text: 'Commands (',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: length,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: ') ',
|
||||
color: 'gray'
|
||||
},
|
||||
category,
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 400)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 400)
|
||||
} else if (bot.options.isCreayun) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine([
|
||||
{
|
||||
text: 'Commands (',
|
||||
color: 'gray'
|
||||
},
|
||||
{
|
||||
text: length,
|
||||
color: 'gold'
|
||||
},
|
||||
{
|
||||
text: ') ',
|
||||
color: 'gray'
|
||||
},
|
||||
category,
|
||||
])?.toMotd().replaceAll('§','&'))
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(public)?.toMotd().replaceAll("§","&"))
|
||||
}, 2500)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(trusted)?.toMotd().replaceAll("§","&"));
|
||||
}, 2500)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(admin)?.toMotd()?.replaceAll('§','&'))
|
||||
}, 2500)
|
||||
setTimeout(() => {
|
||||
bot.chat.message(bot.getMessageAsPrismarine(owner).toMotd().replaceAll("§","&"));
|
||||
}, 2500)
|
||||
} else if (admin.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
{ text: JSON.stringify(length), color: 'gold' },
|
||||
{ text: ') ', color: 'gray' },
|
||||
category,
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
owner
|
||||
])
|
||||
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
if (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, [
|
||||
{ text: 'Commands (', color: 'gray' },
|
||||
{ text: JSON.stringify(length), color: 'gold' },
|
||||
{ text: ') ', color: 'gray' },
|
||||
category,
|
||||
'\n',
|
||||
public,
|
||||
trusted,
|
||||
admin,
|
||||
owner
|
||||
])
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const category = {
|
||||
translate: '(%s%s%s%s%s%s%s) \u203a ',
|
||||
bold: false,
|
||||
color: 'gray',
|
||||
with: [
|
||||
{ color: "aqua", text: 'Public'},
|
||||
{ color: "gray", text: ' | '},
|
||||
{ color: "dark_aqua", text: 'Trusted'},
|
||||
{ color: 'gray', text: ' | '},
|
||||
{ color: 'blue', text: 'Admin' },
|
||||
{ color: 'gray', text: ' | ' },
|
||||
{ color: "dark_blue", text: 'Owner'},
|
||||
]
|
||||
}
|
||||
let public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
for (const command of bot.commandManager.commandlist) {
|
||||
if (args[0] === command.data.name) {
|
||||
const ansi = bot.getMessageAsPrismarine([ { text: `CommandName \u203a ${command.data.name}\n`, color: 'gray', }, { text: `Aliases \u203a ${command.data.aliases}\n`, color: 'gray', }, { text: `Description \u203a ${command.data.description}\n`, color: 'gray', }, { text: `trustLevel \u203a ${command.data.trustLevel}\n`, color: 'gray' }, { text: `Usages \u203a ${command?.data.usages}`, color: "dark_gray" }, ])?.toAnsi().replaceAll('```\u001b[9```' + '```\u001b[3```')
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
return
|
||||
}
|
||||
if (command?.data.trustLevel === 0 && command.discordExecute) {
|
||||
public.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "aqua",
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 1 && command.discordExecute) {
|
||||
trusted.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_aqua"
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 2 && command.discordExecute) {
|
||||
admin.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: 'blue'
|
||||
}
|
||||
])
|
||||
} else if (command?.data.trustLevel === 3 && command.discordExecute) {
|
||||
owner.push([
|
||||
{
|
||||
text: command.data.name + ' ',
|
||||
color: "dark_blue",
|
||||
}
|
||||
])
|
||||
}
|
||||
}
|
||||
const length = bot.commandManager.commandlist.filter(c => c.data.trustLevel !== 4 && c.discordExecute).length
|
||||
const ansi1 = bot.getMessageAsPrismarine([ { text: 'Commands (', color: 'gray' }, { text: JSON.stringify(length), color: 'gold' }, { text: ') ', color: 'gray' }, category, '\n', public, trusted, owner ])?.toAnsi();
|
||||
const fix1 = fixansi(ansi1.replaceAll('`', '`\u200b'))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
bot?.discord?.message.react('♋')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
||||
|
||||
@@ -0,0 +1,608 @@
|
||||
const os = require("os");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fs = require("fs");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const fixansi = require("../../util/ansi.js");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
pad(`${seconds} Seconds`)
|
||||
);
|
||||
}
|
||||
|
||||
class InfoCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("info", ["information"], "check the bots info", 0, [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
]);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
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: `${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",
|
||||
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: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", 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: "Server Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(os.totalmem() / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: "Bot Memory",
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{ text: "MB", 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\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: "Processes", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`,
|
||||
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 (source?.sources?.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi())}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = InfoCommand;
|
||||
@@ -1,101 +1,54 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const fixansi = require('../../util/ansi');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'list',
|
||||
description: 'check the player list',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'playerlist',
|
||||
'plist',
|
||||
'pl'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments
|
||||
const players = bot.players
|
||||
const source = context.source
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ListCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("list", ["pl", "playerlist"], "check whos online on the server", 0, [
|
||||
"",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
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 %s %s: %s]`,
|
||||
color: 'dark_gray',
|
||||
translate: "%s \u203a %s [%s: %s]",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
{
|
||||
text: `${player.uuid}`,
|
||||
color: 'dark_blue',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: `${player.uuid}`
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'click here to copy the player\'s uuid',
|
||||
color: 'aqua'
|
||||
}]
|
||||
}
|
||||
},
|
||||
{ text: `Ping`, color: 'dark_blue' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'dark_gray' },
|
||||
{ text: `Gamemode`, color: 'dark_blue' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
{ 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()
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }])?.toMotd().replaceAll('§','&')}`)
|
||||
setTimeout(() => {
|
||||
for (const player of bot.players) {
|
||||
bot.chat.message(`${bot.getMessageAsPrismarine([player.displayName ?? player.profile.name, ' &8', player.uuid,` &r&8[&2Ping: &6${player.latency}&8 / &5Gamemode: &6${player.gamemode}&8]`]).toMotd().replaceAll('§', '&')}`)
|
||||
}
|
||||
}, 300)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.tellraw(`@a[name="${source.player.profile.name}"]`, [
|
||||
{ text: `Players`, color: 'dark_blue' },
|
||||
{ text: ': ', color: 'dark_gray' },
|
||||
{ text: '(' , color: 'dark_gray' },
|
||||
{ text: `${JSON.stringify(bot.players.length)}`, color: 'gold' },
|
||||
{ text: ')\n', color: 'dark_gray' },
|
||||
component
|
||||
])
|
||||
component.pop();
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
},
|
||||
discordExecute(context) {
|
||||
const bot = context.bot
|
||||
const players = bot.players
|
||||
const component = []
|
||||
for (const player of players) {
|
||||
component.push({
|
||||
translate: `%s \u203a %s [%s %s %s %s %s]`,
|
||||
with: [
|
||||
player.displayName ?? player.profile.name,
|
||||
player.uuid,
|
||||
{ text: `Ping:`, color: 'dark_green' },
|
||||
{ text: `${player.latency}`, color: 'gold' },
|
||||
{ text: '/', color: 'gray' },
|
||||
{ text: `Gamemode:`, color: 'dark_purple' },
|
||||
{ text: `${player.gamemode}`, color: 'gold' },
|
||||
]
|
||||
})
|
||||
component.push('\n')
|
||||
}
|
||||
component.pop()
|
||||
const ansi = bot.getMessageAsPrismarine([{ text: `Players: `, color:'gray' }, { text: '(' , color: 'gray' }, { text: `${JSON.stringify(bot.players.length)}`, color: 'gold' }, { text: ')\n', color: 'gray' }, component])?.toAnsi()
|
||||
const fix = fixansi(ansi.replaceAll('`', '`\u200b').substring(0, 3080))
|
||||
const Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ListCommand;
|
||||
|
||||
@@ -1,60 +1,52 @@
|
||||
const { request } = require('undici');
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const mc = require('minecraft-protocol');
|
||||
const util = require('util')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'mcserver',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"pingserver",
|
||||
"pingsrv",
|
||||
],
|
||||
description: 'look up minecraft server info',
|
||||
usages: [
|
||||
"<minecraft server ip>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
try {
|
||||
const [host, port] = args[0].split(':')
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
component.push({
|
||||
translate: '%s %s %s:%s\n%s %s %s / %s\n%s %s %s\n%s %s %s',
|
||||
color: 'dark_gray',
|
||||
with: [
|
||||
{ text: 'Ip', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${host}`, color: 'dark_blue' },
|
||||
{ text: `${Number(port ?? 25565)}`, color: 'gold' },
|
||||
{ text: 'Players', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${server.players.online}`, color: 'gold' },
|
||||
{ text: `${server.players.max}`, color: 'gold' },
|
||||
{ text: 'Version', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
{ text: `${server.version.name}`, color: 'blue' },
|
||||
{ text: 'Motd', color: 'dark_blue' },
|
||||
{ text: '\u203a' },
|
||||
server.description
|
||||
]
|
||||
})
|
||||
const mc = require("minecraft-protocol");
|
||||
const util = require("util");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
class McserverCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("mcserver", ["pingserver"], "pings minecraft servers", 0, ["<ip>"]);
|
||||
}
|
||||
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`Ip \u203a ${host}:${Number(port ?? 25565)}`);
|
||||
bot.chat.message(`Players \u203a ${server.players.online} / ${server.players.max}`);
|
||||
bot.chat.message(`Version \u203a ${server.version.name}`);
|
||||
bot.chat.message(bot.getMessageAsPrismarine(server.description)?.toMotd().replaceAll('§','&'));
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const [host, port] = args[0].split(":");
|
||||
const source = context.source;
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) });
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "ip", color: config.colors.commands.primary },
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{
|
||||
text: `${Number(port ?? 25565)}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
{ text: "players", color: config.colors.commands.primary },
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer },
|
||||
{ text: "server version", color: config.colors.commands.primary },
|
||||
{
|
||||
text: `${server.version.name}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
server.description,
|
||||
],
|
||||
});
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component);
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`)
|
||||
console.log(e.stack);
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = McserverCommand;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'memusage',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the bots and the servers ram usage',
|
||||
usages: [
|
||||
"on/enable/true",
|
||||
"off/disable/false",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "enable":
|
||||
case "true":
|
||||
bot.memUsage.enabled = true;
|
||||
bot.chat.message('enabled memusage');
|
||||
break;
|
||||
case "off":
|
||||
case "enable":
|
||||
case "false":
|
||||
bot.memUsage.enabled = false;
|
||||
bot.chat.message('disabled memusage');
|
||||
break;
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -1,84 +1,65 @@
|
||||
const CommandError = require('../../util/command_error.js')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'netmsg',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
],
|
||||
description: 'netmsg to other servers',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments;
|
||||
class NetmsgCommand extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"netmsg",
|
||||
["networkmessage", "netmessage"],
|
||||
"send a message to other servers",
|
||||
0,
|
||||
["<message>"],
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
|
||||
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
|
||||
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
if (bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
component.push({
|
||||
translate: "[%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: bot.options.serverName, color: "blue" },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
} else if (!bot.options.private) {
|
||||
component = {
|
||||
translate: '[%s:%s] %s \u203a %s',
|
||||
color: "dark_gray",
|
||||
{
|
||||
text: `${bot.options.serverName}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{
|
||||
text: `${args.join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
component.push({
|
||||
translate: "[%s:%s] %s \u203a %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: bot.options.host, color: "blue" },
|
||||
{ text: `${bot.options.port}`, color: "gold" },
|
||||
{
|
||||
text: `${bot.options.host}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
{
|
||||
text: `${bot.options.port}`,
|
||||
color: config.colors.commands.primary,
|
||||
},
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
{ text: args.join(' '), color: "blue" },
|
||||
]
|
||||
}
|
||||
{
|
||||
text: `${args.join(" ")}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
bot.bots.filter((eachBot) => {
|
||||
if (!eachBot.options.isKaboom || eachBot.options.useChat) {
|
||||
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd().replaceAll('§','&')}`);
|
||||
} else if (eachBot.options.isKaboom && !eachBot.options.useChat) {
|
||||
eachBot.tellraw("@a", component);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = NetmsgCommand;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class RefillcoreCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("refillcore", ["rc", "refill"], "refill the bots core", 0, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move(bot.position);
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
}
|
||||
}
|
||||
module.exports = RefillcoreCommand;
|
||||
@@ -1,46 +0,0 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'test',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"error stack <message>",
|
||||
"error message <message>",
|
||||
"message <message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (!args && !args[0] && !args[1]) return
|
||||
switch (args[0]) {
|
||||
case 'error':
|
||||
switch (args[1]) {
|
||||
case 'stack':
|
||||
throw new Error(args.slice(2).join(' '));
|
||||
break
|
||||
case 'message':
|
||||
throw new CommandError(args.slice(2).join(' '));
|
||||
break
|
||||
}
|
||||
break;
|
||||
case "message":
|
||||
bot.tellraw("@a", [
|
||||
{
|
||||
text: `Hello, World!, Player: ${bot.getMessageAsPrismarine(context.source.player.displayName ?? context.source.player.profile.name)?.toMotd()}§r`,
|
||||
color: 'gray',
|
||||
bold: false
|
||||
},
|
||||
{
|
||||
text: ` Args: ${args.slice(1).join(' ')}`,
|
||||
color: 'gray',
|
||||
bold: false,
|
||||
}
|
||||
])
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +1,121 @@
|
||||
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',
|
||||
description: 'urban dictionary',
|
||||
aliases: [
|
||||
'urbandictionary'
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { AttachmentBuilder } = require("discord.js");
|
||||
|
||||
class UrbanCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("urban", ["urbandictionary"], "urban dictionary", 0, [
|
||||
"<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}`
|
||||
}
|
||||
},
|
||||
])
|
||||
}
|
||||
if (bot.options.useChat) {
|
||||
for (const definitions of list) {
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ text: `${definitions.example.replaceAll('\r','').replaceAll('[', '\xa71\xa7n\xa7o').replaceAll(']','\xa7r\xa77')}\n`})?.toMotd().replaceAll("§","&"));
|
||||
// bot.chat.message(definitions.example.replaceAll("\r", ""));
|
||||
}
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
}
|
||||
},
|
||||
async discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
]);
|
||||
}
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const component = [];
|
||||
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 (bot.options.mode === "savageFriends") {
|
||||
bot.chat.message(
|
||||
"this command is disabled for this server for right now sorry!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
|
||||
}
|
||||
|
||||
for (const 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}`,
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
const discordOutput = fixansi(
|
||||
bot.getMessageAsPrismarine(component)?.toAnsi(),
|
||||
);
|
||||
|
||||
if (discordOutput.length > 2000) {
|
||||
const output = fs.writeFileSync(
|
||||
path.join(__dirname, "../../output.txt"),
|
||||
JSON.stringify(bot.getMessageAsPrismarine(component)?.toString()),
|
||||
);
|
||||
|
||||
const file = new AttachmentBuilder(
|
||||
path.join(__dirname, "../../output.txt"),
|
||||
);
|
||||
|
||||
bot.discord.message.reply("output", {
|
||||
files: [file],
|
||||
});
|
||||
// bot.discord.message.reply('meow') //[{
|
||||
// files: path.join(__dirname, '../../output.txt')
|
||||
// }])
|
||||
|
||||
// fs.unlinkSync(path.join(__dirname, '../../output.txt'))
|
||||
} else {
|
||||
bot.discord.message.reply(`\`\`\`ansi\n${discordOutput}\`\`\``);
|
||||
}
|
||||
// console.log(discordOutput.length)
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(`minecraft:tellraw @a ${JSON.stringify(component)}`);
|
||||
} else {
|
||||
bot.tellraw(`@a`, component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UrbanCommand;
|
||||
|
||||
+112
-160
@@ -1,170 +1,122 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'weather',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
],
|
||||
description: 'check the weather of cities',
|
||||
usages: [
|
||||
"<city/zipcode>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class WeatherCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("weather", [], "check the weather in locations", 0, [
|
||||
"<weather/zip code>",
|
||||
]);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
let component;
|
||||
const weather = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
|
||||
const info = await weather.body.json();
|
||||
component = new MessageBuilder()
|
||||
.setTranslate("%s\n%s\n%s: %s (%s)\n%s\n%s\n%s: %s\n%s: %s")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s, %s %s")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Location")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.location.name)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.location.region)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.location.country)
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s, %s")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Coords")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${info.location.lat}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${info.location.lon}`)
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Time")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(`${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(`${info.location.tz_id}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s (%s), %s (%s)")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Temp")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.temp_c)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("\u00b0C")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.temp_f)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("\u00b0F")
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setTranslate("%s: %s (%s, %s), %s (%s, %s)")
|
||||
.setColor(config.colors.commands.tertiary)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Wind Speed")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.wind_kph)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("kph")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.current.wind_dir)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.wind_mph)}`)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText("mph")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.current.wind_dir)
|
||||
)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Condition")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.secondary)
|
||||
.setText(info.current.condition.text)
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.commands.primary)
|
||||
.setText("Humidity")
|
||||
)
|
||||
.addWith(new MessageBuilder()
|
||||
.setColor(config.colors.integer)
|
||||
.setText(`${Math.floor(info.current.humidity)}`)
|
||||
)
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.message(`Location: ${info.location.name}, ${info.location.region}, ${info.location.country}`);
|
||||
bot.chat.message(`Latitude: ${info.location.lat}`);
|
||||
bot.chat.message(`Longitude: ${info.location.lon}`);
|
||||
bot.chat.message(`Time: ${new Date().toLocaleTimeString("en-US", { timeZone: info.location.tz_id, })}(${info.location.tz_id})`);
|
||||
bot.chat.message(`Temp: ${info.current.temp_c}(\u00b0C), ${info.current.temp_f}(\u00b0F)`);
|
||||
bot.chat.message(`Wind speed: ${info.current.wind_kph}(KPH), ${info.current.wind_mph}(MPH)`);
|
||||
bot.chat.message(`Condition: ${info.current.condition.text}`);
|
||||
bot.chat.message(`Humidity: ${info.current.humidity}`);
|
||||
const url = await request(
|
||||
`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(" ").replaceAll(" ", "%20")}`,
|
||||
);
|
||||
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,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')" && args.length !== 0) {
|
||||
bot.chat.message('The location is invalid please try a valid location');
|
||||
} else if (args.length === 0) {
|
||||
bot.chat.message('there were no arguments detected')
|
||||
} else {
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
console.warn(e.stack);
|
||||
}
|
||||
bot.chat.message(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WeatherCommand;
|
||||
|
||||
@@ -1,39 +1,45 @@
|
||||
const wiki = require('wikipedia');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'wiki',
|
||||
description: 'wikipedia',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'wikipedia'
|
||||
],
|
||||
usages:[
|
||||
"<article>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const wiki = require("wikipedia");
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fixansi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class WikiCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("wiki", ["wikipedia"], "wikipedia", 0, ["<article>"]);
|
||||
}
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
const config = context.config;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '))
|
||||
const page = await wiki.page(args.join(" "));
|
||||
const summary = await page.intro();
|
||||
bot.tellraw("@a", new MessageBuilder()
|
||||
.setText(summary)
|
||||
.setColor("gray")
|
||||
)
|
||||
} catch (error) {
|
||||
if (error.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
|
||||
bot.tellraw("@a", new MessageBuilder()
|
||||
.setText("Article not found!")
|
||||
.setColor("red")
|
||||
)
|
||||
|
||||
component.push({ text: summary, color: config.colors.commands.primary });
|
||||
|
||||
if (source.sources.console) {
|
||||
bot.console.info(bot.getMessageAsPrismarine(component)?.toAnsi());
|
||||
} else if (source.sources.discord) {
|
||||
bot.discord.message.reply(
|
||||
`\`\`\`ansi\n${new fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()).ansi}\`\`\``,
|
||||
);
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${error.toString()}`)
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
} catch (e) {
|
||||
if (
|
||||
e.toString() ===
|
||||
"pageError: TypeError: Cannot read properties of undefined (reading 'pages')"
|
||||
) {
|
||||
bot.tellraw("@a", { text: "no article found!", color: "red" });
|
||||
} else {
|
||||
bot.tellraw(`@a`, `${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WikiCommand;
|
||||
|
||||
@@ -1,161 +1,108 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const CommandError = require('../../util/command_error');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'cloop',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"commandloop"
|
||||
],
|
||||
description: 'run cloops',
|
||||
usages: [
|
||||
const CommandError = require("../../command_util/command_error");
|
||||
const fixAnsi = require("../../util/ansi");
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class CloopCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("cloop", ["commandloop", "loop"], "loops commands", 1, [
|
||||
"add <interval> <command>",
|
||||
"remove <index>",
|
||||
"clear",
|
||||
"list",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const source = context.source
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
switch (args[1]) {
|
||||
case 'add':
|
||||
if (isNaN(args[2])) throw new CommandError({ text: 'Invalid interval', color: 'red' })
|
||||
//bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid interval', color: 'red' })
|
||||
const interval = parseInt(args[2])
|
||||
const command = args.slice(3).join(' ');
|
||||
bot.cloop.add(command, interval)
|
||||
"clear",
|
||||
]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
let args;
|
||||
let component = [];
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
translate: 'Added \'%s\' with interval %s to the cloops',
|
||||
color: 'gray',
|
||||
with: [ command, { text: `${interval}`, color: 'gold' } ]
|
||||
})
|
||||
break
|
||||
case 'remove':
|
||||
if (parseInt(args[2]) === NaN) bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid index', color: 'red' })
|
||||
if (!source.sources.console && !source.sources.discord) {
|
||||
args = context.arguments.slice(16);
|
||||
} else {
|
||||
args = context.arguments;
|
||||
}
|
||||
|
||||
const index = parseInt(args[2])
|
||||
if (
|
||||
!args &&
|
||||
!args[0] &&
|
||||
!args[1] &&
|
||||
!args[2] &&
|
||||
!args[3] &&
|
||||
!args[4] &&
|
||||
!args[5]
|
||||
)
|
||||
return;
|
||||
|
||||
bot.cloop.remove(index)
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "add":
|
||||
if (isNaN(args[1])) throw new CommandError("invalid interval");
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, {
|
||||
translate: 'Removed cloop %s',
|
||||
color: 'gray',
|
||||
with: [ { text: `${index}`, color: 'gold' } ]
|
||||
})
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
const interval = parseInt(args[1]);
|
||||
const command = args.slice(2).join(" ");
|
||||
bot.cloop.add(command, interval);
|
||||
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Cleared all cloops' })
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
component.push(
|
||||
`added ${command} to the cloops with the interval ${interval}`,
|
||||
);
|
||||
break;
|
||||
case "clear":
|
||||
bot.cloop.clear();
|
||||
component.push("cleared the cloops");
|
||||
break;
|
||||
case "remove":
|
||||
if (isNaN(args[1]))
|
||||
throw new CommandError("argument must be an integer!");
|
||||
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
const index = parseInt(args[1]);
|
||||
bot.cloop.remove(index);
|
||||
|
||||
component.push(`removed ${index} from cloops`);
|
||||
break;
|
||||
case "list":
|
||||
let listComponent = [];
|
||||
let i = 0;
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
color: 'gray',
|
||||
translate: "%s \u203a %s (%s)",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${i}`, color: 'gold' },
|
||||
{ text: `${i}`, color: config.colors.integer },
|
||||
cloop.command,
|
||||
{ text: `${cloop.interval}`, color: 'gold'},
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
{ text: `${cloop.interval}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
listComponent.push("\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
listComponent.pop()
|
||||
listComponent.pop();
|
||||
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
if (bot.cloop.list.length === 0) {
|
||||
bot.tellraw(`@a[name="${source?.player.profile?.name}"]`, {
|
||||
translate: 'Cloops (%s):',
|
||||
color: 'gray',
|
||||
with: [ { text: `${bot.cloop.list.length}`, color: 'gold' } ]
|
||||
})
|
||||
} else {
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, component)
|
||||
translate: "Cloops (%s):",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.cloop.list.length}`, color: config.colors.integer },
|
||||
],
|
||||
});
|
||||
component.push("\n");
|
||||
|
||||
if (bot.cloop.list.length > 0) {
|
||||
component.push(listComponent);
|
||||
}
|
||||
break
|
||||
break;
|
||||
default:
|
||||
bot.tellraw(`@a[name="${source?.player?.profile?.name}"]`, { text: 'Invalid action', color: 'red' })
|
||||
break
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
let Embed;
|
||||
switch (args[0]) {
|
||||
case "add":
|
||||
const interval = parseInt(args[1])
|
||||
const command = args.slice(2).join(' ')
|
||||
bot.cloop.add(command, interval)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`Added ${command} with the interval ${interval} to the cloops`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break;
|
||||
case "remove":
|
||||
var index = (args[1])
|
||||
if (parseInt(args[1]) === NaN) throw new CommandError("invalid index");
|
||||
bot.cloop.remove(index)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`removed cloop ${index}`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
case 'clear':
|
||||
bot.cloop.clear()
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`cleared cloops`)
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
case 'list':
|
||||
const component = []
|
||||
const listComponent = []
|
||||
let i = 0
|
||||
for (const cloop of bot.cloop.list) {
|
||||
listComponent.push({
|
||||
translate: '%s \u203a %s (%s)',
|
||||
with: [
|
||||
`id ${i}`,
|
||||
cloop.command,
|
||||
cloop.interval
|
||||
]
|
||||
})
|
||||
listComponent.push('\n')
|
||||
i++
|
||||
}
|
||||
listComponent.pop()
|
||||
component.push({
|
||||
translate: 'Cloops (%s):',
|
||||
with: [ bot.cloop.list.length ]
|
||||
})
|
||||
component.push('\n')
|
||||
component.push(listComponent)
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(bot.getMessageAsPrismarine(component)?.toString())
|
||||
bot?.discord?.message?.reply({ embeds: [Embed] })
|
||||
break
|
||||
|
||||
if (source.sources.discord) {
|
||||
} else if (source.sources.console) {
|
||||
bot.console.info(component);
|
||||
} else {
|
||||
bot.tellraw("@a", component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CloopCommand;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'kick',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'kick or crash players',
|
||||
usages: [
|
||||
"invalidstring <player>",
|
||||
"item <player>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return
|
||||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command due to smth in the config being enabled');
|
||||
|
||||
switch (args[1]) {
|
||||
case 'invalidstring':
|
||||
bot.exploits.crashes.invalidString(`${args.slice(2).join(' ')}`);
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.kicks.item(`${args.slice(2).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
if (bot.options.useChat || bot.options.isSavage || bot.options.isCreayun) throw new CommandError('Cannot execute command!');
|
||||
switch (args[0]) {
|
||||
case "invalidstring":
|
||||
bot.exploits.crashes.invalidString(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
case 'item':
|
||||
bot.exploits.kicks.item(`${args.slice(1).join(' ')}`)
|
||||
break
|
||||
default:
|
||||
throw new CommandError('Invalid argument');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'reconnect',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
"end",
|
||||
"recon",
|
||||
],
|
||||
description: 'reconnect the bot',
|
||||
usages: [
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const message = context.arguments.join(' ')
|
||||
bot._client.end("disconnect :3")
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end("disconnect :3")
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
const between = require('../../util/between')
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'tpr',
|
||||
description: 'teleport to very fucked up coords',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
'rtp',
|
||||
'teleportrandom',
|
||||
'randomteleport'
|
||||
],
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
if (bot.options.isKaboom) {
|
||||
x = between(-30_000_000, 30_000_000)
|
||||
y = 100
|
||||
z = between(-30_000_000, 30_000_000)
|
||||
} else if (bot.options.isSavage) {
|
||||
x = between(-4096, 4096);
|
||||
y = 100
|
||||
z = between(-4096, 4096);
|
||||
}
|
||||
if (args.slice(1).join(' ')) {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: args.slice(1).join(' '), color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${args.slice(1).join(' ')} ${x} ${y} ${z}`);
|
||||
}
|
||||
} else {
|
||||
bot.tellraw("@a", [
|
||||
{ text: 'Randomly Teleported: ', color: 'gray' },
|
||||
{ text: source.player.profile.name, color: 'blue' },
|
||||
{ text: ' to ', color: 'gray' },
|
||||
{ text: `${x} `, color: 'gold' },
|
||||
{ text: `${y} `, color: 'gold' },
|
||||
{ text: `${z}`, color: 'gold' }
|
||||
])
|
||||
if (bot.options.isSavage) {
|
||||
bot.chat.command(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`)
|
||||
} else if (bot.options.isKaboom) {
|
||||
bot.core.run(`minecraft:tp ${source.player.profile.name} ${x} ${y} ${z}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
const CommandContext = require("../../command_util/command_context");
|
||||
|
||||
class ValidateCommand extends CommandContext {
|
||||
constructor() {
|
||||
super("validate", ["val"], "validate through the bot", 1, [""]);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args[0] === bot.validation.trusted) {
|
||||
bot.chat.message("&2Valid Trusted hash");
|
||||
}
|
||||
if (args[0] === bot.validation.admin) {
|
||||
bot.chat.message("&2Valid Admin hash");
|
||||
}
|
||||
if (args[0] === bot.validation.owner) {
|
||||
bot.chat.message("&2Valid Owner hash");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ValidateCommand;
|
||||
@@ -1,108 +0,0 @@
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const util = require('util');
|
||||
const fixansi = require('../../util/ansi');
|
||||
const CommandError = require('../../util/command_error')
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'website',
|
||||
trustLevel: 1,
|
||||
aliases: [
|
||||
],
|
||||
description: 'look up website data',
|
||||
usages: [
|
||||
"<url>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
if (args.slice(1).join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.slice(1).join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
try {
|
||||
bot.tellraw("@a", { text: util.inspect(rawData.toString().substring(0, 32750)), color: "dark_green" })
|
||||
} catch (e) {
|
||||
bot.tellraw("@a", e.toString());
|
||||
}
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.slice(1).join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
bot.tellraw("@a", { text: util.inspect(d.toString().substring(0, 32750)), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
let Embed;
|
||||
let fix;
|
||||
let ansi;
|
||||
//bot.discord.message.reply('e');
|
||||
if (args.join(' ').toLowerCase().startsWith("http://")) {
|
||||
http.get(args.join(' '), (res) => {
|
||||
const { statusCode } = res;
|
||||
const contentType = res.headers['content-type'];
|
||||
res.setEncoding('utf8');
|
||||
let rawData = '';
|
||||
res.on('data', (chunk) => { rawData += chunk; });
|
||||
res.on('end', () => {
|
||||
// try {
|
||||
// bot.tellraw("@a", { text: util.inspect(rawData), color: "dark_green" })
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(rawData.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.data.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// } catch (e) {
|
||||
// bot.tellraw("@a", e.toString());
|
||||
//throw new CommandError(e.toString())
|
||||
// }
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
});
|
||||
} else {
|
||||
https.get(args.join(' '), (res) => {
|
||||
res.on('data', (d) => {
|
||||
// bot.tellraw("@a", { text: util.inspect(d.toString()), color: "dark_green", })
|
||||
// console.log(Object.keys(d.toString().length));
|
||||
ansi = bot.getMessageAsPrismarine({ text: util.inspect(d.toString()), color: 'dark_green'})?.toAnsi()
|
||||
fix = fixansi(ansi.replaceAll('`', '`\u200b'))
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.datta.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
// bot.discord.message.reply('e');
|
||||
});
|
||||
}).on('error', (e) => {
|
||||
//bot.chat.message(`&4${e.toString()}`);
|
||||
//throw new CommandError(e.toString())
|
||||
});
|
||||
/*
|
||||
Embed = new EmbedBuilder()
|
||||
.setColor(`${config.colors.discord.embed}`)
|
||||
.setTitle(`${this.name} Command`)
|
||||
.setDescription(`\`\`\`ansi\n${fix1}\n\`\`\``)
|
||||
bot.discord.message.reply({ embeds: [Embed] })
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'coresettings',
|
||||
trustLevel: 2,
|
||||
aliases: [
|
||||
"cbsettings"
|
||||
],
|
||||
description: 'change the bots core settings',
|
||||
usages: [
|
||||
"useplacedcommandblock <on/off/true/false/enable/disable>",
|
||||
"area start <positions>",
|
||||
"area end <positions>",
|
||||
"refillmethod/rcmethod <item/chat>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3] && !args[4] && !args[5]) return;
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "useplacedcommandblock":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "on":
|
||||
case "true":
|
||||
case "enable":
|
||||
bot.core.usePlacedCommandBlock = true;
|
||||
bot.chat.message('now using the placed command block');
|
||||
break;
|
||||
case "off":
|
||||
case "false":
|
||||
case "disable":
|
||||
bot.core.usePlacedCommandBlock = false;
|
||||
bot.chat.message('no longer using the placed command block');
|
||||
break;
|
||||
default:
|
||||
if (bot.core.usePlacedCommandBlock) {
|
||||
bot.chat.message("the bot is currently using the placed command block to run its commands");
|
||||
} else {
|
||||
bot.chat.message("the bot is currently using its command block core to run its commands");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "area":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "start":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.start = config.core.area.start;
|
||||
bot.chat.message("arguments were NaN, defaulting to config core start coords");
|
||||
} else {
|
||||
bot.core.area.start = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5])
|
||||
};
|
||||
bot.chat.message(`setting core start pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
|
||||
}
|
||||
break;
|
||||
case "end":
|
||||
if (isNaN(args[3]) || isNaN(args[4]) || isNaN(args[5])) {
|
||||
bot.core.area.end = config.core.area.end;
|
||||
bot.chat.message("arguments were NaN, defaulting to config core end coords");
|
||||
} else {
|
||||
bot.core.area.end = {
|
||||
x: Number(args[3]),
|
||||
y: Number(args[4]),
|
||||
z: Number(args[5])
|
||||
};
|
||||
|
||||
bot.chat.message(`setting core end pos to x: ${args[3]}, y: ${args[4]}, z: ${args[5]}`);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(`core start pos: x: ${bot.core.area.start.x}, y: ${bot.core.area.start.y}, z: ${bot.core.area.start.z}, and end pos: x: ${bot.core.area.end.x}, y: ${bot.core.area.end.y}, z: ${bot.core.area.end.z} `)
|
||||
}
|
||||
break;
|
||||
case "refillmethod":
|
||||
case "rcmethod":
|
||||
switch (args[2]?.toLowerCase()) {
|
||||
case "item":
|
||||
config.core.itemRefill = true;
|
||||
bot.chat.message('now refilling via item');
|
||||
break;
|
||||
case "chat":
|
||||
config.core.itemRefill = false;
|
||||
bot.chat.message('now refilling via chat');
|
||||
break;
|
||||
default:
|
||||
if (config.core.itemRefill) {
|
||||
bot.chat.message("currently filling core via item");
|
||||
} else {
|
||||
bot.chat.message("currently filling core via chat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError('invalid argument');
|
||||
}
|
||||
},
|
||||
}
|
||||
+29
-43
@@ -1,39 +1,19 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
|
||||
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) {
|
||||
class kick extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"kick",
|
||||
[],
|
||||
"kick a player from the server",
|
||||
trustLevel.admin,
|
||||
["invalidstring", "item", "te"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
@@ -41,15 +21,21 @@ module.exports = {
|
||||
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;
|
||||
bot.exploits.crashes.invalidString(args[2]);
|
||||
bot.tellraw("@a", `crashing ${args[2]}`);
|
||||
break;
|
||||
case "item":
|
||||
bot.exploits.kicks.item(args[1]);
|
||||
bot?.discord?.message?.reply(`kicking ${args[1]}`)
|
||||
break;
|
||||
bot.exploits.kicks.item(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
case "te":
|
||||
bot.exploits.kicks.translateEntity(args[2]);
|
||||
bot.tellraw("@a", `kicking ${args[2]}`);
|
||||
break;
|
||||
default:
|
||||
throw new CommandError('invalid argument')
|
||||
throw new CommandError("invalid argument");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = kick;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "reconnect",
|
||||
aliases: [
|
||||
"end"
|
||||
],
|
||||
description: "reconnects the bot",
|
||||
usages: [
|
||||
|
||||
],
|
||||
trustLevel: 2,
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
bot._client.end();
|
||||
bot.chat.message('reconnecting')
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
|
||||
bot._client.end();
|
||||
bot?.discord?.message?.reply('reconnecting');
|
||||
}
|
||||
}
|
||||
@@ -1,127 +1,126 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'console',
|
||||
trustLevel: 4,
|
||||
description: "runs commands made for the bots console",
|
||||
aliases: [
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
],
|
||||
usages: [
|
||||
'server/srv <all/servername>',
|
||||
'customchat <on/true/enable/off/false/disable>',
|
||||
'say <message>',
|
||||
'validate/validation/val <owner/o/admin/a/trusted/t>',
|
||||
'logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>'
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot
|
||||
class console extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"console",
|
||||
["c"],
|
||||
"runs commands made for the bots console",
|
||||
trustLevel.console,
|
||||
[
|
||||
"server/srv <all/servername>",
|
||||
"customchat <on/true/enable/off/false/disable>",
|
||||
"say <message>",
|
||||
"validate/validation/val <owner/o/admin/a/trusted/t>",
|
||||
"logging/togglelogging/logtoconsole <on/true/enable/off/false/disable>",
|
||||
],
|
||||
false,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
if (!args && !args[0] && !args[1] && !args[2] && !args[3]) return;
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "server":
|
||||
case "svr":
|
||||
const servers = bot.bots.map(eachBot => eachBot.options.serverName);
|
||||
const servers = bot.bots.map((eachBot) => eachBot.options.serverName);
|
||||
for (const eachBot of bot.bots) {
|
||||
if (args.slice(1).join(' ').toLowerCase() === 'all') {
|
||||
eachBot.console.server = 'all'
|
||||
bot.console.info("Set the console server to all");
|
||||
continue
|
||||
}
|
||||
const server = servers.find(server => server.toLowerCase().includes(args[1]))
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return
|
||||
}
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
break
|
||||
case 'customchat':
|
||||
if (args[1] === 'off' || args[1] === 'false' || args[1] === 'disable') {
|
||||
bot.customChat.enabled = false
|
||||
bot.console.info('Custom Chat disabled');
|
||||
} if (args[1] === 'on' || args[1] === 'true' || args[1] === 'enable') {
|
||||
bot.customChat.enabled = true;
|
||||
bot.console.info('Custom Chat enabled');
|
||||
}
|
||||
break
|
||||
case 'say':
|
||||
if (bot.customChat.enabled === false) {
|
||||
bot.chat.send(args.slice(1).join(' '))
|
||||
// bot.commandManager.executeString(bot.console.source, `echo ${args.slice(1).join(' ')}`)
|
||||
} else if (bot.customChat.enabled === true) {
|
||||
if (args.slice(1).join(' ').startsWith('/')) {
|
||||
bot.chat.command(`${args.slice(1).join(' ').substring(1)}`)
|
||||
if (args.slice(1).join(" ").toLowerCase() === "all") {
|
||||
eachBot.console.server = "all";
|
||||
bot.console.info("Set the console server to all");
|
||||
continue;
|
||||
}
|
||||
const server = servers.find((server) =>
|
||||
server.toLowerCase().includes(args[1]),
|
||||
);
|
||||
if (!server) {
|
||||
bot.console.info("Invalid server");
|
||||
return;
|
||||
}
|
||||
bot.customChat.chat(args.slice(1).join(' '));
|
||||
bot.console.info(`Set the console server to ` + server);
|
||||
eachBot.console.server = server;
|
||||
}
|
||||
|
||||
break
|
||||
break;
|
||||
case "say":
|
||||
bot.chat.send(args.slice(1).join(" "));
|
||||
break;
|
||||
case "validate":
|
||||
case "validation":
|
||||
case "val":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case "owner":
|
||||
case "o":
|
||||
if (bot.customChat.enabled === true) {
|
||||
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
} else if (bot.customChat.enabled === false) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(' ')}`)
|
||||
}
|
||||
break
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.owner} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "admin":
|
||||
case "a":
|
||||
if (bot.customChat.enabled === true) {
|
||||
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
} else if (bot.customChat.enabled === false) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(' ')}`)
|
||||
}
|
||||
break
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.admin} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
case "trusted":
|
||||
case "t":
|
||||
if (bot.customChat.enabled === true) {
|
||||
bot.customChat.chat(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
} else if (bot.customChat.enabled === false) {
|
||||
bot.chat.message(`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(' ')}`);
|
||||
}
|
||||
break
|
||||
bot.chat.message(
|
||||
`${config.prefixes[0]}${args.slice(2).shift()} ${bot.validation.trusted} ${args.slice(3).join(" ")}`,
|
||||
);
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
break
|
||||
case 'logging':
|
||||
case 'togglelogging':
|
||||
case 'logtoconsole':
|
||||
break;
|
||||
case "logging":
|
||||
case "togglelogging":
|
||||
case "logtoconsole":
|
||||
switch (args[1]?.toLowerCase()) {
|
||||
case 'on':
|
||||
case 'enable':
|
||||
case 'enabled':
|
||||
case 'true':
|
||||
case "on":
|
||||
case "enable":
|
||||
case "enabled":
|
||||
case "true":
|
||||
if (bot.options.logging === true) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already enabled!`);
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already enabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now enabled`);
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now enabled`,
|
||||
);
|
||||
bot.options.logging = true;
|
||||
}
|
||||
break
|
||||
case 'off':
|
||||
case 'disable':
|
||||
case 'disabled':
|
||||
case 'false':
|
||||
break;
|
||||
case "off":
|
||||
case "disable":
|
||||
case "disabled":
|
||||
case "false":
|
||||
if (bot.options.logging === false) {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is already disabled!`);
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is already disabled!`,
|
||||
);
|
||||
} else {
|
||||
bot.console.info(`logging for ${bot.options.serverName} is now disabled`);
|
||||
bot.console.info(
|
||||
`logging for ${bot.options.serverName} is now disabled`,
|
||||
);
|
||||
bot.options.logging = false;
|
||||
}
|
||||
break
|
||||
break;
|
||||
}
|
||||
break
|
||||
break;
|
||||
default:
|
||||
bot.chat.message(bot.getMessageAsPrismarine({ translate: "command.unknown.argument", color: "dark_red" })?.toMotd().replaceAll("§","&"))
|
||||
throw new CommandError({
|
||||
translate: "command.unknown.argument",
|
||||
color: "dark_red",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = console;
|
||||
|
||||
+20
-19
@@ -1,23 +1,24 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'kill',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"suicide",
|
||||
"quit",
|
||||
],
|
||||
description: 'kill the bots process',
|
||||
usages: [
|
||||
""
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1);
|
||||
},
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
discordExecute (context) {
|
||||
class kill extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"kill",
|
||||
[
|
||||
"suicide",
|
||||
"quit"
|
||||
],
|
||||
"kill the bots process",
|
||||
trustLevel.owner,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
process.exit(1)
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
module.exports = kill;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
const CommandError = require('../../util/command_error.js');
|
||||
const { stylize } = require('../../util/stylizeEval');
|
||||
const util = require('util');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'servereval',
|
||||
trustLevel: 3,
|
||||
aliases: [
|
||||
"se"
|
||||
],
|
||||
description: 'run code unisolated',
|
||||
usages: [
|
||||
"<code>",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const args = context.arguments;
|
||||
const script = args.slice(1).join(' ');
|
||||
const { MessageBuilder } = require('prismarine-chat')(bot.options.version);
|
||||
try {
|
||||
if (source.sources.console) {
|
||||
bot.console.log(bot.getMessageAsPrismarine({ text: util.inspect(eval(args.join(' ')), { stylize })})?.toAnsi())
|
||||
} 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}"]`, {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
-21
@@ -1,23 +1,46 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "core",
|
||||
aliases: [
|
||||
"cb",
|
||||
"cbrun",
|
||||
"corerun"
|
||||
],
|
||||
trustLevel: 0
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
bot.core.run(args.join(' '));
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
|
||||
bot.core.run(args.join(' '));
|
||||
class core extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"core",
|
||||
[
|
||||
"cb",
|
||||
"cbrun",
|
||||
"corerun"
|
||||
],
|
||||
"run commands in core",
|
||||
trustLevel.public,
|
||||
[
|
||||
"$username <message>",
|
||||
"$uuid <message>",
|
||||
"<message>"
|
||||
],
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
if (args.includes("$username") || args.includes("$uuid")) {
|
||||
bot.players.forEach((eachPlayer) => {
|
||||
bot.core.runTracked(
|
||||
args
|
||||
.join(" ")
|
||||
.replaceAll("$username", eachPlayer.profile.name)
|
||||
.replaceAll("$uuid", eachPlayer.uuid),
|
||||
source,
|
||||
);
|
||||
});
|
||||
} else if (bot.options.mode === "savageFriends") {
|
||||
bot.core.run(args.join(" "));
|
||||
} else {
|
||||
bot.core.runTracked(args.join(" "), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = core;
|
||||
|
||||
+22
-25
@@ -1,29 +1,26 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'echo',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"say",
|
||||
"botsay",
|
||||
],
|
||||
description: 'Make me say something',
|
||||
usages: [
|
||||
"<message>"
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class echo extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"echo",
|
||||
[
|
||||
"say",
|
||||
"botsay"
|
||||
],
|
||||
"make me say something!",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
bot.chat.send(args.join(' '));
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
if (args.includes("@everyone") || args.includes("@here")) {
|
||||
bot.discord.message.reply("go fuck yourself");
|
||||
} else {
|
||||
bot.discord.message.channel.send(args.join(' '));
|
||||
}
|
||||
// bot.chat.send(args.join(' '));
|
||||
bot.chat.send(`${args.join(" ")}`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = echo;
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class extras extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"extras",
|
||||
[],
|
||||
"send messages via the extras channel",
|
||||
trustLevel.public,
|
||||
[
|
||||
"send",
|
||||
"register",
|
||||
"unregister",
|
||||
"unregisterall"
|
||||
],
|
||||
true,
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
if (
|
||||
!args
|
||||
&&
|
||||
!args[0]
|
||||
&&
|
||||
!args[1]
|
||||
&&
|
||||
!args[2]
|
||||
) return;
|
||||
|
||||
switch (args[0]) {
|
||||
case "send":
|
||||
bot.extras.send(args[1], args.slice(2).join(" "))
|
||||
source.sendFeedback(`sent ${args.slice(2).join(" ")} to channel ${args[1]}`)
|
||||
break
|
||||
case "register":
|
||||
bot.extras.register(args[1])
|
||||
source.sendFeedback(`registered ${args[1]} channel`)
|
||||
break
|
||||
case "unregister":
|
||||
bot.extras.unregister(args[1])
|
||||
source.sendFeedback(`unregistered from ${args[1]} channel`)
|
||||
console.log(bot.extras.channels)
|
||||
break
|
||||
case "unregisterall":
|
||||
bot.extras.unregisterAll();
|
||||
source.sendFeedback("unregistered all channels")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = extras;
|
||||
+202
-140
@@ -1,167 +1,229 @@
|
||||
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`);
|
||||
};
|
||||
}
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
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 },
|
||||
]
|
||||
});
|
||||
class help extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"help",
|
||||
[
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"commands",
|
||||
"hell"
|
||||
],
|
||||
"see a list of commands",
|
||||
trustLevel.public,
|
||||
["<command>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
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",
|
||||
description: "see the list of commands",
|
||||
aliases: [
|
||||
"heko",
|
||||
"?",
|
||||
"cmds",
|
||||
"commands",
|
||||
"hell",
|
||||
],
|
||||
usages: [
|
||||
"<command>"
|
||||
],
|
||||
trustLevel: 0,
|
||||
},
|
||||
execute (context) {
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let usagesComponent = [];
|
||||
let public = [];
|
||||
let Public = [];
|
||||
let trusted = [];
|
||||
let admin = [];
|
||||
let owner = [];
|
||||
let Console = [];
|
||||
|
||||
component.push({
|
||||
translate: "%s: (%s) \u203a\n",
|
||||
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 },
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.command_layout",
|
||||
fallback: translations["fnfboyfriendbot.command.help.command_layout"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ':', color: config.colors.commands.tertiary },
|
||||
{ text: '(', color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer },
|
||||
{ text: ')', color: config.colors.commands.tertiary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.category",
|
||||
fallback: translations["fnfboyfriendbot.command.help.category"],
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.public",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.public"],
|
||||
color: config.colors.help.public
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.trusted",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.trusted"],
|
||||
color: config.colors.help.trusted
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.admin",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.admin"],
|
||||
color: config.colors.help.admin
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.trust_level.owner",
|
||||
fallback: translations["fnfboyfriendbot.command.help.trust_level.owner"],
|
||||
color: config.colors.help.owner
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
for (const commands of bot.commandManager.commandlist) {
|
||||
commandListComponent(commands, config, public, trusted, admin, owner, Console);
|
||||
})
|
||||
|
||||
if (args[0] === commands.data.name) {
|
||||
infoComponents(commands, config, infoComponent, usagesComponent);
|
||||
bot.tellraw(`@a`, infoComponent);
|
||||
|
||||
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:
|
||||
}
|
||||
|
||||
if (
|
||||
args[0]?.toLowerCase() === commands.data.name?.toLowerCase() ||
|
||||
commands.data.aliases.find(
|
||||
(e) => e?.toLowerCase() === args[0]?.toLowerCase(),
|
||||
)
|
||||
) {
|
||||
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");
|
||||
}
|
||||
|
||||
usagesComponent.pop();
|
||||
|
||||
infoComponent.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.command",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.command"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.name,
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.alias",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.alias"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.aliases.toString().replaceAll(',',' ')
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.description",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.description"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
commands.data.description
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.info.trust_level",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.trust_level"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${commands.data.trustLevel}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.help.usages",
|
||||
fallback: translations["fnfboyfriendbot.command.help.info.usages"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
usagesComponent
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
})
|
||||
source.sendFeedback(infoComponent)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
component.push(public);
|
||||
component.push(trusted);
|
||||
component.push(admin);
|
||||
component.push(owner);
|
||||
component.push(Console);
|
||||
bot.tellraw("@a", component);
|
||||
},
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
if (Public.length > 0) {
|
||||
component.push(Public);
|
||||
if (trusted.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
component.push(public);
|
||||
component.push(trusted);
|
||||
component.push(admin);
|
||||
component.push(owner);
|
||||
component.push(Console);
|
||||
if (trusted.length > 0) {
|
||||
component.push(trusted);
|
||||
if (admin.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
bot?.discord?.message?.reply(`\`\`\`ansi\n${fixansi(bot.getMessageAsPrismarine(component)?.toAnsi()?.replaceAll('`', '`\u200b'))}\`\`\``);
|
||||
if (admin.length > 0) {
|
||||
component.push(admin);
|
||||
if (owner.length > 0) component.push("\n");
|
||||
}
|
||||
|
||||
if (owner.length > 0) {
|
||||
component.push(owner);
|
||||
}
|
||||
|
||||
if (source.sources.console && Console.length > 0) {
|
||||
component.push(Console);
|
||||
}
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = help;
|
||||
|
||||
+409
-353
@@ -1,10 +1,10 @@
|
||||
const os = require("os");
|
||||
const CommandError = require('../../util/command_error');
|
||||
const fs = require("fs");
|
||||
const botInfo = require('../../data/info.json');
|
||||
const fixansi = require('../../util/ansi.js');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const { execSync } = require('child_process')
|
||||
const CommandError = require("../../commandUtil/CommandError");
|
||||
const botInfo = require("../../data/info.json");
|
||||
const { execSync } = require("child_process");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
function format(seconds) {
|
||||
function pad(s) {
|
||||
return (s < 10 ? "0" : "") + s;
|
||||
@@ -12,390 +12,446 @@ function format(seconds) {
|
||||
var hours = Math.floor(seconds / (60 * 60));
|
||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||
var seconds = Math.floor(seconds % 60);
|
||||
return (pad(`${hours} Hours`) + " " +
|
||||
pad(`${minutes} Minutes`) + " " +
|
||||
pad(`${seconds} Seconds`))
|
||||
return (
|
||||
pad(`${hours} Hours`) +
|
||||
" " +
|
||||
pad(`${minutes} Minutes`) +
|
||||
" " +
|
||||
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":
|
||||
class info extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"info",
|
||||
["information"],
|
||||
"check the bots info",
|
||||
trustLevel.public,
|
||||
[
|
||||
"about",
|
||||
"config",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages ",
|
||||
"uptimes",
|
||||
"server",
|
||||
"version",
|
||||
],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
let component = [];
|
||||
|
||||
switch (args[0]?.toLowerCase()) {
|
||||
case "about":
|
||||
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 },
|
||||
]
|
||||
translate: "fnfboyfriendbot.command.info.about",
|
||||
fallback: translations["fnfboyfriendbot.command.info.about"],
|
||||
color: config.colors.commands.primary,
|
||||
})
|
||||
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":
|
||||
case "config":
|
||||
component.push({
|
||||
translate: "%s: %s\n%s: %s\n%s: %s",
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%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,
|
||||
translate: "fnfboyfriendbot.command.info.config.server.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.host}`, color: config.colors.commands.primary },
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.port}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.name",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.name"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
bot.options.serverName
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.minecraft.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.minecraft.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot._client.version}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.username",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.username"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${discordClient?.user?.tag}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.discord.channel",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.discord.channel"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.discord?.channel?.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.server.count",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.server.count"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.bots.length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.prefixes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.prefixes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${config.prefixes.map((e) => e + " ").join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.config.mode",
|
||||
fallback: translations["fnfboyfriendbot.command.info.config.mode"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${bot.options.mode}`, 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":
|
||||
})
|
||||
break;
|
||||
case "contributors":
|
||||
case "credits":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
translate: "%s%s - %s\n%s:\n%s\n%s\n%s\n%s\n%s\n%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 }
|
||||
{ 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/ImFloriz", color: "gold" },
|
||||
{ text: "Ploat/ImGloriz", color: "#cd8ccb" },
|
||||
{ text: "TurtleKid", color: "green" }
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "discord":
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.info.discord",
|
||||
fallback: translations["fnfboyfriendbot.command.info.discord"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${config.discord.invite}`, color: config.colors.commands.secondary }
|
||||
],
|
||||
hover_event: {
|
||||
action: "show_text",
|
||||
value: [
|
||||
{
|
||||
text: "click here to join the discord server!",
|
||||
color: `${config.colors.commands.primary}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
click_event: {
|
||||
action: "open_url",
|
||||
url: `${config.discord.invite}`,
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "loaded":
|
||||
component.push({
|
||||
translate: "%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.loaded.commands",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.commands"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.commandManager.commandlist.length}`, color: config.colors.integer}
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.loaded.modules",
|
||||
fallback: translations["fnfboyfriendbot.command.info.loaded.modules"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${bot.modules.length}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "server":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s",
|
||||
color: config.colors.commands.tertiary,
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.primary,
|
||||
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 },
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.hostname",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.hostname"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.hostname()}`, color: config.colors.commands.secondary },
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.user",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.user"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.userInfo().username}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.directory",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.directory"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${require.main.path}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.arch",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.arch"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.arch}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.platform}`, color: config.colors.commands.primary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.os.version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.os.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.version()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.kernel_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.kernel_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.release()}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus()[0].model}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.cpu.cores",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.cpu.cores"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${os.cpus().length}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.processes",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.processes"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("ps aux | wc -l").toString().replace("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.node_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.node_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${process.version}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.server.npm_version",
|
||||
fallback: translations["fnfboyfriendbot.command.info.server.npm_version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("npm -v").toString().replaceAll("\n", "")}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
break;
|
||||
case "all":
|
||||
component.push({
|
||||
translate: "%s: %s %s / %s %s\n%s: %s %s / %s %s",
|
||||
case "usages":
|
||||
component.push({
|
||||
translate: "%s\n%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 }
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.usages.botmem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.botmem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapUsed / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(process.memoryUsage().heapTotal / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.usages.servermem",
|
||||
fallback: translations["fnfboyfriendbot.command.info.usages.servermem"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576) - Math.floor(os.freemem() / 1048576)}`, color: config.colors.integer },
|
||||
{ text: `${Math.floor(os.totalmem() / 1048576)}`, color: config.colors.integer }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
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) {
|
||||
case "uptimes":
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s: %s\n%s: %s\n%s: %s\n%s: %s\n%s-%s",
|
||||
translate: "%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.bot",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.bot"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(process.uptime())}`}
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.uptimes.server",
|
||||
fallback: translations["fnfboyfriendbot.command.info.uptimes.server"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${format(os.uptime())}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
}
|
||||
],
|
||||
});
|
||||
break;
|
||||
case "version":
|
||||
component.push({
|
||||
translate: "%s %s %s-%s-%s\n%s\n%s\n%s\n%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: `${botInfo.buildstring.version}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
botInfo.buildstring.codename || '',
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${botInfo.buildstring.build}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.repo_build",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.repo_build"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${execSync("git rev-list --count --all").toString().replaceAll("\n", "")}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.version_release_date",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.version_release_date"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ text: `${new Date(execSync("git log -1 --format=%ci").toString()).toLocaleString("en-US", { timeZone: "America/CHICAGO" })}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.info.version.commit",
|
||||
fallback: translations["fnfboyfriendbot.command.info.version.commit"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: ":", color: config.colors.commands.tertiary },
|
||||
{ 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 },
|
||||
]
|
||||
{
|
||||
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",
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new CommandError({ translate: "command.unknown.argument", color: "dark_red" });
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'info',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
"information",
|
||||
],
|
||||
description: 'check the bots info',
|
||||
usages: [
|
||||
"about",
|
||||
"config <client, discord, options, all>",
|
||||
"contributors/credits",
|
||||
"discord",
|
||||
"loaded",
|
||||
"usages <bot, server, all>",
|
||||
"uptimes/uptime <bot, server, all>",
|
||||
"server",
|
||||
"version/ver",
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const discordClient = context.discordClient;
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
|
||||
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'))}\`\`\``);
|
||||
source.sendFeedback(component);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = info;
|
||||
|
||||
+24
-56
@@ -1,25 +1,26 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "list",
|
||||
aliases: [
|
||||
"pl",
|
||||
"playerlist"
|
||||
],
|
||||
description: "check whos online on the server",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
class list extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"list",
|
||||
[
|
||||
"pl",
|
||||
"playerlist"
|
||||
],
|
||||
"check whos online on the server",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false
|
||||
);
|
||||
}
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
|
||||
const source = context.source;
|
||||
let component = [];
|
||||
let infoComponent = [];
|
||||
let playerCount = [];
|
||||
|
||||
playerCount.push({
|
||||
@@ -31,6 +32,7 @@ module.exports = {
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
component.push(playerCount);
|
||||
|
||||
for (const player of bot.players) {
|
||||
@@ -43,47 +45,13 @@ module.exports = {
|
||||
{ text: "Latency", color: config.colors.commands.primary },
|
||||
{ text: `${player.latency}`, color: config.colors.integer }
|
||||
]
|
||||
});
|
||||
})
|
||||
component.push("\n");
|
||||
}
|
||||
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())}\`\`\``);
|
||||
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = list;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
const mc = require("minecraft-protocol");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class mcserver extends CommandContext {
|
||||
constructor() {
|
||||
super("mcserver",
|
||||
["pingserver"],
|
||||
"pings minecraft servers",
|
||||
trustLevel.public,
|
||||
["<ip>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations
|
||||
const [host, port] = args[0].split(':')
|
||||
|
||||
let component = [];
|
||||
if (isNaN(port) && port) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.arguments.invalid_integer",
|
||||
fallback: translations["fnfboyfriendbot.arguments.invalid_integer"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: "Port" }
|
||||
]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
console.log(error)
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.unknown",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.unknown"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${host}` },
|
||||
{ text: `${Number(port ?? 25565)}` }
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) })
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s",
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.ip",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.ip"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Number(port ?? 25565)}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.players",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.players"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.mcserver.server.version",
|
||||
fallback: translations["fnfboyfriendbot.command.mcserver.server.version"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${server.version.name}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
},
|
||||
server.description
|
||||
]
|
||||
})
|
||||
source.sendFeedback(component)
|
||||
}
|
||||
}
|
||||
module.exports = mcserver;
|
||||
@@ -1,22 +1,25 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "netmsg",
|
||||
aliases: [
|
||||
"networkmessage",
|
||||
"netmessage"
|
||||
],
|
||||
description: "send a message to other servers",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"message"
|
||||
]
|
||||
},
|
||||
execute (context) {
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class netmsg extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"netmsg",
|
||||
[
|
||||
"networkmessage",
|
||||
],
|
||||
"send a message to other servers that the bot is connected to",
|
||||
trustLevel.public,
|
||||
["<message>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
let component = [];
|
||||
|
||||
if (bot.options.private === true) {
|
||||
@@ -25,7 +28,7 @@ module.exports = {
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: `${bot.options.serverName}`, color: config.colors.commands.primary },
|
||||
source.player.displayName ?? source.player.profile.name,
|
||||
source?.player?.displayName ?? source?.player?.profile?.name,
|
||||
{ text: `${args.join(' ')}`, color: config.colors.commands.secondary }
|
||||
]
|
||||
})
|
||||
@@ -43,11 +46,9 @@ module.exports = {
|
||||
}
|
||||
|
||||
for (const eachBot of bot.bots) {
|
||||
if (eachBot.options.mode === "savageFriends" || eachBot.options.mode === "creayun") {
|
||||
eachBot.chat.message(`${bot.getMessageAsPrismarine(component)?.toMotd()?.replaceAll('§','&')}`)
|
||||
} else {
|
||||
eachBot.tellraw("@a", component)
|
||||
}
|
||||
eachBot.tellraw("@a", component)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = netmsg;
|
||||
@@ -1,46 +0,0 @@
|
||||
const mc = require('minecraft-protocol');
|
||||
const util = require('util');
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: "mcserver",
|
||||
aliases: [
|
||||
"pingserver"
|
||||
],
|
||||
description: "pings minecraft servers",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<ip>"
|
||||
]
|
||||
},
|
||||
async execute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const [host, port] = args[0].split(':');
|
||||
const server = await mc.ping({ host, port: Number(port ?? 25565) });
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
component.push({
|
||||
translate: "%s: %s:%s\n%s: (%s/%s)\n%s: %s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{ text: "ip", color: config.colors.commands.primary },
|
||||
{ text: `${host}`, color: config.colors.commands.secondary },
|
||||
{ text: `${Number(port ?? 25565)}`, color: config.colors.commands.secondary },
|
||||
{ text: "players", color: config.colors.commands.primary },
|
||||
{ text: `${server.players.online}`, color: config.colors.integer },
|
||||
{ text: `${server.players.max}`, color: config.colors.integer },
|
||||
{ text: "server version", color: config.colors.commands.primary },
|
||||
{ text: `${server.version.name}`, color: config.colors.commands.secondary },
|
||||
server.description
|
||||
]
|
||||
});
|
||||
|
||||
bot.tellraw("@a", component);
|
||||
} catch (e) {
|
||||
bot.chat.message(`${e.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,32 @@
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'refillcore',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class refillcore extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"rc",
|
||||
"refill",
|
||||
],
|
||||
description: 'refill the bots core',
|
||||
usages: [
|
||||
[
|
||||
"refill",
|
||||
"refillcore"
|
||||
],
|
||||
"refill the bots core",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
],
|
||||
},
|
||||
execute (context) {
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move();
|
||||
bot.tellraw("@a", "Refilling core,...")
|
||||
},
|
||||
const args = context.arguments;
|
||||
const source = context.source
|
||||
|
||||
discordExecute (context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
bot.core.move();
|
||||
bot.tellraw("@a", "Refilling core,...");
|
||||
bot.core.move(bot.position);
|
||||
|
||||
source.sendFeedback({
|
||||
translation: "command.core.refill",
|
||||
}) // most likely wont be seen most of the time
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = refillcore;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const between = require('../../util/between');
|
||||
|
||||
class rtp extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"rtp",
|
||||
[
|
||||
"randomtp",
|
||||
"tpr",
|
||||
"tprandom"
|
||||
],
|
||||
"teleport to a random place. This was ported from FNFBoyfriendBot v4.x",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
const x = between(-1_000_000, 1_000_000);
|
||||
const y = 100;
|
||||
const z = between(-1_000_000, 1_000_000);
|
||||
let component = [];
|
||||
|
||||
bot.core.run(`essentials:tp ${source.player.uuid} ${x} ${y} ${z}`)
|
||||
|
||||
component.push({
|
||||
translate: "fnfboyfriendbot.command.rtp",
|
||||
fallback: translations["fnfboyfriendbot.command.rtp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${source.player.profile.name}`, color: config.colors.commands.secondary },
|
||||
{ text: `${x}`, color: config.colors.integer },
|
||||
{ text: `${y}`, color: config.colors.integer },
|
||||
{ text: `${z}`, color: config.colors.integer }
|
||||
]
|
||||
})
|
||||
|
||||
bot.tellraw('@a', component)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = rtp
|
||||
@@ -0,0 +1,25 @@
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
class test extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"test",
|
||||
[],
|
||||
"testing stuff",
|
||||
trustLevel.public,
|
||||
[""],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
execute(context) {
|
||||
const bot = context.bot;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
|
||||
bot.chat.message('meow')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = test;
|
||||
@@ -1,23 +1,69 @@
|
||||
const CommandError = require('../../util/command_error')
|
||||
const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuilder } = require('discord.js');
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const { request } = require('undici');
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'urban',
|
||||
description: 'urban dictionary',
|
||||
aliases: [
|
||||
'urbandictionary'
|
||||
],
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<definition>",
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
const source = context.source
|
||||
const args = context.arguments
|
||||
const bot = context.bot
|
||||
const prefix = [
|
||||
|
||||
class urban extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"urban",
|
||||
[
|
||||
"urbandictionary"
|
||||
],
|
||||
"look up definitions on urban dictionary",
|
||||
trustLevel.public,
|
||||
["<definition>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
let term = args.join(' ');
|
||||
|
||||
try {
|
||||
const prefix = {
|
||||
translate: "[%s] ",
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.urban.text",
|
||||
fallback: translations["fnfboyfriendbot.command.urban.text"],
|
||||
color: "#B72A00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const query = new URLSearchParams({ term });
|
||||
const dictResult = await request(`https://api.urbandictionary.com/v0/define?${query}`);
|
||||
const { list } = await dictResult.body.json();
|
||||
let component = [];
|
||||
|
||||
for (const 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: ""
|
||||
}
|
||||
])
|
||||
}
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
bot.console.error(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = urban;
|
||||
|
||||
/*
|
||||
const prefix = [
|
||||
{ text: '[', color: 'dark_gray' },
|
||||
{ text: 'Urban', color: '#B72A00' },
|
||||
{ text: '] ', color: 'dark_gray'}
|
||||
@@ -27,9 +73,17 @@ module.exports = {
|
||||
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' });
|
||||
|
||||
if (bot.options.mode === "savageFriends") {
|
||||
bot.chat.message('this command is disabled for this server for right now sorry!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!list.length) {
|
||||
bot.tellraw("@a", { text: "No results found", color: "dark_red" });
|
||||
}
|
||||
|
||||
|
||||
for (definitions of list) {
|
||||
component.push(prefix, [
|
||||
{
|
||||
@@ -38,7 +92,7 @@ module.exports = {
|
||||
underlined: false,
|
||||
italic: false,
|
||||
translate: "",
|
||||
hoverEvent: {
|
||||
hover_event: {
|
||||
action:"show_text",
|
||||
value: [
|
||||
{
|
||||
@@ -63,39 +117,10 @@ module.exports = {
|
||||
}
|
||||
]
|
||||
},
|
||||
clickEvent: {
|
||||
click_event: {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
+145
-88
@@ -1,101 +1,158 @@
|
||||
const CommandError = require('../../util/command_error');
|
||||
const { request } = require('undici');
|
||||
const { request } = require("undici");
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
|
||||
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",
|
||||
aliases: [
|
||||
|
||||
],
|
||||
description: "check the weather in locations",
|
||||
trustLevel: 0,
|
||||
usages: [
|
||||
"<weather/zip code>"
|
||||
]
|
||||
},
|
||||
async execute (context) {
|
||||
class weather extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"weather",
|
||||
[],
|
||||
"check the weather in locations",
|
||||
trustLevel.public,
|
||||
["<weather/zip code>"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
async execute(context) {
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const args = context.arguments;
|
||||
const source = context.source;
|
||||
const translations = bot.translations;
|
||||
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const url = await request(`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(' ').replaceAll(' ','&')}`);
|
||||
const url = await request(
|
||||
`https://api.weatherapi.com/v1/current.json?key=${config.weatherApiKey}&q=${args.join(" ").replaceAll(" ", "%20")}`,
|
||||
);
|
||||
const info = await url.body.json();
|
||||
|
||||
components(config, info, component);
|
||||
bot.tellraw("@a", component);
|
||||
if (info.error) source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.weather.unknown_location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.unknown_location"],
|
||||
color: "red",
|
||||
with: [
|
||||
{ text: `${args.join(' ')}`}
|
||||
]
|
||||
})
|
||||
|
||||
component.push({
|
||||
translate: "%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||
color: config.colors.commands.tertiary,
|
||||
with: [
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.location",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.location"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ 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,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.coords",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.coords"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{ text: `${info.location.lat}`, color: config.colors.integer },
|
||||
{ text: `${info.location.lon}`, color: config.colors.integer }
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.time",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.time"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
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: "fnfboyfriendbot.command.weather.temp",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.temp"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_c)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
{
|
||||
text: `${Math.floor(info.current.temp_f)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.wind_speed",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.wind_speed"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
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,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.condition",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.condition"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${info.current.condition.text}`,
|
||||
color: config.colors.commands.secondary,
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
translate: "fnfboyfriendbot.command.weather.humidity",
|
||||
fallback: translations["fnfboyfriendbot.command.weather.humidity"],
|
||||
color: config.colors.commands.primary,
|
||||
with: [
|
||||
{
|
||||
text: `${Math.floor(info.current.humidity)}`,
|
||||
color: config.colors.integer,
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
bot.chat.message(e.toString());
|
||||
if (e.toString() === "TypeError: Cannot read properties of undefined (reading 'name')") return
|
||||
else source.sendFeedback(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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = weather;
|
||||
|
||||
+30
-50
@@ -1,66 +1,46 @@
|
||||
const wiki = require('wikipedia');
|
||||
const CommandError = require('../../util/command_error');
|
||||
const CommandContext = require("../../commandUtil/CommandContext");
|
||||
const trustLevel = require("../../commandUtil/CommandTrustLevel");
|
||||
const wikipedia = require('wikipedia');
|
||||
|
||||
async function components (config, summary, component) {
|
||||
component.push({ text: summary, color: config.colors.commands.primary })
|
||||
}
|
||||
class wiki extends CommandContext {
|
||||
constructor() {
|
||||
super(
|
||||
"wiki",
|
||||
[
|
||||
"wikipedia"
|
||||
],
|
||||
"look up articles on wikipedia",
|
||||
trustLevel.public,
|
||||
["<article>"],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
data: {
|
||||
name: 'wiki',
|
||||
description: 'wikipedia',
|
||||
trustLevel: 0,
|
||||
aliases: [
|
||||
'wikipedia'
|
||||
],
|
||||
usages:[
|
||||
"<article>"
|
||||
],
|
||||
},
|
||||
async execute (context) {
|
||||
async execute(context) {
|
||||
const source = context.source;
|
||||
const args = context.arguments;
|
||||
const bot = context.bot;
|
||||
const config = context.config;
|
||||
const translations = bot.translations;
|
||||
let component = [];
|
||||
|
||||
try {
|
||||
const page = await wiki.page(args.join(' '));
|
||||
const page = await wikipedia.page(args.join(' '));
|
||||
const summary = await page.intro();
|
||||
component.push({ text: summary, color: config.colors.commands.primary })
|
||||
|
||||
components(config, summary, component);
|
||||
|
||||
bot.tellraw("@a", component);
|
||||
|
||||
source.sendFeedback(component)
|
||||
} catch (e) {
|
||||
if (e.toString() === "pageError: TypeError: Cannot read properties of undefined (reading 'pages')") {
|
||||
bot.chat.message('&cArticle not found!');
|
||||
if (e.toString().startsWith('pageError: pageError: No page with given title exists :')) {
|
||||
source.sendFeedback({
|
||||
translate: "fnfboyfriendbot.command.wiki.article_not_found",
|
||||
fallback: translations["fnfboyfriendbot.command.wiki.article_not_found"],
|
||||
color: "red"
|
||||
})
|
||||
} 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()}`);
|
||||
source.sendFeedback(e.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = wiki;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user