diff --git a/SETTINGS.txt b/SETTINGS.txt index f0fc389..630ba84 100644 --- a/SETTINGS.txt +++ b/SETTINGS.txt @@ -6,7 +6,7 @@ # GENERAL SERVER SETTINGS # # Enter here your Discord API Token you'll get from here: https://discordapp.com/developers/applications/me - TOKEN = "Mjg3NTM4NDM1NjU1MjA0ODY0.DCppvg.lNnxUM-y_P7kSaRhmVZlevQ5m3I" + TOKEN = "Mjg3NTM4NDM1NjU1MjA0ODY0.DD0qvg.XN0l_ZRmwnl3uixRq5Vonrp3OMo" # Prefix to send bot commands (like -help or ~help or .help, what ever you want) CMD_PREFIX = "." @@ -16,7 +16,7 @@ # Log entered command in console of the bot COMMAND_CONSOLE_OUTPUT = true # Automatically check for updates - AUTO_UPDATE = false + UPDATE_INFO = false # Only allow members to use music commands in music channel MUSIC_COMMANDS_ONLY_IN_MUSIC_CHANNEL = false # Volume in percent (0 - 100, 0 -> Disabled -> 100% volume) diff --git a/install.py b/install.py deleted file mode 100644 index cc61fd8..0000000 --- a/install.py +++ /dev/null @@ -1,119 +0,0 @@ -################################### -# USE THIS TO FOR INSTALLATION # -# (c) zekro 2017 # -################################### - -import os -import urllib -import platform -import sys - -updateURL = "https://github.com/zekroTJA/DiscordBot/blob/master/out/artifacts/DiscordBot_jar/DiscordBot.jar?raw=true" -updateScriptURL = "https://raw.githubusercontent.com/zekroTJA/DiscordBot/master/update.py" -restartScriptURL = "https://raw.githubusercontent.com/zekroTJA/DiscordBot/master/restart.py" -settingsURL = "https://raw.githubusercontent.com/zekroTJA/DiscordBot/master/SETTINGS.txt" -startFileURL = "https://raw.githubusercontent.com/zekroTJA/DiscordBot/master/startfile.sh" - -DEFintsallPath = "Programs/zekroBot/" - - -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' - -class messages: - DL_FAIL = bcolors.FAIL + "An error occured while downloading! Please check your network connection!" + bcolors.ENDC - DL_COMPLETED = bcolors.OKGREEN + "Download completed." + bcolors.ENDC - COMPLETED = bcolors.OKGREEN + "Completed." + bcolors.ENDC - - -print "##############################\n" \ - "# " + bcolors.BOLD + bcolors.OKBLUE + "ZEKROS DISCORD BOT" + bcolors.ENDC + " #\n" \ - "# INSTALLATION #\n" \ - "# (C) 2017 by zekro #\n" \ - "##############################\n\n" - -print "Please enter a path to install. Enter nothing for default installation path (~/Programs/zekroBot/)..." -installPath = raw_input() -installPath += "/" - -if installPath == "": - installPath = DEFintsallPath - print "Default path chosen." - -else: - if not os.path.exists(installPath): - print "Entered path " + installPath + " does not exist. Create path now?" - if raw_input("(y/n):") == "y": - os.makedirs(installPath) - print "Path created." - else: - sys.exit(0); - else: - print "Path " + installPath + " chosen." - - -if platform.system() != "Linux": - print "\n[ERROR] Please only use that installation script on Linux based system!" - sys.exit(0) - -print "\n" + bcolors.ENDC + "Downloading/Updating screen package..." -os.system("sudo apt-get install screen") - -if not os.path.exists(installPath): - print "\n" + bcolors.ENDC + "Creating path..." - os.makedirs(installPath) - -print "\n" + bcolors.ENDC + "Downloading 'DiscordBot.jar'..." -try: - urllib.urlretrieve(updateURL, installPath + "DiscordBot.jar") - print messages.DL_COMPLETED -except: - print messages.DL_FAIL - - -print "\n" + bcolors.ENDC + "Downloading 'update.py'..." -try: - urllib.urlretrieve(updateScriptURL, installPath + "update.py") - print messages.DL_COMPLETED -except: - print messages.DL_FAIL - -print "\n" + bcolors.ENDC + "Downloading 'restart.py'..." -try: - urllib.urlretrieve(restartScriptURL, installPath + "restart.py") - print messages.DL_COMPLETED -except: - print messages.DL_FAIL - -print "\n" + bcolors.ENDC + "Downloading 'SETTINGS.txt'..." -try: - urllib.urlretrieve(settingsURL, installPath + "SETTINGS.txt") - print messages.DL_COMPLETED -except: - print messages.DL_FAIL - -print "\n" + bcolors.ENDC + "Creating 'zb' (Startfile)..." -f = open("zb", "w") -f.write("cd " + installPath + "\n") -f.write("sudo screen -L -S zekroBot sudo java -jar DiscordBot.jar") -f.close() -print messages.COMPLETED - - -print "\n" + bcolors.OKGREEN + "Installation finished!" - -print "\n" + bcolors.ENDC + "Do you want to open SETTINS.txt now?" -if raw_input("(y/n):") == "y": - os.system("sudo nano " + installPath + "/SETTINGS.txt") -else: - print "\n" + bcolors.OKBLUE + "Please open the file '~/Programs/zekroBot/SETTINGS.txt' \n" \ - "and enter your Discord API token!" - -sys.exit(0) diff --git a/out/artifacts/DiscordBot_jar/DiscordBot_1.29.3.0.jar b/out/artifacts/DiscordBot_jar/DiscordBot_1.31.1.0.jar similarity index 97% rename from out/artifacts/DiscordBot_jar/DiscordBot_1.29.3.0.jar rename to out/artifacts/DiscordBot_jar/DiscordBot_1.31.1.0.jar index ed668a0..cee56d7 100644 Binary files a/out/artifacts/DiscordBot_jar/DiscordBot_1.29.3.0.jar and b/out/artifacts/DiscordBot_jar/DiscordBot_1.31.1.0.jar differ diff --git a/out/artifacts/DiscordBot_jar/DiscordBot_1.29.4.0.jar b/out/artifacts/DiscordBot_jar/DiscordBot_1.32.0.0.jar similarity index 97% rename from out/artifacts/DiscordBot_jar/DiscordBot_1.29.4.0.jar rename to out/artifacts/DiscordBot_jar/DiscordBot_1.32.0.0.jar index e2f65c3..eec3e4e 100644 Binary files a/out/artifacts/DiscordBot_jar/DiscordBot_1.29.4.0.jar and b/out/artifacts/DiscordBot_jar/DiscordBot_1.32.0.0.jar differ diff --git a/src/main/java/commands/Command.java b/src/main/java/commands/Command.java index 7be693b..470fbe1 100644 --- a/src/main/java/commands/Command.java +++ b/src/main/java/commands/Command.java @@ -13,5 +13,6 @@ public interface Command { String help(); String description(); String commandType(); + int permission(); } diff --git a/src/main/java/commands/administration/Broadcast.java b/src/main/java/commands/administration/Broadcast.java index c9648fb..504c9c1 100644 --- a/src/main/java/commands/administration/Broadcast.java +++ b/src/main/java/commands/administration/Broadcast.java @@ -64,11 +64,16 @@ public String help() { @Override public String description() { - return null; + return "Send a message to all servers general chats"; } @Override public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 3; + } } diff --git a/src/main/java/commands/administration/Guilds.java b/src/main/java/commands/administration/Guilds.java index 80242b1..b0d55fb 100644 --- a/src/main/java/commands/administration/Guilds.java +++ b/src/main/java/commands/administration/Guilds.java @@ -12,6 +12,7 @@ import java.io.IOException; import java.text.ParseException; +import java.util.Comparator; /** * Created by zekro on 11.06.2017 / 11:02 @@ -56,8 +57,10 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept StringBuilder sb = new StringBuilder(); sb.append("**Running on `" + event.getJDA().getGuilds().size() + "` guilds.**\n\n"); - event.getJDA().getGuilds().forEach(g -> sb.append( - ":white_small_square: **" + g.getName() + "** - `" + g.getId() + "` - " + g.getOwner().getAsMention() + "\n" + event.getJDA().getGuilds().stream() + .sorted(Comparator.comparingInt(s -> s.getMembers().size())) + .forEach(g -> sb.append( + ":white_small_square: *[" + g.getMembers().size() + "]* - **" + g.getName() + "** - `" + g.getId() + "` - " + g.getOwner().getEffectiveName() + "\n" )); event.getTextChannel().sendMessage(new EmbedBuilder().setTitle("Guilds", null).setDescription(sb.toString()).build()).queue(); @@ -76,11 +79,16 @@ public String help() { @Override public String description() { - return null; + return "Get list of guilds bot is running on"; } @Override public String commandType() { return STATICS.CMDTYPE.administration; } + + @Override + public int permission() { + return 3; + } } diff --git a/src/main/java/commands/administration/Restart.java b/src/main/java/commands/administration/Restart.java index 925d508..713158a 100644 --- a/src/main/java/commands/administration/Restart.java +++ b/src/main/java/commands/administration/Restart.java @@ -35,7 +35,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept event.getTextChannel().sendMessage(":warning: Bot will restart now...").queue(); if (System.getProperty("os.name").toLowerCase().contains("linux")) - Runtime.getRuntime().exec("sudo screen sudo python restart.py"); + Runtime.getRuntime().exec("screen sudo python restart.py"); else Runtime.getRuntime().exec("wincmd.exe -restart"); @@ -62,4 +62,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.administration; } + + @Override + public int permission() { + return 3; + } } diff --git a/src/main/java/commands/administration/Stop.java b/src/main/java/commands/administration/Stop.java index fce123c..434e7f6 100644 --- a/src/main/java/commands/administration/Stop.java +++ b/src/main/java/commands/administration/Stop.java @@ -1,6 +1,7 @@ package commands.administration; import commands.Command; +import commands.etc.BotStats; import core.Perms; import core.coreCommands; import net.dv8tion.jda.core.events.message.MessageReceivedEvent; @@ -8,6 +9,8 @@ import java.io.IOException; import java.text.ParseException; +import java.util.Timer; +import java.util.TimerTask; /** * Created by zekro on 23.03.2017 / 21:13 @@ -27,8 +30,16 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept if (!Perms.isOwner(event.getAuthor(), event.getTextChannel())) return; - event.getTextChannel().sendMessage(":warning: :mobile_phone_off: " + event.getAuthor().getAsMention() + " shut down " + event.getJDA().getSelfUser().getAsMention() + " because of maintenance or an unexpected behavior.").queue(); - System.exit(0); + BotStats.save(); + + //event.getTextChannel().sendMessage(":warning: :mobile_phone_off: " + event.getAuthor().getAsMention() + " shut down " + event.getJDA().getSelfUser().getAsMention() + " because of maintenance or an unexpected behavior.").queue(); + new Timer().schedule(new TimerTask() { + @Override + public void run() { + System.exit(0); + } + }, 1000); + } @Override @@ -50,4 +61,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.administration; } + + @Override + public int permission() { + return 3; + } } diff --git a/src/main/java/commands/administration/Update.java b/src/main/java/commands/administration/Update.java index 9eab2e9..0449363 100644 --- a/src/main/java/commands/administration/Update.java +++ b/src/main/java/commands/administration/Update.java @@ -28,14 +28,7 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept if (!Perms.isOwner(event.getAuthor(), event.getTextChannel())) return; - if (!core.update.checkIfUpdate()) { - event.getTextChannel().sendMessage( - ":warning: The bot is up to date! ;)" - ).queue(); - return; - } - - core.update.getUpdate(event.getJDA().getGuilds()); + update.manualCheck(event.getMessage().getTextChannel()); } @@ -58,4 +51,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.administration; } + + @Override + public int permission() { + return 3; + } } diff --git a/src/main/java/commands/administration/testCMD.java b/src/main/java/commands/administration/testCMD.java index d7f7742..91874a2 100644 --- a/src/main/java/commands/administration/testCMD.java +++ b/src/main/java/commands/administration/testCMD.java @@ -54,4 +54,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.administration; } + + @Override + public int permission() { + return 3; + } } diff --git a/src/main/java/commands/chat/BJoke.java b/src/main/java/commands/chat/BJoke.java index 6d4dda4..1364529 100644 --- a/src/main/java/commands/chat/BJoke.java +++ b/src/main/java/commands/chat/BJoke.java @@ -109,4 +109,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } \ No newline at end of file diff --git a/src/main/java/commands/chat/Cat.java b/src/main/java/commands/chat/Cat.java index f770c84..bd6e4a0 100644 --- a/src/main/java/commands/chat/Cat.java +++ b/src/main/java/commands/chat/Cat.java @@ -135,4 +135,10 @@ public static String getCat() { return outputMessage; } + + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/Clear.java b/src/main/java/commands/chat/Clear.java index 923b0c1..2dbbb85 100644 --- a/src/main/java/commands/chat/Clear.java +++ b/src/main/java/commands/chat/Clear.java @@ -188,4 +188,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 1; + } } diff --git a/src/main/java/commands/chat/EightBall.java b/src/main/java/commands/chat/EightBall.java index 2e16b3a..fb833e7 100644 --- a/src/main/java/commands/chat/EightBall.java +++ b/src/main/java/commands/chat/EightBall.java @@ -57,4 +57,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/Joke.java b/src/main/java/commands/chat/Joke.java index 7f9b1ac..7086ddd 100644 --- a/src/main/java/commands/chat/Joke.java +++ b/src/main/java/commands/chat/Joke.java @@ -100,4 +100,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/JokeV2.java b/src/main/java/commands/chat/JokeV2.java index 8e86420..04c5146 100644 --- a/src/main/java/commands/chat/JokeV2.java +++ b/src/main/java/commands/chat/JokeV2.java @@ -77,11 +77,16 @@ public String help() { @Override public String description() { - return null; + return "Throw around with some yo mama jokes"; } @Override public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/Quote.java b/src/main/java/commands/chat/Quote.java index 43903dd..b2afa77 100644 --- a/src/main/java/commands/chat/Quote.java +++ b/src/main/java/commands/chat/Quote.java @@ -79,11 +79,16 @@ public String help() { @Override public String description() { - return null; + return "Quote a message in any channel on guild"; } @Override public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/Say.java b/src/main/java/commands/chat/Say.java index f080370..afde0fe 100644 --- a/src/main/java/commands/chat/Say.java +++ b/src/main/java/commands/chat/Say.java @@ -54,4 +54,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 1; + } } diff --git a/src/main/java/commands/chat/Stups.java b/src/main/java/commands/chat/Stups.java index e277b64..efb873f 100644 --- a/src/main/java/commands/chat/Stups.java +++ b/src/main/java/commands/chat/Stups.java @@ -83,4 +83,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/TTT.java b/src/main/java/commands/chat/TTT.java index 1fedb44..a9df331 100644 --- a/src/main/java/commands/chat/TTT.java +++ b/src/main/java/commands/chat/TTT.java @@ -39,11 +39,16 @@ public String help() { @Override public String description() { - return null; + return ""; } @Override public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/Vote.java b/src/main/java/commands/chat/Vote.java index f1a1422..127f6f0 100644 --- a/src/main/java/commands/chat/Vote.java +++ b/src/main/java/commands/chat/Vote.java @@ -253,4 +253,9 @@ public String commandType() { return STATICS.CMDTYPE.chatutils; } + @Override + public int permission() { + return 0; + } + } diff --git a/src/main/java/commands/chat/Vote2.java b/src/main/java/commands/chat/Vote2.java index 63af2c0..a7788a2 100644 --- a/src/main/java/commands/chat/Vote2.java +++ b/src/main/java/commands/chat/Vote2.java @@ -217,4 +217,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/chat/WarframeAlerts.java b/src/main/java/commands/chat/WarframeAlerts.java index fb5fc8e..2f75458 100644 --- a/src/main/java/commands/chat/WarframeAlerts.java +++ b/src/main/java/commands/chat/WarframeAlerts.java @@ -1,11 +1,13 @@ package commands.chat; import commands.Command; +import core.SSSS; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.JDA; import net.dv8tion.jda.core.entities.Message; import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import utils.MSGS; import utils.STATICS; import java.awt.*; @@ -148,7 +150,7 @@ public void run() { ArrayList textChans = new ArrayList<>(); jda.getGuilds().forEach(g -> { - List chans = g.getTextChannelsByName(STATICS.warframeAlertsChannel, true); + List chans = g.getTextChannelsByName(SSSS.getWARFRAMELAERTSCHAN(g), true); if (chans.size() > 0) textChans.add(chans.get(0)); }); @@ -215,6 +217,18 @@ public void run() { m.delete().queue(); } }, 5000)); + + break; + + case "channel": + + if (args.length < 2) { + event.getTextChannel().sendMessage(MSGS.error.setDescription("Please enter a valid text channel!").build()).queue(); + return; + } + + SSSS.setWARFRAMELAERTSCHAN(args[1].toLowerCase(), event.getGuild()); + event.getTextChannel().sendMessage(MSGS.success.setDescription("Successfully set warframe alerts channel to `" + args[1].toLowerCase() + "`").build()).queue(); } } @@ -231,11 +245,16 @@ public String help() { @Override public String description() { - return null; + return "Manage warframe alerts function"; } @Override public String commandType() { return STATICS.CMDTYPE.chatutils; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/essentials/Help.java b/src/main/java/commands/essentials/Help.java index b4dbe8c..1e73ab3 100644 --- a/src/main/java/commands/essentials/Help.java +++ b/src/main/java/commands/essentials/Help.java @@ -2,12 +2,14 @@ import commands.Command; import core.Main; +import core.SSSS; import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.entities.PrivateChannel; import net.dv8tion.jda.core.events.message.MessageReceivedEvent; import utils.STATICS; import java.awt.*; +import java.lang.reflect.Field; import java.util.*; /** @@ -22,6 +24,16 @@ public class Help implements Command { EmbedBuilder eb = new EmbedBuilder(); + private String getPermPre(int lvl) { + switch (lvl) { + case 1: return ":small_blue_diamond:"; + case 2: return ":small_orange_diamond:"; + case 3: return ":small_red_triangle_down:"; + default: return ":white_small_square:"; + } + } + + @Override public boolean called(String[] args, MessageReceivedEvent event) { return false; @@ -54,7 +66,7 @@ public void action(String[] args, MessageReceivedEvent event) { StringBuilder ciams = new StringBuilder(); - String[] ignorers = {"c", "m", "bj", "ttt", "userinfo", "dev", "nudge", "poll", "moveall"}; + String[] ignorers = {"test", "c", "bj", "ttt", "userinfo", "dev", "nudge", "poll", "moveall", "purge", "info", "suggestion", "r6", }; Arrays.stream(ignorers).forEach(s -> cmds.remove(s)); @@ -63,14 +75,21 @@ public void action(String[] args, MessageReceivedEvent event) { PrivateChannel pc = event.getAuthor().openPrivateChannel().complete(); pc.sendMessage(":clipboard: __**COMMAD LIST**__ :clipboard: \n\n" + "If you want a full list of commands with description, please take a look there:\n" + - ":point_right: **http://zekrosbot.zekro.de**\n\n").queue(); + ":point_right: **http://zekrosbot.zekro.de**\n\n" + + "***Legend:***\n" + + " :white_small_square: - Usable for everyone\n" + + " :small_blue_diamond: - Only for groups `" + Arrays.toString(SSSS.getPERMROLES_1(event.getGuild())).replace("[", "").replace("]", "") + "`\n" + + " :small_orange_diamond: - Only for groups `" + Arrays.toString(SSSS.getPERMROLES_2(event.getGuild())).replace("[", "").replace("]", "") + "`\n" + + " :small_red_triangle_down: - Only for owner of the server\n" + + "\n\n___").queue(); + ciams.delete(0, ciams.length()); ciams.append("**" + STATICS.CMDTYPE.administration + "**\n"); cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.administration)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(134, 255, 0)).setDescription(ciams.toString()).build()).queue(); @@ -79,7 +98,7 @@ public void action(String[] args, MessageReceivedEvent event) { cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.chatutils)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(255, 97, 0)).setDescription(ciams.toString()).build()).queue(); @@ -88,7 +107,7 @@ public void action(String[] args, MessageReceivedEvent event) { cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.essentials)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(255, 0, 213)).setDescription(ciams.toString()).build()).queue(); @@ -97,7 +116,7 @@ public void action(String[] args, MessageReceivedEvent event) { cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.etc)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(39, 0, 255)).setDescription(ciams.toString()).build()).queue(); @@ -106,7 +125,7 @@ public void action(String[] args, MessageReceivedEvent event) { cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.guildadmin)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(0, 233, 255)).setDescription(ciams.toString()).build()).queue(); @@ -115,7 +134,7 @@ public void action(String[] args, MessageReceivedEvent event) { cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.music)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(0, 255, 126)).setDescription(ciams.toString()).build()).queue(); @@ -124,7 +143,7 @@ public void action(String[] args, MessageReceivedEvent event) { cmds.keySet().stream() .filter(s -> Main.commands.get(s).commandType().equals(STATICS.CMDTYPE.settings)) .forEach(s1 -> ciams.append( - ":white_small_square: **" + s1 + "** - `" + cmds.get(s1) + "`\n" + getPermPre(Main.commands.get(s1).permission()) + " **" + s1 + "** - `" + cmds.get(s1) + "`\n" )); pc.sendMessage(new EmbedBuilder().setColor(new Color(255, 233, 0)).setDescription(ciams.toString()).build()).queue(); @@ -132,26 +151,6 @@ public void action(String[] args, MessageReceivedEvent event) { e.printStackTrace(); } - //cmds.forEach((s, s2) -> ciams.append( - // ":white_small_square: **" + s + "** - `" + s2 + "`\n" - //)); - - //try { - // - // PrivateChannel pc = event.getMember().getUser().openPrivateChannel().complete(); - // pc.sendMessage( - // ":clipboard: __**COMMAD LIST**__ :clipboard: \n\n" + - // "If you want a full list of commands with description, please take a look there:\n" + - // ":point_right: **http://zekrosbot.zekro.de**\n\n" + - // ciams.toString() - // - // ).queue(); - // - // - //} catch (Exception e) { - // e.printStackTrace(); - //} - } @@ -174,4 +173,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.essentials; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/essentials/Info.java b/src/main/java/commands/essentials/Info.java index 9e9f0b0..d01a488 100644 --- a/src/main/java/commands/essentials/Info.java +++ b/src/main/java/commands/essentials/Info.java @@ -56,7 +56,7 @@ public void action(String[] args, MessageReceivedEvent event) { " - Steam-Condenser *(https://github.com/koraktor/steam-condenser-java)*", false) .addField("Bug Reporting / Idea Suggestion", "If you got some bugs, please contact us here:\n" + - " - **Please use this document to report a bug or suggest an idea: http://s.zekro.de/botsubs**\n" + + " - **Please use this document to report a Bug or suggest an idea: http://s.zekro.de/botsubs**\n" + " - E-Mail: zekrotja@gmail.com\n" + " - Discord: http://discord.zekro.de (or directly: `zekro#9131` & `Sophie#4538`)", false) @@ -91,4 +91,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.essentials; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/essentials/Ping.java b/src/main/java/commands/essentials/Ping.java index 04f8512..f5d83eb 100644 --- a/src/main/java/commands/essentials/Ping.java +++ b/src/main/java/commands/essentials/Ping.java @@ -41,5 +41,10 @@ public String commandType() { return STATICS.CMDTYPE.essentials; } + @Override + public int permission() { + return 0; + } + } diff --git a/src/main/java/commands/essentials/Stats.java b/src/main/java/commands/essentials/Stats.java index 6752711..c319dce 100644 --- a/src/main/java/commands/essentials/Stats.java +++ b/src/main/java/commands/essentials/Stats.java @@ -104,4 +104,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.essentials; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/essentials/UserInfo.java b/src/main/java/commands/essentials/UserInfo.java index 2b2f3f8..4eabc6e 100644 --- a/src/main/java/commands/essentials/UserInfo.java +++ b/src/main/java/commands/essentials/UserInfo.java @@ -110,4 +110,9 @@ public String commandType() { return STATICS.CMDTYPE.essentials; } + @Override + public int permission() { + return 0; + } + } diff --git a/src/main/java/commands/etc/BotStats.java b/src/main/java/commands/etc/BotStats.java new file mode 100644 index 0000000..e9db6d0 --- /dev/null +++ b/src/main/java/commands/etc/BotStats.java @@ -0,0 +1,136 @@ +package commands.etc; + +import com.moandjiezana.toml.TomlWriter; +import commands.Command; +import core.Main; +import net.dv8tion.jda.core.EmbedBuilder; +import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import utils.STATICS; + +import java.awt.*; +import java.io.*; +import java.text.ParseException; + +/** + * Created by zekro on 05.07.2017 / 20:53 + * DiscordBot.commands.etc + * dev.zekro.de - github.zekro.de + * © zekro 2017 + */ + + +public class BotStats implements Command { + + static File f = new File("botstatics.donotdelete"); + + public static long messagesProcessed = 0; + public static long commandsExecuted = 0; + + private int membersDeserving = 0; + + public static void save() { + + if (!f.exists()) + try { + f.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + + BufferedWriter bw = new BufferedWriter(new FileWriter(f)); + bw.write(messagesProcessed + "\n" + commandsExecuted); + bw.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + + } + + public static long[] stats() { + + if (!f.exists()) + return new long[] {0, 0}; + + try { + + BufferedReader br = new BufferedReader(new FileReader(f)); + return new long[] {Long.parseLong(br.readLine()), Long.parseLong(br.readLine())}; + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return new long[] {0, 0}; + } + + public static void load() { + messagesProcessed = stats()[0]; + commandsExecuted = stats()[1]; + } + + private void countUpMembers() { + membersDeserving++; + } + + + @Override + public boolean called(String[] args, MessageReceivedEvent event) { + return false; + } + + @Override + public void action(String[] args, MessageReceivedEvent event) throws ParseException, IOException { + + int commandsSize = Main.commands.size(); + int serversRunning = event.getJDA().getGuilds().size(); + + event.getJDA().getGuilds().forEach(g -> g.getMembers().forEach(m -> countUpMembers())); + + event.getTextChannel().sendMessage( + new EmbedBuilder() + .setColor(Color.cyan) + .setDescription( + "**zekroBot STATS**\n\n" + + "```\n" + + "Registered commands: " + commandsSize + "\n" + + "Running on servers: " + serversRunning + "\n" + + "Deserving members: " + membersDeserving + "\n" + + "Messages processed: " + messagesProcessed + "\n" + + "Commands executed: " + commandsExecuted + "\n" + + "```" + ).build() + ).queue(); + + membersDeserving = 0; + + } + + @Override + public void executed(boolean success, MessageReceivedEvent event) { + + } + + @Override + public String help() { + return null; + } + + @Override + public String description() { + return null; + } + + @Override + public String commandType() { + return STATICS.CMDTYPE.etc; + } + + @Override + public int permission() { + return 0; + } +} diff --git a/src/main/java/commands/etc/Bug.java b/src/main/java/commands/etc/Bug.java new file mode 100644 index 0000000..7e45ac2 --- /dev/null +++ b/src/main/java/commands/etc/Bug.java @@ -0,0 +1,150 @@ +package commands.etc; + +import commands.Command; +import net.dv8tion.jda.core.EmbedBuilder; +import net.dv8tion.jda.core.entities.Message; +import net.dv8tion.jda.core.entities.TextChannel; +import net.dv8tion.jda.core.entities.User; +import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import org.apache.http.auth.AUTH; +import utils.MSGS; +import utils.STATICS; + +import java.io.IOException; +import java.text.ParseException; +import java.util.Arrays; +import java.util.Timer; +import java.util.TimerTask; +import java.util.stream.Collectors; + +/** + * Created by zekro on 01.07.2017 / 10:50 + * DiscordBot.commands.etc + * dev.zekro.de - github.zekro.de + * © zekro 2017 + */ + +public class Bug implements Command { + + public static User AUTHOR; + public static Message MESSAGE; + public static EmbedBuilder FINAL_MESSAGE; + public static TextChannel CHANNEL; + public static Timer TIMER = new Timer(); + + + public static void sendConfMessage() { + MESSAGE.getTextChannel().sendMessage(MSGS.success.setDescription("Submit sucesfully send!").build()).queue(); + } + + + @Override + public boolean called(String[] args, MessageReceivedEvent event) { + return false; + } + + @Override + public void action(String[] args, MessageReceivedEvent event) throws ParseException, IOException { + + try { + + CHANNEL = event.getJDA().getGuildById("307084334198816769").getTextChannelById("330636155668135936"); + + } catch (Exception e) { + + if (args.length < 1) { + event.getTextChannel().sendMessage(new EmbedBuilder().setDescription( + "If you want to submit a bug or a suggestion, please use the public **[google sheet](https://s.zekro.de/botsubs)**." + ).build()).queue(); + return; + } + event.getTextChannel().sendMessage(MSGS.error.setDescription( + "Sorry, the expandet version of this command is only available on the public version of the bot!\n\n" + + "If you want to submit a bug or a suggestion, please use the public **[google sheet](https://s.zekro.de/botsubs)**." + ).build()).queue(); + return; + } + + if (args.length < 1) + event.getTextChannel().sendMessage(new EmbedBuilder().setDescription( + "You can submit a bug report or suggestion right with the command using like this:\n" + + "```-bug ```\n\n" + + "You can use following modifiers to embed better details:\n" + + "```-bug \n" + + "<bug/gussestion>\n" + + "<message>```\n\n" + + "Otherwise you can also just use the public **[google sheet](https://s.zekro.de/botsubs)** to submit a bug or suggestion." + ).build()).queue(); + else { + + String title = "Bug report / Suggestion"; + String type = "unspecified"; + String message = ""; + + String argsString = Arrays.stream(args).collect(Collectors.joining(" ")); + + title = argsString.split("\n").length > 3 ? argsString.split("\n")[0] : title; + type = argsString.split("\n").length > 3 ? argsString.split("\n")[1] : type; + message = argsString.split("\n").length > 3 ? Arrays.stream(argsString.split("\n")).skip(2).collect(Collectors.joining("\n")) : argsString; + + MESSAGE = event.getTextChannel().sendMessage(new EmbedBuilder() + .setTitle("MESSAGE PREVIEW", null) + .addField("Title", title, true) + .addField("Type", type, true) + .addField("Message", message, false) + .setFooter("Click on the reaction \uD83D\uDC4D to send the message. Else just dont klick ;)", null) + .build() + ).complete(); + MESSAGE.addReaction("\uD83D\uDC4D").queue(); + AUTHOR = event.getMessage().getAuthor(); + + FINAL_MESSAGE = new EmbedBuilder() + .addField("Message ID", event.getMessage().getId(), false) + .addField("Author", event.getAuthor().getName(), false) + .addField("Title", title, true) + .addField("Type", type, true) + .addField("Message", message, false); + + TIMER = new Timer(); + TIMER.schedule(new TimerTask() { + @Override + public void run() { + AUTHOR = null; + MESSAGE = null; + FINAL_MESSAGE = null; + CHANNEL = null; + TIMER = null; + event.getTextChannel().sendMessage(new EmbedBuilder().setDescription("Confirmation time expired.").build()).queue(); + } + }, 20000); + + } + + + } + + @Override + public void executed(boolean success, MessageReceivedEvent event) { + + } + + @Override + public String help() { + return null; + } + + @Override + public String description() { + return "Send a bug report or a suggestion"; + } + + @Override + public String commandType() { + return STATICS.CMDTYPE.etc; + } + + @Override + public int permission() { + return 0; + } +} diff --git a/src/main/java/commands/etc/CmdLog.java b/src/main/java/commands/etc/CmdLog.java index abc607a..7124c7f 100644 --- a/src/main/java/commands/etc/CmdLog.java +++ b/src/main/java/commands/etc/CmdLog.java @@ -88,4 +88,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/etc/Dev.java b/src/main/java/commands/etc/Dev.java index e4d2be5..063465e 100644 --- a/src/main/java/commands/etc/Dev.java +++ b/src/main/java/commands/etc/Dev.java @@ -111,4 +111,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/etc/Log.java b/src/main/java/commands/etc/Log.java index 94ecc02..c6fd2fd 100644 --- a/src/main/java/commands/etc/Log.java +++ b/src/main/java/commands/etc/Log.java @@ -132,11 +132,16 @@ public String help() { @Override public String description() { - return null; + return "Show bots log file"; } @Override public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/etc/Rand6.java b/src/main/java/commands/etc/Rand6.java index f934bfa..fdefd6b 100644 --- a/src/main/java/commands/etc/Rand6.java +++ b/src/main/java/commands/etc/Rand6.java @@ -226,4 +226,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/etc/Speedtest.java b/src/main/java/commands/etc/Speedtest.java index a0b4b4c..fd88e7b 100644 --- a/src/main/java/commands/etc/Speedtest.java +++ b/src/main/java/commands/etc/Speedtest.java @@ -107,4 +107,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/etc/Uptime.java b/src/main/java/commands/etc/Uptime.java index 7d96b62..f49dd73 100644 --- a/src/main/java/commands/etc/Uptime.java +++ b/src/main/java/commands/etc/Uptime.java @@ -79,4 +79,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/etc/tttServerStatus.java b/src/main/java/commands/etc/tttServerStatus.java index 5b9f9ba..0d1f3a8 100644 --- a/src/main/java/commands/etc/tttServerStatus.java +++ b/src/main/java/commands/etc/tttServerStatus.java @@ -69,4 +69,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.etc; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/guildAdministration/Kick.java b/src/main/java/commands/guildAdministration/Kick.java index 98e8230..5aaa84a 100644 --- a/src/main/java/commands/guildAdministration/Kick.java +++ b/src/main/java/commands/guildAdministration/Kick.java @@ -23,7 +23,7 @@ public boolean called(String[] args, MessageReceivedEvent event) { @Override public void action(String[] args, MessageReceivedEvent event) throws ParseException, IOException { - if (core.Perms.check(1, event)) return; + if (core.Perms.check(2, event)) return; String reason = "none"; if (args.length > 1) { @@ -68,4 +68,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.guildadmin; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/guildAdministration/Moveall.java b/src/main/java/commands/guildAdministration/Moveall.java index 5d77ba1..63bb698 100644 --- a/src/main/java/commands/guildAdministration/Moveall.java +++ b/src/main/java/commands/guildAdministration/Moveall.java @@ -107,4 +107,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.guildadmin; } + + @Override + public int permission() { + return 1; + } } diff --git a/src/main/java/commands/guildAdministration/Mute.java b/src/main/java/commands/guildAdministration/Mute.java index 749d0c1..ee2a6a1 100644 --- a/src/main/java/commands/guildAdministration/Mute.java +++ b/src/main/java/commands/guildAdministration/Mute.java @@ -152,4 +152,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.guildadmin; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/guildAdministration/Report.java b/src/main/java/commands/guildAdministration/Report.java index 3d5f75a..5a1f277 100644 --- a/src/main/java/commands/guildAdministration/Report.java +++ b/src/main/java/commands/guildAdministration/Report.java @@ -49,8 +49,8 @@ public void action(String[] args, MessageReceivedEvent event) throws ParseExcept admins.forEach(m -> m.getUser().openPrivateChannel().complete().sendMessage( new EmbedBuilder() .setAuthor(m.getEffectiveName() + " submitted a report.", null, m.getUser().getAvatarUrl()) - .addField("Author", author.getAsMention(), true) - .addField("Reported Member", traitor.getAsMention(), true) + .addField("Author", author.getEffectiveName() + " (" + author.getAsMention() + ")", true) + .addField("Reported Member", traitor.getEffectiveAvatarUrl() + " (" + traitor.getAsMention() + ")", true) .addField("Reason", reason, false) .build() ).queue()); @@ -83,4 +83,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.guildadmin; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/guildAdministration/Spacer.java b/src/main/java/commands/guildAdministration/Spacer.java new file mode 100644 index 0000000..f9414be --- /dev/null +++ b/src/main/java/commands/guildAdministration/Spacer.java @@ -0,0 +1,80 @@ +package commands.guildAdministration; + +import commands.Command; +import net.dv8tion.jda.core.entities.Channel; +import net.dv8tion.jda.core.entities.VoiceChannel; +import net.dv8tion.jda.core.events.message.MessageReceivedEvent; +import utils.MSGS; +import utils.STATICS; + +import java.io.IOException; +import java.text.ParseException; + +/** + * Created by zekro on 01.07.2017 / 13:36 + * DiscordBot.commands.guildAdministration + * dev.zekro.de - github.zekro.de + * © zekro 2017 + */ + +public class Spacer implements Command { + + + @Override + public boolean called(String[] args, MessageReceivedEvent event) { + return false; + } + + @Override + public void action(String[] args, MessageReceivedEvent event) throws ParseException, IOException { + + if (core.Perms.check(1, event)) return; + + if (args.length < 1) { + event.getTextChannel().sendMessage(MSGS.error.setDescription(help()).build()).queue(); + return; + } + + switch (args[0]) { + + case "add": + + if (!event.getMember().getVoiceState().inVoiceChannel()) { + event.getTextChannel().sendMessage(MSGS.error.setDescription("You need to be in a voice channel to add a spacer.").build()).queue(); + return; + } + + Channel vc = event.getGuild().getController().createVoiceChannel("-------------------------").complete(); + event.getGuild().getController().modifyVoiceChannelPositions().selectPosition(vc.getPosition()).moveTo(event.getMember().getVoiceState().getChannel().getPosition() + 1).queue(); + + break; + + } + + } + + @Override + public void executed(boolean success, MessageReceivedEvent event) { + + } + + @Override + public String help() { + return null; + } + + @Override + public String description() { + return "Create spacer voice channels"; + } + + @Override + public String commandType() { + return STATICS.CMDTYPE.guildadmin; + } + + @Override + public int permission() { + return 1; + } +} diff --git a/src/main/java/commands/guildAdministration/VoiceKick.java b/src/main/java/commands/guildAdministration/VoiceKick.java index 04a8af1..912fd85 100644 --- a/src/main/java/commands/guildAdministration/VoiceKick.java +++ b/src/main/java/commands/guildAdministration/VoiceKick.java @@ -131,4 +131,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.guildadmin; } + + @Override + public int permission() { + return 1; + } } diff --git a/src/main/java/commands/music/Music.java b/src/main/java/commands/music/Music.java index 5507296..30b6f04 100644 --- a/src/main/java/commands/music/Music.java +++ b/src/main/java/commands/music/Music.java @@ -760,11 +760,16 @@ public String help() { @Override public String description() { - return null; + return "Play music"; } @Override public String commandType() { return STATICS.CMDTYPE.music; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/commands/settings/AutoRole.java b/src/main/java/commands/settings/AutoRole.java index 24eda76..13621f8 100644 --- a/src/main/java/commands/settings/AutoRole.java +++ b/src/main/java/commands/settings/AutoRole.java @@ -70,4 +70,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/settings/Botmessage.java b/src/main/java/commands/settings/Botmessage.java index 00c31c7..f42d94f 100644 --- a/src/main/java/commands/settings/Botmessage.java +++ b/src/main/java/commands/settings/Botmessage.java @@ -79,4 +79,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/settings/PermLvls.java b/src/main/java/commands/settings/PermLvls.java index 079f0d2..c06a8f2 100644 --- a/src/main/java/commands/settings/PermLvls.java +++ b/src/main/java/commands/settings/PermLvls.java @@ -75,4 +75,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/settings/Prefix.java b/src/main/java/commands/settings/Prefix.java index c1aff30..0ee0e48 100644 --- a/src/main/java/commands/settings/Prefix.java +++ b/src/main/java/commands/settings/Prefix.java @@ -55,4 +55,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/settings/ServerJoinMessage.java b/src/main/java/commands/settings/ServerJoinMessage.java index 068ce51..af0c435 100644 --- a/src/main/java/commands/settings/ServerJoinMessage.java +++ b/src/main/java/commands/settings/ServerJoinMessage.java @@ -59,4 +59,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/settings/ServerLeftMessage.java b/src/main/java/commands/settings/ServerLeftMessage.java index 5f97d43..e7259a4 100644 --- a/src/main/java/commands/settings/ServerLeftMessage.java +++ b/src/main/java/commands/settings/ServerLeftMessage.java @@ -60,4 +60,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 2; + } } diff --git a/src/main/java/commands/settings/Settings.java b/src/main/java/commands/settings/Settings.java index b403de8..fa0b3ac 100644 --- a/src/main/java/commands/settings/Settings.java +++ b/src/main/java/commands/settings/Settings.java @@ -47,4 +47,9 @@ public String description() { public String commandType() { return STATICS.CMDTYPE.settings; } + + @Override + public int permission() { + return 0; + } } diff --git a/src/main/java/core/Main.java b/src/main/java/core/Main.java index 41ceed0..cbab816 100644 --- a/src/main/java/core/Main.java +++ b/src/main/java/core/Main.java @@ -36,6 +36,9 @@ public static void main(String[] args) throws IOException { startArgumentHandler.args = args; settings.loadSettings(); + + BotStats.load(); + try { if (!settings.testForToken()) { System.out.println("[ERROR] PLEASE ENTER YOUR DISCORD API TOKEN FROM 'https://discordapp.com/developers/applications/me' IN THE TEXTFILE 'SETTINGS.txt' AND RESTART!"); @@ -132,6 +135,10 @@ public static void initializeCommands() { commands.put("broadcast", new Broadcast()); commands.put("guilds", new Guilds()); commands.put("report", new Report()); + commands.put("bug", new Bug()); + commands.put("suggestion", new Bug()); + commands.put("spacer", new Spacer()); + commands.put("botstats", new BotStats()); } @@ -145,6 +152,7 @@ public static void initializeListeners() { builder.addListener(new privateMessageListener()); builder.addListener(new reactionListener()); builder.addListener(new vkickListener()); + builder.addListener(new botJoinListener()); } @@ -152,6 +160,7 @@ public static void handleCommand(CommandParser.CommandContainer cmd) throws Pars if (commands.containsKey(cmd.invoke)) { + BotStats.commandsExecuted++; boolean safe = commands.get(cmd.invoke).called(cmd.args, cmd.event); if (!safe) { diff --git a/src/main/java/core/SSSS.java b/src/main/java/core/SSSS.java index bd021bf..2ff0794 100644 --- a/src/main/java/core/SSSS.java +++ b/src/main/java/core/SSSS.java @@ -32,17 +32,29 @@ public static void listSettings(MessageReceivedEvent event) { Guild g = event.getGuild(); - event.getTextChannel().sendMessage(new EmbedBuilder().setColor(new Color(0xE9D7D6)) - .setDescription("**SETTINGS FOR GUILD `\"" + g.getName() + "\"`**") - .addField("Prefix", "`\"" + getPREFIX(g) + "\"`", false) - .addField("Server Join Message", "`\"" + getSERVERJOINMESSAGE(g) + "\"`", false) - .addField("Server Leave Message", "`\"" + getSERVERLEAVEMESSAGE(g) + "\"`", false) - .addField("Music Channel", "`\"" + getMUSICCHANNEL(g) + "\"`", false) - .addField("Music Channel Lock", "`\"" + getLOCKMUSICCHANNEL(g) + "\"`", false) - .addField("Permission Level", "**Lvl 1:** `\"" + Arrays.toString(getPERMROLES_1(g)).replaceAll("\\[", "").replaceAll("]", "") + "\"`\n**Lvl 2:** `\"" + Arrays.toString(getPERMROLES_2(g)).replaceAll("\\[", "").replaceAll("]", "") + "\"`", false) - .addField("Autorole", "`\"" + getAUTOROLE(g) + "\"`", false) - .addField("vkick Channel", "`\"" + getVKICKCHANNEL(g) + "\"`", false) - .build() + StringBuilder keys = new StringBuilder(); + StringBuilder values = new StringBuilder(); + + File[] files = new File("SERVER_SETTINGS/" + g.getId() + "/").listFiles(); + System.out.println(files.length); + + Arrays.stream(files).forEach(f -> { + try { + BufferedReader br = new BufferedReader(new FileReader(f)); + keys.append("**" + f.getName() + "**\n"); + values.append("`" + br.readLine() + "`\n"); + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + }); + + event.getTextChannel().sendMessage(new EmbedBuilder() + .setTitle("Settings for guild \"" + g.getName() + "\" (" + g.getId() + ")", null) + .addBlankField(false) + .addField("Keys", keys.toString(), true) + .addField("Values", values.toString(), true) + .build() ).queue(); } @@ -330,4 +342,31 @@ public static void setR6OPSID(String entry, Guild guild) { } } + public static String getWARFRAMELAERTSCHAN(Guild guild) { + + try { + File f = new File("SERVER_SETTINGS/" + guild.getId() + "/warframealertschan"); + if (f.exists()) { + try { + return new BufferedReader(new FileReader(f)).readLine(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } catch (Exception e) {} + return STATICS.warframeAlertsChannel; + } + + public static void setWARFRAMELAERTSCHAN(String entry, Guild guild) { + + File f = new File("SERVER_SETTINGS/" + guild.getId() + "/warframealertschan"); + try { + BufferedWriter r = new BufferedWriter(new FileWriter(f)); + r.write(entry); + r.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } diff --git a/src/main/java/core/settings.java b/src/main/java/core/settings.java index 9a7be3d..b5ca5f5 100644 --- a/src/main/java/core/settings.java +++ b/src/main/java/core/settings.java @@ -19,7 +19,6 @@ public class settings { private static File sfile = new File("SETTINGS.txt"); - private static TomlWriter tomlw = new TomlWriter(); private static Toml toml; public static class SCONT { @@ -35,7 +34,7 @@ public static class SCONT { static final String KICK_VOICE_CHANNEL = "KICK_VOICE_CHANNEL"; static final String TTT_SERVER_IP = "TTT_SERVER_IP"; static final String TTT_SERVER_PORT = "TTT_SERVER_PORT"; - static final String AUTO_UPDATE = "AUTO_UPDATE"; + static final String UPDATE_INFO = "UPDATE_INFO"; static final String MUSIC_CHANNEL = "MUSIC_CHANNEL"; static final String GUILD_JOIN_ROLE = "GUILD_JOIN_ROLE"; static final String MUSIC_COMMANDS_ONLY_IN_MUSIC_CHANNEL = "MUSIC_COMMANDS_ONLY_IN_MUSIC_CHANNEL"; @@ -75,14 +74,14 @@ public static void loadSettings() throws IOException { " CUSTOM_PLAYING_MESSAGE = \"zekro.de\"\n" + " # Log entered command in console of the bot\n" + " COMMAND_CONSOLE_OUTPUT = true\n" + - " # Automatically check for updates\n" + - " AUTO_UPDATE = false\n" + + " # Automatically check for updates and inform you if there is a new update available\n" + + " UPDATE_INFO = true\n" + " # Only allow members to use music commands in music channel\n" + " MUSIC_COMMANDS_ONLY_IN_MUSIC_CHANNEL = false\n" + " # Volume in percent (0 - 100, 0 -> Disabled -> 100% volume)\n" + " MUSIC_VOLUME = 0\n" + " # Music buffer in milliseconds\n" + - " MUSIC_BUFFER = 5000" + + " MUSIC_BUFFER = 5000" + "\n" + "# PERMISSION SETTINGS #\n" + "\n" + @@ -137,31 +136,6 @@ public static void loadSettings() throws IOException { br.close(); - /* - Map<String, Object> map = new HashMap<>(); - - map.put(SCONT.COMMAND_CONSOLE_OUTPUT, true); - map.put(SCONT.DOCID_JOKES, ""); - map.put(SCONT.DOCID_WARFRAME_ALERTS_FILTER, ""); - map.put(SCONT.PERMISSION_ROLES, "Admin, Moderator, Owner"); - map.put(SCONT.WARFRAME_ALERTS_REFRESHTIME, 10); - map.put(SCONT.WARFRAME_ALERTS_TEXTCHANNEL, ""); - map.put(SCONT.VOICE_LOG_TEXTCHANNEL, ""); - map.put(SCONT.CUSTOM_MESSAGE, "ゼクロ"); - map.put(SCONT.PREFIX, "-"); - map.put(SCONT.TOKEN, ""); - map.put(SCONT.KICK_VOICE_CHANNEL, ""); - map.put(SCONT.AUTO_UPDATE, "true"); - map.put(SCONT.MUSIC_CHANNEL, "mucke"); - map.put(SCONT.GUILD_JOIN_ROLE, "Member"); - map.put(SCONT.MUSIC_COMMANDS_ONLY_IN_MUSIC_CHANNEL, false); - map.put(SCONT.MUSIC_VOLUME, 0); - map.put(SCONT.DISCORD_JOIN_MESSAGE, ":heart: Hey, [USER]! Welcome on the [GUILD]! :heart:"); - map.put(SCONT.FULL_PERMISSION_ROLES, "Admin, Owner"); - map.put(SCONT.BOT_OWNER_ID, ""); - - tomlw.write(map, new File("SETTINGS.txt")); - */ } else { @@ -179,7 +153,7 @@ public static void loadSettings() throws IOException { STATICS.KICK_VOICE_CHANNEL = toml.getString(SCONT.KICK_VOICE_CHANNEL); STATICS.TTT_SERVER_IP = toml.getString(SCONT.TTT_SERVER_IP); STATICS.TTT_SERVER_PORT = Math.toIntExact(toml.getLong(SCONT.TTT_SERVER_PORT)); - STATICS.autoUpdate = toml.getBoolean(SCONT.AUTO_UPDATE); + STATICS.autoUpdate = toml.getBoolean(SCONT.UPDATE_INFO); STATICS.musicChannel = toml.getString(SCONT.MUSIC_CHANNEL); STATICS.guildJoinRole = toml.getString(SCONT.GUILD_JOIN_ROLE); STATICS.musicCommandsOnlyInMusicChannel = toml.getBoolean(SCONT.MUSIC_COMMANDS_ONLY_IN_MUSIC_CHANNEL); diff --git a/src/main/java/core/update.java b/src/main/java/core/update.java index 35d23f0..a6d3007 100644 --- a/src/main/java/core/update.java +++ b/src/main/java/core/update.java @@ -1,17 +1,22 @@ package core; +import net.dv8tion.jda.core.EmbedBuilder; +import net.dv8tion.jda.core.JDA; import net.dv8tion.jda.core.entities.Guild; +import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.events.ReadyEvent; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; import utils.STATICS; +import java.awt.*; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.*; import java.util.List; -import java.util.Scanner; -import java.util.Timer; -import java.util.TimerTask; /** * Created by zekro on 22.03.2017 / 15:59 @@ -22,63 +27,134 @@ public class update { + private static String lastUpdate = ""; + public static String versionURL = "https://raw.githubusercontent.com/zekroTJA/DiscordBot/master/LATESTVERSION.txt"; - public static boolean checkIfUpdate() { + private static HashMap<String, Map.Entry<String, String>> getVersionInfo() throws IOException { + + String API_URL = "https://api.github.com/repos/zekrotja/DiscordBot/releases"; - String version = STATICS.VERSION; + HashMap<String, Map.Entry<String, String>> out = new HashMap<>(); + + URL url = new URL(API_URL); + Scanner s = new Scanner(url.openStream()); + String output = ""; + while (s.hasNextLine()) { + output += s.nextLine(); + } try { - URL url = new URL(versionURL); - Scanner s = new Scanner(url.openStream()); - version = s.nextLine(); + JSONArray jsonarray = new JSONArray(output); - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (IOException e) { + List<JSONObject> jsonobs = new ArrayList<>(); + for (int i = 0; i < jsonarray.length(); i++) { + jsonobs.add(jsonarray.getJSONObject(i)); + } + + + JSONObject pre = jsonobs.stream().filter(j -> { + try { + return j.getString("prerelease").equals("true"); + } catch (JSONException e) { + e.printStackTrace(); + return false; + } + }).findFirst().orElse(null); + + JSONObject stable = jsonobs.stream().filter(j -> { + try { + return j.getString("prerelease").equals("false"); + } catch (JSONException e) { + e.printStackTrace(); + return false; + } + }).findFirst().orElse(null); + + out.put("pre", new AbstractMap.SimpleEntry<>(pre.getString("tag_name"), pre.getString("html_url"))); + out.put("stable", new AbstractMap.SimpleEntry<>(stable.getString("tag_name"), stable.getString("html_url"))); + + } catch (JSONException e) { e.printStackTrace(); } - return !STATICS.VERSION.equals(version); - + return out; } + public static void manualCheck(TextChannel channel) { - public static void getUpdate(List<Guild> guilds) { + try { - if (checkIfUpdate() && STATICS.autoUpdate) { + if (!getVersionInfo().get("pre").getKey().equals(STATICS.VERSION)) { - File f = new File("update.py"); - if (!f.exists() || f.isDirectory()) { - System.out.println(coreCommands.getCurrentSystemTime() + " [INFO] File 'update.py' does not exist! Please download it from 'github.zekro.de/DiscordBot'!"); - return; - } + if (!STATICS.BOT_OWNER_ID.isEmpty()) { - try { + channel.sendMessage( + new EmbedBuilder() + .setColor(new Color(0x7EFF00)) + .setDescription( + "**New bot update is available!**\n" + + "Download the latest version and install it manually on your vServer.\n\n" + + "You are currently running on version: **" + STATICS.VERSION + "**\n\n") + .addField("Latest Prerelease Build", "Version: " + getVersionInfo().get("pre").getKey() + "\nDownload: " + getVersionInfo().get("pre").getValue(), false) + .addField("Latest Stable Build", "Version: " + getVersionInfo().get("stable").getKey() + "\nDownload: " + getVersionInfo().get("stable").getValue(), false) + .setFooter("Enter '-disable' to disable this message on new updates.", null) + .build() + ).queue(); - for ( Guild g : guilds ) { - try { - g.getTextChannelsByName("general", true).get(0).sendMessage(":warning: The bot will be shut down for a short while for updating! C U later :kissing_heart:").queue(); - } catch (Exception e) {} } + } else { + + channel.sendMessage(new EmbedBuilder().setColor(Color.green) + .setDescription("The bot is currently up to date!") + .build() + ).queue(); + + } - if (System.getProperty("os.name").toLowerCase().contains("linux")) - Runtime.getRuntime().exec("sudo screen sudo python update.py"); - else - Runtime.getRuntime().exec("wincmd.exe -update"); + } catch (IOException e) { + e.printStackTrace(); + } - System.exit(0); + } + public static boolean checkIfUpdate(JDA jda) { - } catch (IOException e) { - e.printStackTrace(); - } + if (new File("SERVER_SETTINGS/no_update_info").exists()) + return false; - } + try { + + if (!getVersionInfo().get("pre").getKey().equals(STATICS.VERSION) && !lastUpdate.equals(getVersionInfo().get("pre").getKey())) { + lastUpdate = getVersionInfo().get("pre").getKey(); + if (!STATICS.BOT_OWNER_ID.isEmpty()) { + jda.getUserById(STATICS.BOT_OWNER_ID).openPrivateChannel().complete().sendMessage( + new EmbedBuilder() + .setColor(new Color(0x7EFF00)) + .setDescription( + "**New bot update is available!**\n" + + "Download the latest version and install it manually on your vServer.\n\n" + + "You are currently running on version: **" + STATICS.VERSION + "**\n\n") + .addField("Latest Prerelease Build", "Version: " + getVersionInfo().get("pre").getKey() + "\nDownload: " + getVersionInfo().get("pre").getValue(), false) + .addField("Latest Stable Build", "Version: " + getVersionInfo().get("stable").getKey() + "\nDownload: " + getVersionInfo().get("stable").getValue(), false) + .setFooter("Enter '-disable' to disable this message on new updates.", null) + .build() + ).queue(); + + } + + return true; + } + + } catch (IOException e) { + e.printStackTrace(); + + } + return false; } } diff --git a/src/main/java/listeners/botJoinListener.java b/src/main/java/listeners/botJoinListener.java new file mode 100644 index 0000000..8f57f74 --- /dev/null +++ b/src/main/java/listeners/botJoinListener.java @@ -0,0 +1,35 @@ +package listeners; + +import net.dv8tion.jda.core.EmbedBuilder; +import net.dv8tion.jda.core.events.guild.GuildJoinEvent; +import net.dv8tion.jda.core.hooks.ListenerAdapter; + +import java.awt.*; + +/** + * Created by zekro on 04.07.2017 / 15:39 + * DiscordBot.listeners + * dev.zekro.de - github.zekro.de + * © zekro 2017 + */ + +public class botJoinListener extends ListenerAdapter { + + @Override + public void onGuildJoin(GuildJoinEvent event) { + + if (event.getJDA().getGuilds().size() >= 25) { + event.getGuild().getOwner().getUser().openPrivateChannel().queue(chan -> chan.sendMessage( + new EmbedBuilder().setColor(Color.red) + .setDescription( + "Sorry, but the maximum server capacity of this public bot is currently set to 25 servers, because of low server performance of the private host the bot is currently hosted on!\n\n" + + "If you want to make it possible to extend the server capacity by hosting the bot on a rented vServer, you can donate to my creator (`zekro#9131`) on his **[patreon](https://www.patreon.com/zekro)** page.\n\n" + + "*The bot was removed automatically from your server by self-kicking.*") + .build() + ).queue()); + + event.getGuild().leave().queue(); + } + } + +} diff --git a/src/main/java/listeners/botListener.java b/src/main/java/listeners/botListener.java index e89b160..a46ac2f 100644 --- a/src/main/java/listeners/botListener.java +++ b/src/main/java/listeners/botListener.java @@ -1,5 +1,6 @@ package listeners; +import commands.etc.BotStats; import commands.etc.CmdLog; import core.Main; import core.SSSS; @@ -25,6 +26,8 @@ public class botListener extends ListenerAdapter{ @Override public void onMessageReceived(MessageReceivedEvent e) { + BotStats.messagesProcessed++; + if (e.getChannelType().equals(ChannelType.PRIVATE)) return; if (e.getMessage().getContent().startsWith(SSSS.getPREFIX(e.getGuild())) && e.getMessage().getAuthor().getId() != e.getJDA().getSelfUser().getId()) { diff --git a/src/main/java/listeners/privateMessageListener.java b/src/main/java/listeners/privateMessageListener.java index 760637d..c28ea4b 100644 --- a/src/main/java/listeners/privateMessageListener.java +++ b/src/main/java/listeners/privateMessageListener.java @@ -1,9 +1,13 @@ package listeners; +import net.dv8tion.jda.core.EmbedBuilder; import net.dv8tion.jda.core.entities.PrivateChannel; import net.dv8tion.jda.core.events.message.priv.PrivateMessageReceivedEvent; import net.dv8tion.jda.core.hooks.ListenerAdapter; +import java.awt.*; +import java.io.File; +import java.io.IOException; import java.util.Random; import java.util.Timer; import java.util.TimerTask; @@ -18,6 +22,39 @@ public class privateMessageListener extends ListenerAdapter { public void onPrivateMessageReceived(PrivateMessageReceivedEvent event) { + if (event.getMessage().getContent().equalsIgnoreCase("-disable")) { + + try { + new File("SERVER_SETTINGS/no_update_info").createNewFile(); + event.getChannel().sendMessage(new EmbedBuilder() + .setColor(Color.red) + .setDescription("You disabled update notifications.\n" + + "Now, you wont get automatically notified if there are new versions of the bot available.") + .setFooter("Re-enable this function with enetring '-enable'.", null) + .build()).queue(); + } catch (IOException e) { + e.printStackTrace(); + } + return; + } + + if (event.getMessage().getContent().equalsIgnoreCase("-enable")) { + + + File f = new File("SERVER_SETTINGS/no_update_info"); + if (f.exists()) + f.delete(); + + event.getChannel().sendMessage(new EmbedBuilder() + .setColor(Color.green) + .setDescription("You re-enabled update notification.") + .setFooter("Disable this function with enetring '-disable'.", null) + .build()).queue(); + + return; + } + + String[] answers = { "Hey, " + event.getAuthor().getName() + "! What's going on?", "That's nice!", @@ -69,17 +106,6 @@ public void run() { e.printStackTrace(); } - - - //PrivateChannel pc = null; - //try { - // pc = event.getAuthor().openPrivateChannel().complete(); - // pc.sendMessage( - // ":warning: Hey! Please don't send private messages to the bot's account! Sorry, but nobody will receive them. :crying_cat_face: " - // ).queue(); - //} catch (Exception e) {} - - } } diff --git a/src/main/java/listeners/reactionListener.java b/src/main/java/listeners/reactionListener.java index 453415e..1dcacf1 100644 --- a/src/main/java/listeners/reactionListener.java +++ b/src/main/java/listeners/reactionListener.java @@ -1,6 +1,7 @@ package listeners; import commands.chat.Vote2; +import commands.etc.Bug; import net.dv8tion.jda.core.hooks.ListenerAdapter; import utils.MSGS; @@ -17,7 +18,18 @@ public class reactionListener extends ListenerAdapter { @Override public void onMessageReactionAdd(net.dv8tion.jda.core.events.message.react.MessageReactionAddEvent event) { - + System.out.println(event.getMessageId().equals(Bug.MESSAGE.getId()) + " - " + event.getUser().equals(Bug.AUTHOR)); + if (event.getMessageId().equals(Bug.MESSAGE.getId()) && event.getUser().equals(Bug.AUTHOR)) { + System.out.println("TEST"); + Bug.CHANNEL.sendMessage(Bug.FINAL_MESSAGE.build()).queue(); + Bug.sendConfMessage(); + + Bug.AUTHOR = null; + Bug.MESSAGE = null; + Bug.FINAL_MESSAGE = null; + Bug.CHANNEL = null; + Bug.TIMER = null; + } } diff --git a/src/main/java/listeners/readyListener.java b/src/main/java/listeners/readyListener.java index b5ae5d6..6c24ff5 100644 --- a/src/main/java/listeners/readyListener.java +++ b/src/main/java/listeners/readyListener.java @@ -25,7 +25,6 @@ public static void restartWarframeAlertsCore() { @Override public void run() { - update.getUpdate(readyEvent.getJDA().getGuilds()); if (!STATICS.TTT_SERVER_IP.equals("")) testOnlineState(readyEvent.getJDA().getGuilds()); @@ -81,6 +80,16 @@ public void onReady(ReadyEvent event) { "#--------------------------------------------------------------------------------- - - - -\n\n" ); + if (STATICS.BOT_OWNER_ID.isEmpty()) { + System.out.println( + "#######################################################\n" + + "# PLEASE INSERT YOUR DISCORD USER ID IN SETTINGS.TXT #\n" + + "# AS ENTRY 'BOT_OWNER_ID' TO SPECIFY THAT YOU ARE THE #\n" + + "# BOTS OWNER! #\n" + + "#######################################################" + ); + } + commands.settings.Botmessage.setSupplyingMessage(event.getJDA()); WarframeAlerts.startTimer(event.getJDA()); @@ -96,13 +105,19 @@ public void onReady(ReadyEvent event) { STATICS.enableWarframeAlerts = true; } - timerOnReady = new Timer(); + if (STATICS.autoUpdate) + new Timer().schedule(new TimerTask() { + @Override + public void run() { + update.checkIfUpdate(event.getJDA()); + } + }, 0, 60000); + timerOnReady = new Timer(); timerAction = new TimerTask() { @Override public void run() { - update.getUpdate(readyEvent.getJDA().getGuilds()); if (!STATICS.TTT_SERVER_IP.equals("")) testOnlineState(readyEvent.getJDA().getGuilds()); diff --git a/src/main/java/listeners/voiceChannelListener.java b/src/main/java/listeners/voiceChannelListener.java index e29a503..b2f29de 100644 --- a/src/main/java/listeners/voiceChannelListener.java +++ b/src/main/java/listeners/voiceChannelListener.java @@ -1,5 +1,6 @@ package listeners; +import net.dv8tion.jda.core.events.channel.voice.update.VoiceChannelUpdatePositionEvent; import net.dv8tion.jda.core.events.guild.voice.*; import net.dv8tion.jda.core.hooks.ListenerAdapter; import utils.STATICS; @@ -9,6 +10,8 @@ public class voiceChannelListener extends ListenerAdapter { + private int posold; + public String logChannel = STATICS.voiceLogChannel; public String getTime() { Date date = new Date(); @@ -19,6 +22,9 @@ public String getTime() { @Override public void onGuildVoiceJoin(GuildVoiceJoinEvent event) { + if (event.getChannelJoined().getName().equals("-------------------------")) { + event.getGuild().getController().moveVoiceMember(event.getMember(), event.getGuild().getVoiceChannels().get(event.getChannelJoined().getPosition() - 1)).queue(); + } if (event.getGuild().getTextChannelsByName(logChannel, false).isEmpty()) return; @@ -32,6 +38,10 @@ public void onGuildVoiceJoin(GuildVoiceJoinEvent event) { @Override public void onGuildVoiceMove(GuildVoiceMoveEvent event) { + if (event.getChannelJoined().getName().equals("-------------------------")) { + event.getGuild().getController().moveVoiceMember(event.getMember(), event.getChannelLeft()).queue(); + } + if (event.getGuild().getTextChannelsByName(logChannel, false).isEmpty()) return; diff --git a/src/main/java/utils/STATICS.java b/src/main/java/utils/STATICS.java index 5870625..0e708ed 100644 --- a/src/main/java/utils/STATICS.java +++ b/src/main/java/utils/STATICS.java @@ -17,7 +17,7 @@ public class STATICS { //######### GENERAL BOT SETTINGS #########// - public static String VERSION = "1.29.4.0"; + public static String VERSION = "1.32.0.0"; public static String THISBUILD = BUILDTYPE.STABLE; public static class BUILDTYPE { diff --git a/startfile.sh b/startfile.sh deleted file mode 100644 index ba468c7..0000000 --- a/startfile.sh +++ /dev/null @@ -1,2 +0,0 @@ -cd Programs/zekroBot -screen -L -S zekroBot java -jar DiscordBot.jar \ No newline at end of file diff --git a/winInstaller.exe b/winInstaller.exe deleted file mode 100644 index 04945f0..0000000 Binary files a/winInstaller.exe and /dev/null differ diff --git a/wincmd.exe b/wincmd.exe deleted file mode 100644 index dd390e1..0000000 Binary files a/wincmd.exe and /dev/null differ