commit
55d6d0af07
5 changed files with 31 additions and 13 deletions
6
pom.xml
6
pom.xml
|
|
@ -66,7 +66,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>net.dv8tion</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>4.1.1_127</version>
|
<version>4.1.1_131</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
|
|
@ -91,12 +91,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.kohsuke</groupId>
|
<groupId>org.kohsuke</groupId>
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.108</version>
|
<version>1.109</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sedmelluq</groupId>
|
<groupId>com.sedmelluq</groupId>
|
||||||
<artifactId>lavaplayer</artifactId>
|
<artifactId>lavaplayer</artifactId>
|
||||||
<version>1.3.40</version>
|
<version>1.3.44</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import com.rethinkdb.gen.exc.ReqlNonExistenceError;
|
||||||
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
import com.rethinkdb.gen.exc.ReqlOpFailedError;
|
||||||
import com.rethinkdb.net.Connection;
|
import com.rethinkdb.net.Connection;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
@ -78,7 +79,12 @@ public class Rethink {
|
||||||
|
|
||||||
public JSONObject getObjectByID(String table, String id) {
|
public JSONObject getObjectByID(String table, String id) {
|
||||||
String response = r.table(table).get(id).toJson().run(conn);
|
String response = r.table(table).get(id).toJson().run(conn);
|
||||||
|
try {
|
||||||
return new JSONObject(response);
|
return new JSONObject(response);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
System.out.println(response);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert(String table, Object object) {
|
public void insert(String table, Object object) {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class CodeCommand implements Command {
|
||||||
public void executed(String[] args, CommandEvent e) {
|
public void executed(String[] args, CommandEvent e) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
OkHttpClient client = new OkHttpClient();
|
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 {
|
try {
|
||||||
Response response = client.newCall(request).execute();
|
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("Verification Level", String.valueOf(json.getJSONObject("guild").getInt("verification_level")), true)
|
||||||
.addField("Guild ID", json.getJSONObject("guild").getString("id"), true)
|
.addField("Guild ID", json.getJSONObject("guild").getString("id"), true)
|
||||||
.addBlankField(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")
|
.setThumbnail("https://cdn.discordapp.com/icons/" + json.getJSONObject("guild").getString("id") + "/" + json.getJSONObject("guild").getString("icon") + ".png")
|
||||||
.build()).queue();
|
.build()).queue();
|
||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ public class MoveAllCommand implements Command {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
|
if (StringUtils.isNumeric(args[0]) && args[0].length() == 18) {
|
||||||
if (StringUtils.isNumeric(args[1]) && args[1].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();
|
int count = e.getGuild().getVoiceChannelById(args[0]).getMembers().size();
|
||||||
e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach(
|
e.getGuild().getVoiceChannelById(args[0]).getMembers().forEach(
|
||||||
member -> e.getGuild().moveVoiceMember(member, e.getGuild().getVoiceChannelById(args[1])).queue()
|
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.title", "",
|
||||||
"commands.misc.moveall.success.description", String.valueOf(count))
|
"commands.misc.moveall.success.description", String.valueOf(count))
|
||||||
.build()).queue();
|
.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 {
|
} else {
|
||||||
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR,
|
||||||
"commands.misc.moveall.error.target.int.title",
|
"commands.misc.moveall.error.target.int.title",
|
||||||
|
|
|
||||||
|
|
@ -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.code.help.description = Shows information about a invite code.
|
||||||
commands.misc.moveall.success.title = Successfully moved
|
commands.misc.moveall.success.title = Successfully moved
|
||||||
commands.misc.moveall.success.description = I successfully moved %extra% members. Have fun\!
|
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.title = Invalid ID
|
||||||
commands.misc.moveall.error.source.int.description = You didn't specified a ID as the source channel.
|
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.title = Invalid ID
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue