Skip to content

Commit 445e5af

Browse files
committed
fixed bugs
1 parent 68c2724 commit 445e5af

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/main/java/com/jagrosh/vortex/Vortex.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,10 @@ public void leavePointlessGuilds()
287287
return false;
288288
if(Constants.OWNER_ID.equals(g.getOwnerId()))
289289
return false;
290-
int botcount = (int)g.getMemberCache().stream().filter(m -> m.getUser().isBot()).count();
291-
if(g.getMemberCache().size()-botcount<15 || (botcount>20 && ((double)botcount/g.getMemberCache().size())>0.5))
290+
int botcount = (int) g.getMemberCache().stream().filter(m -> m.getUser().isBot()).count();
291+
int totalcount = (int) g.getMemberCache().size();
292+
int humancount = totalcount - botcount;
293+
if(humancount < 30 || botcount > humancount)
292294
{
293295
if(database.settings.hasSettings(g))
294296
return false;

src/main/java/com/jagrosh/vortex/commands/tools/ExportCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ protected void execute(CommandEvent event)
5858
.put("tempmutes", db.tempmutes.getAllMutesJson(g))
5959
.put("tempbans", db.tempbans.getAllBansJson(g))
6060
.put("inviteWhitelist", db.inviteWhitelist.getWhitelistJson(g))
61-
.put("filters", db.filters.getFiltersJson(g));
61+
.put("filters", db.filters.getFiltersJson(g))
62+
.put("premium", db.premium.getPremiumInfoJson(g));
6263
event.getChannel().sendFile(obj.toString(1).getBytes(), "vortex_data_" + g.getId() + ".json").queue();
6364
}
6465
}

src/main/java/com/jagrosh/vortex/database/managers/InviteWhitelistManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public JSONArray getWhitelistJson(Guild guild)
137137
{
138138
List<Long> list = readWhitelist(guild);
139139
JSONArray arr = new JSONArray();
140-
list.forEach(id -> list.add(id));
140+
list.forEach(id -> arr.put(id));
141141
return arr;
142142
}
143143

src/main/java/com/jagrosh/vortex/database/managers/PremiumManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.LinkedList;
3131
import java.util.List;
3232
import net.dv8tion.jda.core.entities.Guild;
33+
import org.json.JSONObject;
3334

3435
/**
3536
*
@@ -72,6 +73,14 @@ public PremiumInfo getPremiumInfo(Guild guild)
7273
});
7374
}
7475

76+
public JSONObject getPremiumInfoJson(Guild guild)
77+
{
78+
PremiumInfo info = getPremiumInfo(guild);
79+
return new JSONObject()
80+
.put("level", info.level.name())
81+
.put("until", info.until == null ? 0 : info.until.getEpochSecond());
82+
}
83+
7584
public void addPremiumForever(Guild guild, Level level)
7685
{
7786
readWrite(selectAll(GUILD_ID.is(guild.getIdLong())), rs ->

0 commit comments

Comments
 (0)