Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
implementation("net.dv8tion:JDA:4.3.0_305") {
implementation("net.dv8tion:JDA:4.4.0_350") {
exclude(module = "opus-java")
}

Expand Down
11 changes: 5 additions & 6 deletions src/main/java/com/diamondfire/helpbot/bot/HelpBotInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void initialize() throws LoginException {
new FetchDataCommand(),
new InfoCommand(),
new EvalCommand(),
new GarfieldCommand(),
// new GarfieldCommand(), - Dead
new HelpCommand(),
new RestartCommand(),
new ActionDumpCommand(),
Expand All @@ -74,10 +74,10 @@ public static void initialize() throws LoginException {
new MutedCommand(),
new UnmuteCommand(),
new VerifyCommand(),
new PollCommand(),
// new PollCommand(), - Unused
new IdeaCommand(),
new StoreCommand(),
new ChannelMuteCommand(),
// new ChannelMuteCommand(), - not finished
// statsbot
new StatsCommand(),
new SupportBadCommand(),
Expand All @@ -103,7 +103,7 @@ public static void initialize() throws LoginException {
new QueueCommand(),
new WhoHelpedCommand(),
new HelpedByCommand(),
new NamesCommand(),
// new NamesCommand(), - Dead
new PlayerJoinGraphCommand(),
//new CpCommand(),
//new CpRequirementsCommand(),
Expand All @@ -121,11 +121,10 @@ public static void initialize() throws LoginException {
new ExcuseStaffCommand(),
new ExcusedStaffCommand(),
new SupportBannedPlayersCommand(),
new DiscussionMuteCommand(),
new NbsCommand(),
new DailySessionsCommand(),
new EightBallCommand(),
new OcrCommand(),
// new OcrCommand(), - Dead
new JoinsCommand(),
new TagCommand(),
new PurgeCommand()
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void run(CommandEvent event) {
textChannel.putPermissionOverride(member).deny(net.dv8tion.jda.api.Permission.MESSAGE_ADD_REACTION, net.dv8tion.jda.api.Permission.MESSAGE_WRITE).queue();
});

HelpBotInstance.getScheduler().schedule(new MuteExpireTask(user, finalDuration, false));
HelpBotInstance.getScheduler().schedule(new MuteExpireTask(user, finalDuration));
event.reply(builder);
}, (error) -> {
builder.withPreset(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,8 @@ public void run(CommandEvent event) {

} else {
Guild guild = event.getGuild();
ResultSet set = result.getResult();
boolean special = "Weekly Discussion Mute".equals(set.getString("reason"));

if (special) {
TextChannel channel = guild.getTextChannelById(DiscussionMuteCommand.DISCUSSION_CHANNEL);
channel.getPermissionOverride(member).delete().queue();

} else {
guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue();
}
guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue();

new DatabaseQuery()
.query(new BasicQuery("UPDATE owen.muted_members SET handled = true WHERE member = ?", (statement) -> statement.setLong(1, member.getIdLong())))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ protected void execute(CommandEvent event, Player player) {
warningReq = 6 - warnings;
}

if (duration != null) {
embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more active %s, you will receive a **%s** tempban!", warningReq, StringUtil.sCheck("warning", warningReq), duration), false);
}
// if (duration != null) {
// embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more active %s, you will receive a **%s** tempban!", warningReq, StringUtil.sCheck("warning", warningReq), duration), false);
// }

} else if (punishments.size() == 0) {
embed.setDescription("No punishments here, keep up the good work!");
}
if (yearlyWarnings > 10) {
embed.setColor(Color.RED);
embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more %s this year, you will receive a **45** day tempban!", 20 - yearlyWarnings, StringUtil.sCheck("warning", 20 - yearlyWarnings)), false);
}
//
// if (yearlyWarnings > 10) {
// embed.setColor(Color.RED);
// embed.addField("Tempban", String.format("\u26A0 If you receive **%s** more %s this year, you will receive a **45** day tempban!", 20 - yearlyWarnings, StringUtil.sCheck("warning", 20 - yearlyWarnings)), false);
// }

msgs.add(privateChannel.sendMessageEmbeds(embed.build()));
}
Expand All @@ -145,7 +145,7 @@ protected void execute(CommandEvent event, Player player) {
EmbedUtil.addFields(presetBuilder, punishmentStrings, "", "", true);
if (punishmentStrings.size() == 0) {
} else if (presetBuilder.isValidLength()) {
msgs.add(privateChannel.sendMessage(presetBuilder.build()));
msgs.add(privateChannel.sendMessageEmbeds(presetBuilder.build()));
} else {
try {
File sendFile = ExternalFileUtil.generateFile("history.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,10 @@ public class MuteExpireTask implements OneTimeTask {

private final long ms;
private final long member;
private final boolean discussionMute;

public MuteExpireTask(long member, Date date) {
this.ms = Duration.between(Instant.now(), date.toInstant()).toMillis();
this.member = member;
this.discussionMute = false;
}

public MuteExpireTask(long member, Date date, boolean discussionMute) {
this.ms = Duration.between(Instant.now(), date.toInstant()).toMillis();
this.member = member;
this.discussionMute = discussionMute;
}

@Override
Expand All @@ -37,16 +29,8 @@ public long getExecution() {
@Override
public void run() {
Guild guild = HelpBotInstance.getJda().getGuildById(HelpBotInstance.DF_GUILD);

if (discussionMute) {
TextChannel channel = guild.getTextChannelById(DiscussionMuteCommand.DISCUSSION_CHANNEL);
guild.retrieveMemberById(member).queue((member) -> {
channel.getPermissionOverride(member).delete().queue();
});

} else {
guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue();
}

guild.removeRoleFromMember(member, guild.getRoleById(MuteCommand.ROLE_ID)).queue();

new DatabaseQuery()
.query(new BasicQuery("UPDATE owen.muted_members SET handled = true WHERE member = ?", (statement) -> statement.setLong(1, member)))
Expand All @@ -62,9 +46,8 @@ public static void prepare() {
for (ResultSet set : result) {
Timestamp date = set.getTimestamp("muted_till");
long member = set.getLong("member");
boolean special = "Weekly Discussion Mute".equals(set.getString("reason"));

HelpBotInstance.getScheduler().schedule(new MuteExpireTask(member, date, special));

HelpBotInstance.getScheduler().schedule(new MuteExpireTask(member, date));
}
});
}
Expand Down