v1.3.1 #411

Merged
greg6775 merged 14 commits from greg-dev into master 2020-03-22 00:38:40 +01:00
5 changed files with 31 additions and 15 deletions

View file

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Hadder</groupId>
<artifactId>Hadder</artifactId>
<version>1.1.3</version>
<version>1.3.1</version>
<name>Hadder</name>
<inceptionYear>2019</inceptionYear>
<description>Hadder is a multi-purpose Discord bot.</description>
@ -66,7 +66,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.1_113</version>
<version>4.1.1_122</version>
</dependency>
<dependency>
<groupId>org.json</groupId>

View file

@ -51,15 +51,14 @@ public class Hadder {
Rethink rethink = new Rethink(config);
rethink.connect();
DefaultShardManagerBuilder builder = new DefaultShardManagerBuilder();
DefaultShardManagerBuilder builder = DefaultShardManagerBuilder.createDefault(config.getBotToken());
builder.setAutoReconnect(true);
builder.setShardsTotal(1);
builder.setChunkingFilter(ChunkingFilter.ALL);
builder.setChunkingFilter(ChunkingFilter.NONE);
builder.setBulkDeleteSplittingEnabled(true);
builder.setActivity(Activity.listening("to h.help"));
builder.setStatus(OnlineStatus.DO_NOT_DISTURB);
builder.setToken(config.getBotToken());
HelpCommand helpCommand = new HelpCommand();
AudioManager audioManager = new AudioManager();

View file

@ -72,8 +72,8 @@ public class Rethink {
else return null;
}
public Object getByID(String table, String wherevalue, String column) {
return r.table(table).get(wherevalue).getField(column).run(conn);
public Object getByID(String table, String where, String column) {
return r.table(table).get(where).getField(column).run(conn);
}
public JSONObject getObjectByID(String table, String id) {

View file

@ -20,6 +20,7 @@ import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.core.Perm;
import com.bbn.hadder.core.Perms;
import com.bbn.hadder.utils.MessageEditor;
import org.apache.commons.lang3.StringUtils;
@Perms(Perm.VOICE_MOVE_OTHERS)
public class MoveAllCommand implements Command {
@ -27,6 +28,8 @@ public class MoveAllCommand implements Command {
@Override
public void executed(String[] args, CommandEvent e) {
if (args.length == 2) {
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
if (StringUtils.isNumeric(args[1]) && args[1].length() == 18) {
int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size();
e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach(
member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue()
@ -35,6 +38,16 @@ public class MoveAllCommand implements Command {
"commands.misc.moveall.success.title", "",
"commands.misc.moveall.success.description", String.valueOf(count))
.build()).queue();
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.misc.moveall.error.target.int.title",
"commands.misc.moveall.error.target.int.description").build()).queue();
}
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.misc.moveall.error.source.int.title",
"commands.misc.moveall.error.source.int.description").build()).queue();
}
} else e.getHelpCommand().sendHelp(this, e);
}

View file

@ -100,6 +100,10 @@ commands.misc.code.error.description = I can't find the specified invite code.
commands.misc.code.help.description = Shows information about a invite code.
commands.misc.moveall.success.title = Successfully moved
commands.misc.moveall.success.description = I successfully moved %extra% members. Have fun\!
commands.misc.moveall.error.source.int.title = Invalid ID
commands.misc.moveall.error.source.int.description = You didn't specified a ID as the source channel.
commands.misc.moveall.error.target.int.title = Invalid ID
commands.misc.moveall.error.target.int.description = You didn't specified a ID as the target channel.
commands.misc.moveall.help.description = Moves all users in the source channel to the target channel.
commands.misc.corona.help.description = Show the newest stats about COVID-19