Merge pull request #436 from BigBotNetwork/greg-dev

v1.3.5
This commit is contained in:
Skidder 2020-04-06 22:51:08 +02:00 committed by GitHub
commit 55d6d0af07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 13 deletions

View file

@ -66,7 +66,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.1_127</version>
<version>4.1.1_131</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
@ -91,12 +91,12 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.108</version>
<version>1.109</version>
</dependency>
<dependency>
<groupId>com.sedmelluq</groupId>
<artifactId>lavaplayer</artifactId>
<version>1.3.40</version>
<version>1.3.44</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>

View file

@ -22,6 +22,7 @@ import com.rethinkdb.gen.exc.ReqlNonExistenceError;
import com.rethinkdb.gen.exc.ReqlOpFailedError;
import com.rethinkdb.net.Connection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Field;
@ -78,7 +79,12 @@ public class Rethink {
public JSONObject getObjectByID(String table, String id) {
String response = r.table(table).get(id).toJson().run(conn);
try {
return new JSONObject(response);
} catch (JSONException e) {
System.out.println(response);
return null;
}
}
public void insert(String table, Object object) {

View file

@ -31,7 +31,7 @@ public class CodeCommand implements Command {
public void executed(String[] args, CommandEvent e) {
if (args.length > 0) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invite/" + args[0]).addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build();
Request request = new Request.Builder().url("https://canary.discordapp.com/api/v6/invite/" + args[0] + "?with_counts=true").addHeader("Authorization", "Bot " + e.getConfig().getBotToken()).build();
try {
Response response = client.newCall(request).execute();
@ -45,6 +45,9 @@ public class CodeCommand implements Command {
.addField("Verification Level", String.valueOf(json.getJSONObject("guild").getInt("verification_level")), true)
.addField("Guild ID", json.getJSONObject("guild").getString("id"), true)
.addBlankField(true)
.addField("Members", String.valueOf(json.get("approximate_member_count")), true)
.addBlankField(true)
.addBlankField(true)
.setThumbnail("https://cdn.discordapp.com/icons/" + json.getJSONObject("guild").getString("id") + "/" + json.getJSONObject("guild").getString("icon") + ".png")
.build()).queue();
} catch (JSONException ex) {

View file

@ -30,6 +30,7 @@ public class MoveAllCommand implements Command {
if (args.length == 2) {
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
if (StringUtils.isNumeric(args[1]) && args[1].length() == 18) {
if (!args[0].equals(args[1])) {
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()
@ -38,6 +39,12 @@ public class MoveAllCommand implements Command {
"commands.misc.moveall.success.title", "",
"commands.misc.moveall.success.description", String.valueOf(count))
.build()).queue();
} else {
e.getChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.misc.moveall.error.equals.title",
"commands.misc.moveall.error.equals.description")
.build()).queue();
}
} else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
"commands.misc.moveall.error.target.int.title",

View file

@ -100,6 +100,8 @@ 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.equals.title = Not twice
commands.misc.moveall.error.equals.description = The first voice channel equals the second. You have to specify two different voice channels.
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