Merge pull request #386 from BigBotNetwork/greg-dev

v1.1.1
This commit is contained in:
Skidder 2020-03-04 13:26:31 +01:00 committed by GitHub
commit f721b21ddb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 19 deletions

20
pom.xml
View file

@ -5,9 +5,19 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Hadder</groupId>
<artifactId>Hadder</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
<name>Hadder</name>
<inceptionYear>2019</inceptionYear>
<description>Hadder is a multi-purpose Discord bot.</description>
<url>https://github.com/BigBotNetwork/Hadder</url>
<licenses>
<license>
<name>GNU Affero General Public License v3.0</name>
<url>https://www.gnu.org/licenses/agpl-3.0.en.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -56,7 +66,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.1_108</version>
<version>4.1.1_110</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
@ -81,7 +91,7 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.106</version>
<version>1.107</version>
</dependency>
<dependency>
<groupId>com.sedmelluq</groupId>
@ -91,7 +101,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.10.2</version>
<version>2.10.3</version>
</dependency>
</dependencies>

View file

@ -16,7 +16,6 @@
package com.bbn.hadder.commands.general;
import com.bbn.hadder.Hadder;
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
@ -32,8 +31,8 @@ public class InviteCommand implements Command {
"",
"commands.general.invite.success.description",
"(https://discordapp.com/oauth2/authorize?client_id="
+ Hadder.shardManager.getGuilds().get(0).getSelfMember().getId()
+ "&scope=bot&permissions=470133879)")
+ e.getJDA().getSelfUser().getId()
+ "&scope=bot&permissions=1043852663)")
.build()).queue();
}

View file

@ -56,7 +56,7 @@ public class RulesCommand implements Command {
try {
TextChannel channel = e1.getGuild().getTextChannelsByName(e1.getMessage().getContentRaw(), true).get(0);
createRules(e, e1, channel);
} catch (NullPointerException ex) {
} catch (NullPointerException | IndexOutOfBoundsException ex) {
e.getTextChannel().sendMessage(
e.getMessageEditor().getMessage(
MessageEditor.MessageType.ERROR,

View file

@ -70,17 +70,22 @@ public class Config {
.key("Tokens").object()
.key("BotToken").value(null)
.key("Giphy").value(null)
.key("GitHub").value(null)
.key("MythicalBotList").value(null)
.key("BotsForDiscord").value(null)
.key("DiscordBotList").value(null)
.key("DiscordBestBots").value(null)
.key("DiscordBoats").value(null)
.key("YetAnotherBotList").value(null)
.value("DiscordExtremeList").value(null)
.value("DiscordBotReviews").value(null)
.value("DiscordBots").value(null)
.value("BotListSpace").value(null)
.endObject().endObject().toString();
.key("DiscordExtremeList").value(null)
.key("DiscordBotReviews").value(null)
.key("DiscordBots").value(null)
.key("BotListSpace").value(null)
.key("DiscordBots2").value(null)
.key("CloudList").value(null)
.key("Arcane").value(null)
.endObject()
.key("Clyde").value("Clyde")
.endObject().toString();
}
public String getBotToken() {
@ -143,10 +148,6 @@ public class Config {
return config.getJSONObject("Tokens").getString("DiscordExtremeList");
}
public String getDiscordBotReviewsToken() {
return config.getJSONObject("Tokens").getString("DiscordBotReviews");
}
public String getDiscordBotsToken() {
return config.getJSONObject("Tokens").getString("DiscordBots");
}
@ -163,6 +164,10 @@ public class Config {
return config.getJSONObject("Tokens").getString("CloudList");
}
public String getArcaneToken() {
return config.getJSONObject("Tokens").getString("Arcane");
}
public String getClydeName() {
return config.getString("Clyde");
}

View file

@ -40,6 +40,7 @@ public class BotList {
private static String BotListSpace = "https://api.botlist.space/v1/bots/637002314162372639";
private static String DiscordBots2 = "https://discord.bots.gg/api/v1/bots/637002314162372639/stats";
private static String CloudList = "https://www.cloudlist.xyz/api/stats/637002314162372639";
private static String ArcaneBotCenter = "https://arcane-botcenter.xyz/api/637002314162372639/stats";
private Config config;
@ -57,6 +58,7 @@ public class BotList {
json.put("users", Hadder.shardManager.getUsers().size());
json.put("shard_count", Hadder.shardManager.getShards().size());
json.put("shardCount", Hadder.shardManager.getShards().size());
json.put("member_count", Hadder.shardManager.getUsers().size());
RequestBody body = RequestBody.create(MediaType.parse("application/json"), json.toString());
@ -209,6 +211,21 @@ public class BotList {
} catch (IOException e) {
e.printStackTrace();
}
// Arcane Bot Center
Request arcane = new Request.Builder()
.url(ArcaneBotCenter)
.post(body)
.addHeader("Authorization", config.getArcaneToken())
.build();
try {
new OkHttpClient().newCall(arcane).execute().close();
System.out.println("Successfully posted count to the Arcane Bot Center!");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}