diff --git a/.gitignore b/.gitignore index f12e409..1889b16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -/MinetestChatBridgeBot/.gradle/ -/MinetestChatBridgeBot/build/ -/MinetestChatBridgeIRCBot/.gradle/ -/MinetestChatBridgeIRCBot/build/ \ No newline at end of file +./MinetestChatBridgeBot/.gradle +./MinetestChatBridgeIRCBot/.gradle diff --git a/MinetestChatBridgeBot/.gradle/6.0/fileChanges/last-build.bin b/MinetestChatBridgeBot/.gradle/6.0/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.0/fileChanges/last-build.bin differ diff --git a/MinetestChatBridgeBot/.gradle/6.0/fileHashes/fileHashes.lock b/MinetestChatBridgeBot/.gradle/6.0/fileHashes/fileHashes.lock new file mode 100644 index 0000000..ec4f256 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.0/fileHashes/fileHashes.lock differ diff --git a/MinetestChatBridgeBot/.gradle/6.0/gc.properties b/MinetestChatBridgeBot/.gradle/6.0/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/MinetestChatBridgeBot/.gradle/6.3/executionHistory/executionHistory.bin b/MinetestChatBridgeBot/.gradle/6.3/executionHistory/executionHistory.bin new file mode 100644 index 0000000..f851f24 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/executionHistory/executionHistory.bin differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/executionHistory/executionHistory.lock b/MinetestChatBridgeBot/.gradle/6.3/executionHistory/executionHistory.lock new file mode 100644 index 0000000..9e2fe40 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/executionHistory/executionHistory.lock differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/fileChanges/last-build.bin b/MinetestChatBridgeBot/.gradle/6.3/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/fileChanges/last-build.bin differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/fileContent/fileContent.lock b/MinetestChatBridgeBot/.gradle/6.3/fileContent/fileContent.lock new file mode 100644 index 0000000..6f1c526 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/fileContent/fileContent.lock differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/fileHashes/fileHashes.bin b/MinetestChatBridgeBot/.gradle/6.3/fileHashes/fileHashes.bin new file mode 100644 index 0000000..88c5663 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/fileHashes/fileHashes.bin differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/fileHashes/fileHashes.lock b/MinetestChatBridgeBot/.gradle/6.3/fileHashes/fileHashes.lock new file mode 100644 index 0000000..fc18ea0 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/fileHashes/fileHashes.lock differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/gc.properties b/MinetestChatBridgeBot/.gradle/6.3/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/MinetestChatBridgeBot/.gradle/6.3/javaCompile/classAnalysis.bin b/MinetestChatBridgeBot/.gradle/6.3/javaCompile/classAnalysis.bin new file mode 100644 index 0000000..30da47e Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/javaCompile/classAnalysis.bin differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/javaCompile/javaCompile.lock b/MinetestChatBridgeBot/.gradle/6.3/javaCompile/javaCompile.lock new file mode 100644 index 0000000..c00946d Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/javaCompile/javaCompile.lock differ diff --git a/MinetestChatBridgeBot/.gradle/6.3/javaCompile/taskHistory.bin b/MinetestChatBridgeBot/.gradle/6.3/javaCompile/taskHistory.bin new file mode 100644 index 0000000..d3b2726 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/6.3/javaCompile/taskHistory.bin differ diff --git a/MinetestChatBridgeBot/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/MinetestChatBridgeBot/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..c94bb79 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/MinetestChatBridgeBot/.gradle/buildOutputCleanup/cache.properties b/MinetestChatBridgeBot/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..8039ece --- /dev/null +++ b/MinetestChatBridgeBot/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sun Apr 05 11:34:15 CEST 2020 +gradle.version=6.3 diff --git a/MinetestChatBridgeBot/.gradle/buildOutputCleanup/outputFiles.bin b/MinetestChatBridgeBot/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..23ef52f Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/MinetestChatBridgeBot/.gradle/checksums/checksums.lock b/MinetestChatBridgeBot/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..02f8261 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/checksums/checksums.lock differ diff --git a/MinetestChatBridgeBot/.gradle/checksums/md5-checksums.bin b/MinetestChatBridgeBot/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000..177060f Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/checksums/md5-checksums.bin differ diff --git a/MinetestChatBridgeBot/.gradle/checksums/sha1-checksums.bin b/MinetestChatBridgeBot/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000..a2ed7f2 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/checksums/sha1-checksums.bin differ diff --git a/MinetestChatBridgeBot/.gradle/nb-cache/MinetestChatBridgeBot-1539270912/project-info.ser b/MinetestChatBridgeBot/.gradle/nb-cache/MinetestChatBridgeBot-1539270912/project-info.ser new file mode 100644 index 0000000..b988b45 Binary files /dev/null and b/MinetestChatBridgeBot/.gradle/nb-cache/MinetestChatBridgeBot-1539270912/project-info.ser differ diff --git a/MinetestChatBridgeBot/.gradle/vcs-1/gc.properties b/MinetestChatBridgeBot/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/MinetestChatBridgeBot/build.gradle b/MinetestChatBridgeBot/build.gradle index 90bd796..8251dec 100644 --- a/MinetestChatBridgeBot/build.gradle +++ b/MinetestChatBridgeBot/build.gradle @@ -2,13 +2,13 @@ buildscript { repositories { jcenter() } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' - } } -apply plugin: 'java' -apply plugin: 'com.github.johnrengelman.shadow' +plugins { + id 'com.github.johnrengelman.shadow' version '5.2.0' + id 'java' +} + apply plugin: 'jacoco' apply plugin: 'application' @@ -22,16 +22,15 @@ repositories { } dependencies { - compile "net.dv8tion:JDA:4.0.0_39", 'ch.qos.logback:logback-classic:1.3.0-alpha4' + compile 'net.dv8tion:JDA:4.0.0_39', 'ch.qos.logback:logback-classic:1.3.0-alpha4' compile group: 'com.google.guava', name: 'guava', version: '23.5-jre' - testCompile group: 'junit', name: 'junit', version: '4.12' } jar { manifest { attributes( - 'Created-By': "Gradle ${gradle.gradleVersion}", - 'Main-Class': "appguru.Main" + 'Created-By': 'Gradle ${gradle.gradleVersion}', + 'Main-Class': 'appguru.Main' ) } } \ No newline at end of file diff --git a/MinetestChatBridgeBot/build/classes/java/main/appguru/Main.class b/MinetestChatBridgeBot/build/classes/java/main/appguru/Main.class new file mode 100644 index 0000000..22c1b6b Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/appguru/Main.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/bridge/FileBridge$1.class b/MinetestChatBridgeBot/build/classes/java/main/bridge/FileBridge$1.class new file mode 100644 index 0000000..4d7725e Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/bridge/FileBridge$1.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/bridge/FileBridge.class b/MinetestChatBridgeBot/build/classes/java/main/bridge/FileBridge.class new file mode 100644 index 0000000..09449ec Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/bridge/FileBridge.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/bridge/ProcessBridge.class b/MinetestChatBridgeBot/build/classes/java/main/bridge/ProcessBridge.class new file mode 100644 index 0000000..e849955 Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/bridge/ProcessBridge.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/bridge/SocketBridge.class b/MinetestChatBridgeBot/build/classes/java/main/bridge/SocketBridge.class new file mode 100644 index 0000000..9d3eeb3 Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/bridge/SocketBridge.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/chat/Bot.class b/MinetestChatBridgeBot/build/classes/java/main/chat/Bot.class new file mode 100644 index 0000000..98614cf Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/chat/Bot.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/commands/Command.class b/MinetestChatBridgeBot/build/classes/java/main/commands/Command.class new file mode 100644 index 0000000..acbfc3f Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/commands/Command.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/commands/StatusCommand.class b/MinetestChatBridgeBot/build/classes/java/main/commands/StatusCommand.class new file mode 100644 index 0000000..3f71b00 Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/commands/StatusCommand.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/misc/GarbageCollector.class b/MinetestChatBridgeBot/build/classes/java/main/misc/GarbageCollector.class new file mode 100644 index 0000000..91fa7eb Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/misc/GarbageCollector.class differ diff --git a/MinetestChatBridgeBot/build/classes/java/main/misc/Utils.class b/MinetestChatBridgeBot/build/classes/java/main/misc/Utils.class new file mode 100644 index 0000000..7f75adb Binary files /dev/null and b/MinetestChatBridgeBot/build/classes/java/main/misc/Utils.class differ diff --git a/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot-shadow.tar b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot-shadow.tar new file mode 100644 index 0000000..167776e Binary files /dev/null and b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot-shadow.tar differ diff --git a/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot-shadow.zip b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot-shadow.zip new file mode 100644 index 0000000..6892321 Binary files /dev/null and b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot-shadow.zip differ diff --git a/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot.tar b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot.tar new file mode 100644 index 0000000..b230a1c Binary files /dev/null and b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot.tar differ diff --git a/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot.zip b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot.zip new file mode 100644 index 0000000..2ac6213 Binary files /dev/null and b/MinetestChatBridgeBot/build/distributions/MinetestChatBridgeBot.zip differ diff --git a/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot-all.jar b/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot-all.jar new file mode 100644 index 0000000..9e23164 Binary files /dev/null and b/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot-all.jar differ diff --git a/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot.jar b/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot.jar new file mode 100644 index 0000000..6b8830e Binary files /dev/null and b/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot.jar differ diff --git a/MinetestChatBridgeBot/build/scripts/MinetestChatBridgeBot b/MinetestChatBridgeBot/build/scripts/MinetestChatBridgeBot new file mode 100755 index 0000000..c734bd8 --- /dev/null +++ b/MinetestChatBridgeBot/build/scripts/MinetestChatBridgeBot @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or 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. +# + +############################################################################## +## +## MinetestChatBridgeBot start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/.." >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="MinetestChatBridgeBot" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and MINETEST_CHAT_BRIDGE_BOT_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/lib/MinetestChatBridgeBot.jar:$APP_HOME/lib/JDA-4.0.0_39.jar:$APP_HOME/lib/logback-classic-1.3.0-alpha4.jar:$APP_HOME/lib/guava-23.5-jre.jar:$APP_HOME/lib/jsr305-3.0.2.jar:$APP_HOME/lib/annotations-16.0.1.jar:$APP_HOME/lib/slf4j-api-1.8.0-beta1.jar:$APP_HOME/lib/nv-websocket-client-2.5.jar:$APP_HOME/lib/okhttp-3.13.0.jar:$APP_HOME/lib/opus-java-1.0.4.pom:$APP_HOME/lib/commons-collections4-4.1.jar:$APP_HOME/lib/trove4j-3.0.3.jar:$APP_HOME/lib/jackson-databind-2.9.8.jar:$APP_HOME/lib/logback-core-1.3.0-alpha4.jar:$APP_HOME/lib/javax.mail-1.6.0.jar:$APP_HOME/lib/checker-qual-2.0.0.jar:$APP_HOME/lib/error_prone_annotations-2.0.18.jar:$APP_HOME/lib/j2objc-annotations-1.1.jar:$APP_HOME/lib/animal-sniffer-annotations-1.14.jar:$APP_HOME/lib/okio-1.17.2.jar:$APP_HOME/lib/opus-java-api-1.0.4.jar:$APP_HOME/lib/opus-java-natives-1.0.4.jar:$APP_HOME/lib/jackson-annotations-2.9.0.jar:$APP_HOME/lib/jackson-core-2.9.8.jar:$APP_HOME/lib/activation-1.1.jar:$APP_HOME/lib/jna-4.4.0.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" + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $MINETEST_CHAT_BRIDGE_BOT_OPTS -classpath "\"$CLASSPATH\"" appguru.Main "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/MinetestChatBridgeBot/build/scripts/MinetestChatBridgeBot.bat b/MinetestChatBridgeBot/build/scripts/MinetestChatBridgeBot.bat new file mode 100644 index 0000000..f0167d8 --- /dev/null +++ b/MinetestChatBridgeBot/build/scripts/MinetestChatBridgeBot.bat @@ -0,0 +1,103 @@ +@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 MinetestChatBridgeBot 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=. +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 MINETEST_CHAT_BRIDGE_BOT_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\lib\MinetestChatBridgeBot.jar;%APP_HOME%\lib\JDA-4.0.0_39.jar;%APP_HOME%\lib\logback-classic-1.3.0-alpha4.jar;%APP_HOME%\lib\guava-23.5-jre.jar;%APP_HOME%\lib\jsr305-3.0.2.jar;%APP_HOME%\lib\annotations-16.0.1.jar;%APP_HOME%\lib\slf4j-api-1.8.0-beta1.jar;%APP_HOME%\lib\nv-websocket-client-2.5.jar;%APP_HOME%\lib\okhttp-3.13.0.jar;%APP_HOME%\lib\opus-java-1.0.4.pom;%APP_HOME%\lib\commons-collections4-4.1.jar;%APP_HOME%\lib\trove4j-3.0.3.jar;%APP_HOME%\lib\jackson-databind-2.9.8.jar;%APP_HOME%\lib\logback-core-1.3.0-alpha4.jar;%APP_HOME%\lib\javax.mail-1.6.0.jar;%APP_HOME%\lib\checker-qual-2.0.0.jar;%APP_HOME%\lib\error_prone_annotations-2.0.18.jar;%APP_HOME%\lib\j2objc-annotations-1.1.jar;%APP_HOME%\lib\animal-sniffer-annotations-1.14.jar;%APP_HOME%\lib\okio-1.17.2.jar;%APP_HOME%\lib\opus-java-api-1.0.4.jar;%APP_HOME%\lib\opus-java-natives-1.0.4.jar;%APP_HOME%\lib\jackson-annotations-2.9.0.jar;%APP_HOME%\lib\jackson-core-2.9.8.jar;%APP_HOME%\lib\activation-1.1.jar;%APP_HOME%\lib\jna-4.4.0.jar + +@rem Execute MinetestChatBridgeBot +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %MINETEST_CHAT_BRIDGE_BOT_OPTS% -classpath "%CLASSPATH%" appguru.Main %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable MINETEST_CHAT_BRIDGE_BOT_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%MINETEST_CHAT_BRIDGE_BOT_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MinetestChatBridgeBot/build/scriptsShadow/MinetestChatBridgeBot b/MinetestChatBridgeBot/build/scriptsShadow/MinetestChatBridgeBot new file mode 100755 index 0000000..4c9fbf8 --- /dev/null +++ b/MinetestChatBridgeBot/build/scriptsShadow/MinetestChatBridgeBot @@ -0,0 +1,172 @@ +#!/usr/bin/env bash + +############################################################################## +## +## MinetestChatBridgeBot start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/.." >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="MinetestChatBridgeBot" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and MINETEST_CHAT_BRIDGE_BOT_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/lib/MinetestChatBridgeBot-all.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" + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save() { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- "$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$GRADLE_OPTS" -jar "\"$CLASSPATH\"" "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/MinetestChatBridgeBot/build/scriptsShadow/MinetestChatBridgeBot.bat b/MinetestChatBridgeBot/build/scriptsShadow/MinetestChatBridgeBot.bat new file mode 100644 index 0000000..7d48020 --- /dev/null +++ b/MinetestChatBridgeBot/build/scriptsShadow/MinetestChatBridgeBot.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem MinetestChatBridgeBot 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=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME%.. + +@rem Add default JVM options here. You can also use JAVA_OPTS and MINETEST_CHAT_BRIDGE_BOT_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\lib\MinetestChatBridgeBot-all.jar + +@rem Execute MinetestChatBridgeBot +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %MINETEST_CHAT_BRIDGE_BOT_OPTS% -jar "%CLASSPATH%" %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable MINETEST_CHAT_BRIDGE_BOT_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%MINETEST_CHAT_BRIDGE_BOT_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega \ No newline at end of file diff --git a/MinetestChatBridgeBot/build/tmp/jar/MANIFEST.MF b/MinetestChatBridgeBot/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..7ec7352 --- /dev/null +++ b/MinetestChatBridgeBot/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Created-By: Gradle ${gradle.gradleVersion} +Main-Class: appguru.Main + diff --git a/MinetestChatBridgeBot/build/tmp/shadowJar/MANIFEST.MF b/MinetestChatBridgeBot/build/tmp/shadowJar/MANIFEST.MF new file mode 100644 index 0000000..7ec7352 --- /dev/null +++ b/MinetestChatBridgeBot/build/tmp/shadowJar/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Created-By: Gradle ${gradle.gradleVersion} +Main-Class: appguru.Main + diff --git a/MinetestChatBridgeBot/src/main/java/appguru/Main.java b/MinetestChatBridgeBot/src/main/java/appguru/Main.java index 4c2cadd..7039f7f 100644 --- a/MinetestChatBridgeBot/src/main/java/appguru/Main.java +++ b/MinetestChatBridgeBot/src/main/java/appguru/Main.java @@ -27,23 +27,35 @@ public class Main { public static ProcessBridge PROCESS_BRIDGE; public static void main(String[] args) throws IOException { - - if (args.length > 4) { - File log=new File(args[4]); - if (!log.isFile() || !log.canWrite()) { - OUT.println("ERR: Log file doesn't exist or can't be written to."); - } else { - OUT = new PrintStream(new FileOutputStream(log, true)); - Runtime.getRuntime().addShutdownHook(new Thread(() -> { - OUT.close(); - })); - } - if (args.length > 5) { - PREFIX=args[5]; - if (args.length > 6) { - DISCORD_PREFIX=args[6]; - if (args.length > 7) { - GUILD_ID=args[7]; + int required_args = 4; + if (args.length < required_args) { + OUT.println("ERR: Not enough arguments given ("+required_args+" required)"); + System.exit(1); + } + boolean send_embeds = true; + if (args.length > required_args) { + send_embeds = args[required_args].equalsIgnoreCase("true"); + required_args++; + if (args.length > required_args) { + File log=new File(args[required_args]); + if (!log.isFile() || !log.canWrite()) { + OUT.println("ERR: Log file doesn't exist or can't be written to."); + } else { + OUT = new PrintStream(new FileOutputStream(log, true)); + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + OUT.close(); + })); + } + required_args++; + if (args.length > required_args) { + PREFIX=args[required_args]; + required_args++; + if (args.length > required_args) { + DISCORD_PREFIX=args[required_args]; + required_args++; + if (args.length > required_args) { + GUILD_ID=args[required_args]; + } } } } @@ -80,7 +92,7 @@ public class Main { } try { - Bot i=new Bot(token, PROCESS_BRIDGE, channelname); + Bot i=new Bot(token, PROCESS_BRIDGE, channelname, send_embeds); i.registerInfo("status", "Status", "", Color.CYAN, null); i.registerCommand("status", new StatusCommand()); @@ -95,8 +107,7 @@ public class Main { "• Minetest chatcommands - Use `"+PREFIX+"` as prefix\n"+ "**More**\n"+ "• See the GitHub Readme linked in the title",Color.GREEN, null); - } - catch (LoginException e) { + } catch (LoginException e) { System.out.println("ERR: Invalid token. Login failed."); return; } diff --git a/MinetestChatBridgeBot/src/main/java/chat/Bot.java b/MinetestChatBridgeBot/src/main/java/chat/Bot.java index a5b0c6a..b879a45 100644 --- a/MinetestChatBridgeBot/src/main/java/chat/Bot.java +++ b/MinetestChatBridgeBot/src/main/java/chat/Bot.java @@ -50,7 +50,7 @@ public class Bot extends ListenerAdapter { public EmbedBuilder success; public EmbedBuilder message; - public Bot(String token, ProcessBridge pb, String text_channel) throws LoginException { + public Bot(String token, ProcessBridge pb, String text_channel, boolean send_embeds) throws LoginException { Main.OUT.println("INFO: Starting client"); JDABuilder builder=new JDABuilder(AccountType.BOT); builder.setToken(token); @@ -67,8 +67,10 @@ public class Bot extends ListenerAdapter { success.setColor(new Color(0, 255,0)); success.setTitle("Success"); - message=new EmbedBuilder(); - + if (send_embeds) { + message=new EmbedBuilder(); + } + jda.addEventListener(this); } @@ -101,11 +103,7 @@ public class Bot extends ListenerAdapter { @Override public void onGuildJoin(GuildJoinEvent e) { - /*Iterator it=jda.getGuildCache().iterator();it.hasNext(); - if (it.hasNext()) { - e.getGuild().leave().queue(); - }*/ - // IDEA: leave + // TODO leave } public String escapeName(String name) { @@ -125,32 +123,38 @@ public class Bot extends ListenerAdapter { bridge.write("[EXT]"+members.inverse().get(e.getMember().getUser().getIdLong())); } - public synchronized MessageEmbed buildMessage(String msg, Color color) { - message.setColor(color); - message.setDescription(msg); - message.setTimestamp(Instant.now()); - return message.build(); + public synchronized Message buildMessage(String msg, Color color) { + MessageBuilder mb = new MessageBuilder(); + if (message != null) { + message.setColor(color); + message.setDescription(msg); + message.setTimestamp(Instant.now()); + mb.setEmbed(message.build()); + } else { + mb.setContent(msg); + } + return mb.build(); } public void sendToAll(String message, Color color) { sendToAll(buildMessage(message, color)); } - public void sendToAll(MessageEmbed message) { + public void sendToAll(Message message) { jda.getTextChannelById(global_channel).sendMessage(message).queue(); } - public void sendToMembers(String message, Color c, String... targets) { - sendToMembers(buildMessage(message, c), targets); + public void sendToMembers(String message, Color color, String... targets) { + sendToMembers(buildMessage(message, color), targets); } - public void sendToMembers(MessageEmbed m, String... targets) { + public void sendToMembers(Message m, String... targets) { for (String member:targets) { sendToMember(member, m); } } - public void sendToMember(String member, MessageEmbed m) { + public void sendToMember(String member, Message m) { Long member_id=members.get(member); if (member_id != null) { jda.getUserById(member_id).openPrivateChannel().queue(pc -> pc.sendMessage(m).queue()); @@ -210,14 +214,16 @@ public class Bot extends ListenerAdapter { this.sendToAll(color_and_message[1], new Color(Integer.parseInt(color_and_message[0].substring(1), 16))); } else if (line.startsWith("[ERR]")) { String[] lineparts=linecontent.split(" ", 2); - //error.setTimestamp(Instant.now()); error.setDescription(lineparts[1]); - sendToMember(lineparts[0], error.build()); + MessageBuilder mb = new MessageBuilder(); + mb.setEmbed(error.build()); + sendToMember(lineparts[0], mb.build()); } else if (line.startsWith("[SUC]")) { String[] lineparts=linecontent.split(" ", 2); - //success.setTimestamp(Instant.now()); success.setDescription(lineparts[1]); - sendToMember(lineparts[0], success.build()); + MessageBuilder mb = new MessageBuilder(); + mb.setEmbed(success.build()); + sendToMember(lineparts[0], mb.build()); } else if (line.startsWith("[PMS]")) { String line_content=line.substring(5); String[] parts=line_content.split(" ", 3); // Color, targets and message - No need to handle stuff like blocks, already done by MT diff --git a/MinetestChatBridgeIRCBot/.gradle/6.2.2/fileChanges/last-build.bin b/MinetestChatBridgeIRCBot/.gradle/6.2.2/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/6.2.2/fileChanges/last-build.bin differ diff --git a/MinetestChatBridgeIRCBot/.gradle/6.2.2/fileHashes/fileHashes.lock b/MinetestChatBridgeIRCBot/.gradle/6.2.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000..bcd75cc Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/6.2.2/fileHashes/fileHashes.lock differ diff --git a/MinetestChatBridgeIRCBot/.gradle/6.2.2/gc.properties b/MinetestChatBridgeIRCBot/.gradle/6.2.2/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..54a7386 Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/cache.properties b/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..5c3d30a --- /dev/null +++ b/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sat Oct 19 11:53:52 CEST 2019 +gradle.version=4.10.2 diff --git a/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/outputFiles.bin b/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..9bf6e51 Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/MinetestChatBridgeIRCBot/.gradle/checksums/checksums.lock b/MinetestChatBridgeIRCBot/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..1e50c82 Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/checksums/checksums.lock differ diff --git a/MinetestChatBridgeIRCBot/.gradle/nb-cache/MinetestChatBridgeIRCBot-734352554/project-info.ser b/MinetestChatBridgeIRCBot/.gradle/nb-cache/MinetestChatBridgeIRCBot-734352554/project-info.ser new file mode 100644 index 0000000..da6cfff Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/nb-cache/MinetestChatBridgeIRCBot-734352554/project-info.ser differ diff --git a/MinetestChatBridgeIRCBot/.gradle/nb-cache/MinetestChatBridgeIRCBot-773850828/project-info.ser b/MinetestChatBridgeIRCBot/.gradle/nb-cache/MinetestChatBridgeIRCBot-773850828/project-info.ser new file mode 100644 index 0000000..520b9e3 Binary files /dev/null and b/MinetestChatBridgeIRCBot/.gradle/nb-cache/MinetestChatBridgeIRCBot-773850828/project-info.ser differ diff --git a/MinetestChatBridgeIRCBot/.gradle/vcs-1/gc.properties b/MinetestChatBridgeIRCBot/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$1.class b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$1.class new file mode 100644 index 0000000..4fd8763 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$1.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$2.class b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$2.class new file mode 100644 index 0000000..43b14d7 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$2.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$3.class b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$3.class new file mode 100644 index 0000000..fd9afd9 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$3.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$4.class b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$4.class new file mode 100644 index 0000000..b7d888a Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$4.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$5.class b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$5.class new file mode 100644 index 0000000..70b20f2 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main$5.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main.class b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main.class new file mode 100644 index 0000000..59dabd6 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/appguru/Main.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/FileBridge$1.class b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/FileBridge$1.class new file mode 100644 index 0000000..6de2740 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/FileBridge$1.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/FileBridge.class b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/FileBridge.class new file mode 100644 index 0000000..0b5ebfc Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/FileBridge.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/IRCFileBridge.class b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/IRCFileBridge.class new file mode 100644 index 0000000..aac7c75 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/IRCFileBridge.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/IRCSocketBridge.class b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/IRCSocketBridge.class new file mode 100644 index 0000000..239ece3 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/IRCSocketBridge.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/ProcessBridge.class b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/ProcessBridge.class new file mode 100644 index 0000000..79762d6 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/ProcessBridge.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/SocketBridge.class b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/SocketBridge.class new file mode 100644 index 0000000..7d7829d Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/bridge/SocketBridge.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/commands/Command.class b/MinetestChatBridgeIRCBot/build/classes/java/main/commands/Command.class new file mode 100644 index 0000000..7a53614 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/commands/Command.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/commands/InfoCommand.class b/MinetestChatBridgeIRCBot/build/classes/java/main/commands/InfoCommand.class new file mode 100644 index 0000000..74a0b3c Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/commands/InfoCommand.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericHandler.class new file mode 100644 index 0000000..4ea9661 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericResponseHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericResponseHandler.class new file mode 100644 index 0000000..a4dc4d4 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericResponseHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericTimeoutResponseHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericTimeoutResponseHandler.class new file mode 100644 index 0000000..465daf7 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/NumericTimeoutResponseHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/ResponseHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/ResponseHandler.class new file mode 100644 index 0000000..152f4e8 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/ResponseHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TimeoutResponseHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TimeoutResponseHandler.class new file mode 100644 index 0000000..4d3d2de Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TimeoutResponseHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TopicResponseHandler$1.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TopicResponseHandler$1.class new file mode 100644 index 0000000..e6029c2 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TopicResponseHandler$1.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TopicResponseHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TopicResponseHandler.class new file mode 100644 index 0000000..58851fd Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TopicResponseHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TryAgainHandler.class b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TryAgainHandler.class new file mode 100644 index 0000000..ca87811 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/handlers/TryAgainHandler.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/Command.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/Command.class new file mode 100644 index 0000000..40c8fb4 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/Command.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/Default.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/Default.class new file mode 100644 index 0000000..c0e9826 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/Default.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/HandledResponse.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/HandledResponse.class new file mode 100644 index 0000000..ed4cd37 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/HandledResponse.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/IRCBot$1.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/IRCBot$1.class new file mode 100644 index 0000000..5a00fd3 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/IRCBot$1.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/IRCBot.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/IRCBot.class new file mode 100644 index 0000000..575f70c Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/IRCBot.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/InvalidMessageException.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/InvalidMessageException.class new file mode 100644 index 0000000..9778f8e Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/InvalidMessageException.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/irc/PongCommand.class b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/PongCommand.class new file mode 100644 index 0000000..edbf447 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/irc/PongCommand.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/misc/GarbageCollector.class b/MinetestChatBridgeIRCBot/build/classes/java/main/misc/GarbageCollector.class new file mode 100644 index 0000000..845e698 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/misc/GarbageCollector.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/numeric/Numeric.class b/MinetestChatBridgeIRCBot/build/classes/java/main/numeric/Numeric.class new file mode 100644 index 0000000..58f0829 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/numeric/Numeric.class differ diff --git a/MinetestChatBridgeIRCBot/build/classes/java/main/numeric/NumericLookup.class b/MinetestChatBridgeIRCBot/build/classes/java/main/numeric/NumericLookup.class new file mode 100644 index 0000000..c75edc1 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/classes/java/main/numeric/NumericLookup.class differ diff --git a/MinetestChatBridgeIRCBot/build/distributions/MinetestChatBridgeIRCBot.tar b/MinetestChatBridgeIRCBot/build/distributions/MinetestChatBridgeIRCBot.tar new file mode 100644 index 0000000..3027db5 Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/distributions/MinetestChatBridgeIRCBot.tar differ diff --git a/MinetestChatBridgeIRCBot/build/distributions/MinetestChatBridgeIRCBot.zip b/MinetestChatBridgeIRCBot/build/distributions/MinetestChatBridgeIRCBot.zip new file mode 100644 index 0000000..6e4365b Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/distributions/MinetestChatBridgeIRCBot.zip differ diff --git a/MinetestChatBridgeIRCBot/build/libs/MinetestChatBridgeIRCBot.jar b/MinetestChatBridgeIRCBot/build/libs/MinetestChatBridgeIRCBot.jar new file mode 100644 index 0000000..9a87f7d Binary files /dev/null and b/MinetestChatBridgeIRCBot/build/libs/MinetestChatBridgeIRCBot.jar differ diff --git a/MinetestChatBridgeIRCBot/build/scripts/MinetestChatBridgeIRCBot b/MinetestChatBridgeIRCBot/build/scripts/MinetestChatBridgeIRCBot new file mode 100755 index 0000000..ed447b8 --- /dev/null +++ b/MinetestChatBridgeIRCBot/build/scripts/MinetestChatBridgeIRCBot @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## MinetestChatBridgeIRCBot start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/.." >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="MinetestChatBridgeIRCBot" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and MINETEST_CHAT_BRIDGE_IRC_BOT_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/lib/MinetestChatBridgeIRCBot.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" + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $MINETEST_CHAT_BRIDGE_IRC_BOT_OPTS -classpath "\"$CLASSPATH\"" appguru.Main "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/MinetestChatBridgeIRCBot/build/scripts/MinetestChatBridgeIRCBot.bat b/MinetestChatBridgeIRCBot/build/scripts/MinetestChatBridgeIRCBot.bat new file mode 100644 index 0000000..877f969 --- /dev/null +++ b/MinetestChatBridgeIRCBot/build/scripts/MinetestChatBridgeIRCBot.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem MinetestChatBridgeIRCBot 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=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME%.. + +@rem Add default JVM options here. You can also use JAVA_OPTS and MINETEST_CHAT_BRIDGE_IRC_BOT_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\lib\MinetestChatBridgeIRCBot.jar + +@rem Execute MinetestChatBridgeIRCBot +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %MINETEST_CHAT_BRIDGE_IRC_BOT_OPTS% -classpath "%CLASSPATH%" appguru.Main %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable MINETEST_CHAT_BRIDGE_IRC_BOT_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%MINETEST_CHAT_BRIDGE_IRC_BOT_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MinetestChatBridgeIRCBot/build/tmp/jar/MANIFEST.MF b/MinetestChatBridgeIRCBot/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..1af873a --- /dev/null +++ b/MinetestChatBridgeIRCBot/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Created-By: Gradle 4.10.2 +Main-Class: appguru.Main + diff --git a/Readme.md b/Readme.md index a1a95eb..fe31b07 100644 --- a/Readme.md +++ b/Readme.md @@ -81,6 +81,15 @@ Targets/Mentions: Roles or chatters mentioned using `@` * Supports configuring case insensitive roles * Removed outdated `config_help.md` +### `rolling-9` + +* Fixes [`rolling-8`] + +### `rolling-10` + +* Supports sending messages instead of embeds (discord bridge) +* Fixes + ## API ### HUD notifications @@ -193,7 +202,7 @@ Located under `/adv_chat/default_config.json` "other" : null }, "bridges" : { - "discord" : {"channelname":"allgemein", "prefix": "?", "minetest_prefix": "!","token":"S.U.Pxxs.E.R.T.9998OKEN", "blacklist":{"~~new_role~~":true}, "guild_id": 580416319703351296}, + "discord" : {"channelname":"allgemein", "prefix": "?", "minetest_prefix": "!", "token":"S.U.Pxxs.E.R.T.9998OKEN", "blacklist":{"~~new_role~~":true}, "guild_id": 580416319703351296, "send_embeds": true}, "irc" : {"channelname":"#mtchatbridgetest", "prefix": "?", "minetest_prefix": "!", "nickname": "MT_Chat_Bridge", "network": "irc.freenode.net", "port": 7000, "ssl": true} } } @@ -233,6 +242,7 @@ Table with the following entries : * `convert_internal_markdown`/`convert_minetest_markdown`: Optional boolean. Whether Markdown sent from Minetest/internal chat messages should be left untouched as if it was Discord Markdown * `handle_irc_styles`: Optional string. How IRC styles should be converted to Discord Markdown. Possible values: `"disabled"`, `"escape_markdown"` and `"convert"` * `strip_discord_markdown_in_minetest`: Optional boolean. Whether Discord Markdown should be stripped from Minetest chat. +* `send_embeds`: Optional boolean, whether the bot should send embeds or messages. Example : diff --git a/conf.lua b/conf.lua index f92a6d5..04d8fa0 100644 --- a/conf.lua +++ b/conf.lua @@ -44,7 +44,8 @@ local conf_spec={type="table", required_children={ bridge={type="string", possible_values={"files", "sockets"}}, convert_internal_markdown={type="boolean"}, convert_minetest_markdown={type="boolean"}, - handle_irc_styles={type="string", possible_values={"escape_markdown", "convert", "disabled"}} + handle_irc_styles={type="string", possible_values={"escape_markdown", "convert", "disabled"}}, + send_embeds={type="boolean"} } }, command_blacklist={type="table", keys={type="number"}, values={type="string"}}, diff --git a/discord.lua b/discord.lua index ff406a2..3e1dda9 100644 --- a/discord.lua +++ b/discord.lua @@ -148,10 +148,11 @@ bridge.serve() minetest.register_on_mods_loaded(function() local java="java" local jarpath=minetest.get_modpath("adv_chat").."/MinetestChatBridgeBot/build/libs/MinetestChatBridgeBot-all.jar" - local token=bridges.discord.token or "NTc4MjM0NjM5NTc2MDcyMjEx.XPgWKA.ilzmvz-I7XTIML6Emj1jBx4ejLw" + local token=bridges.discord.token local text_channel=bridges.discord.channelname local prefixes='"'..bridges.discord.minetest_prefix..'" "'..bridges.discord.prefix..'"' local guild_id=bridges.discord.guild_id.." " or "" + local send_embeds=(bridges.discord.send_embeds and "true") or "false" - bridge.start(java..' -jar "'..jarpath..'" "'..token..'" "'..text_channel..'" "%s" "%s" "%s" '..prefixes.." "..guild_id.." &") + bridge.start(java..' -jar "'..jarpath..'" "'..token..'" "'..text_channel..'" "%s" "%s" '..send_embeds..' "%s" '..prefixes.." "..guild_id.." &") end) \ No newline at end of file diff --git a/init.lua b/init.lua index e897b27..a17730a 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,7 @@ adv_chat={} modlib.mod.extend("adv_chat", "conf") --- Some IFNDEFS hehe +-- Some IFNDEFS local bridge_ifndefs={ bridge=adv_chat.bridges.discord or adv_chat.bridges.irc, discord=adv_chat.bridges.discord, @@ -28,15 +28,13 @@ modlib.mod.extend("adv_chat", "hud_channels") if bridge_ifndefs.bridge then modlib.mod.extend("adv_chat", "chatcommands") modlib.mod.extend("adv_chat", "process_bridges") - local env = minetest.request_insecure_environment() or error("Error: adv_chat needs to be added to the trusted mods for chat bridges to work. See the Readme for more info.") - adv_chat.set_os_execute(env.os.execute) + adv_chat.set_insecure_environment(env) adv_chat.set_socket(env.require("socket")) if adv_chat.bridges.irc then modlib.mod.extend("adv_chat", "irc") end - if adv_chat.bridges.discord then modlib.mod.extend("adv_chat", "discord") end diff --git a/main.lua b/main.lua index f10c766..057dfc2 100644 --- a/main.lua +++ b/main.lua @@ -59,7 +59,7 @@ end channels={} --channelname -> definition : {hud_pos, mode, autoremove, max_messages, max_lines, wrap_chars, smartwrap} roles={} -- Role -> players -> true if roles_case_insensitive then - modlib.table.set_case_insensitive_index(teams) + modlib.table.set_case_insensitive_index(roles) end chatters={} -- Chatter -> stuff to_be_sent={} --Receiver -> { {sender, message, date, time} } diff --git a/message.lua b/message.lua index 42f0069..e1aac32 100644 --- a/message.lua +++ b/message.lua @@ -229,7 +229,7 @@ function message.build(msg, target) end function message.handle_on_chat_messages(msg) - local on_chat_messages = call_registered_on_chat_messages(msg.chatter.name, msg.content, msg) + local on_chat_messages = call_registered_on_chat_messages((msg.chatter and msg.chatter.name) or "", msg.content, msg) if on_chat_messages then msg.handled_by_on_chat_messages = on_chat_messages return on_chat_messages diff --git a/process_bridges.lua b/process_bridges.lua index 528187c..971f808 100644 --- a/process_bridges.lua +++ b/process_bridges.lua @@ -1,16 +1,14 @@ - - -local socket = require("socket") -function set_socket(sock) - socket=sock - build_bridge = (socket and build_socket_bridge) or build_file_bridge - set_socket=nil -end - local os_execute = os.execute -function set_os_execute(os_exec) - os_execute = os_exec - set_os_execute = nil +function set_insecure_environment(env) + os_execute = env.os.execute + local socket = env.require("socket") + assert(socket, "Install the luasocket library using luarocks") + function set_socket(sock) + socket=sock + build_bridge = (socket and build_socket_bridge) or build_file_bridge + set_socket=nil + end + set_insecure_environment = nil end local ping_timeout = 5 @@ -63,7 +61,6 @@ function build_socket_bridge(name, logs) end end) end - return self end