Skip to content

Commit

Permalink
Update log event names
Browse files Browse the repository at this point in the history
  • Loading branch information
CominAtYou committed Apr 20, 2024
1 parent a5fd3a8 commit 572345e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.cominatyou</groupId>
<artifactId>hildabot</artifactId>
<version>2.5.0</version>
<version>2.5.1</version>

<name>hildabot</name>
<url>http://www.example.com</url>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cominatyou/commands/LevelCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void execute(MessageCreateEvent message, List<String> args) { // Essentia

if (restoredRoles > 0) {
MessageUtil.sendTextReply(message.getMessage(), "You're all set. The roles you were missing have been added to you.");
Log.eventf("LEVELCHECK", "Restored %d %s for %s (%d)", restoredRoles, English.plural("role", restoredRoles), message.getMessageAuthor().getName(), message.getMessageAuthor().getId());
Log.eventf("LevelCheck", "Restored %d %s for %s (%d)", restoredRoles, English.plural("role", restoredRoles), message.getMessageAuthor().getName(), message.getMessageAuthor().getId());
}
else {
MessageUtil.sendTextReply(message.getMessage(), "You don't seem to be missing any roles, so you're all set!");
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/cominatyou/routinetasks/CheckForBirthdays.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class CheckForBirthdays implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
final DiscordApi client = App.getClient();

Log.event("BIRTHDAYS", "Starting birthdays task.");
Log.event("Birthdays", "Starting birthdays task.");

final Optional<Role> birthdayRole = client.getServerById(Values.BASE_GUILD_ID).get().getRoleById(609258045759029250L);
birthdayRole.ifPresent(role -> {
final Collection<User> birthdayRoleUsers = role.getUsers();
if (birthdayRoleUsers.size() != 0) Log.eventf("BIRTHDAYS", "Removing birthday role from %d %s\n", birthdayRoleUsers.size(), English.plural("user", birthdayRoleUsers.size()));
if (birthdayRoleUsers.size() != 0) Log.eventf("Birthdays", "Removing birthday role from %d %s\n", birthdayRoleUsers.size(), English.plural("user", birthdayRoleUsers.size()));
birthdayRoleUsers.forEach(user -> {
user.removeRole(role, "Their birthday has passed.");
});
Expand All @@ -50,7 +50,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException {
}

final int birthdayCountBeforeFilter = birthdays.size();
Log.eventf("BIRTHDAYS", "Got %d %s from DB for %d-%s", birthdayCountBeforeFilter, English.plural("birthday", birthdayCountBeforeFilter), month, dayString);
Log.eventf("Birthdays", "Got %d %s from DB for %d-%s", birthdayCountBeforeFilter, English.plural("birthday", birthdayCountBeforeFilter), month, dayString);

final TextChannel birthdayChannel = client.getServerById(Values.BASE_GUILD_ID).get().getTextChannelById(609253148564914187L).get();

Expand All @@ -62,7 +62,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException {
}

final int birthdayCount = birthdays.size();
Log.eventf("BIRTHDAYS", "Got %d %s after filtering for %d-%s", birthdayCount, English.plural("birthday", birthdayCount), month, dayString);
Log.eventf("Birthdays", "Got %d %s after filtering for %d-%s", birthdayCount, English.plural("birthday", birthdayCount), month, dayString);

if (birthdays.isEmpty()) {
return;
Expand All @@ -87,11 +87,11 @@ else if (birthdays.size() == 2) {
client.getServerById(Values.BASE_GUILD_ID).get().getMemberById(id).ifPresent(user -> {
birthdayRole.ifPresent(role -> {
role.addUser(user, "Their birthday is today!");
Log.eventf("BIRTHDAYS", "Gave birthday role to %s (%d)", user.getName(), user.getId());
Log.eventf("Birthdays", "Gave birthday role to %s (%d)", user.getName(), user.getId());
});
});
});

Log.event("BIRTHDAYS", "Completed birthdays task.");
Log.event("Birthdays", "Completed birthdays task.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SendStreakWarning implements Job {

@Override
public void execute(JobExecutionContext arg0) throws JobExecutionException {
Log.event("STREAKWARN", "Starting streak warnings task.");
Log.event("StreakWarn", "Starting streak warnings task.");

final ZonedDateTime now = ZonedDateTime.now(Values.TIMEZONE_AMERICA_CHICAGO);
final ZonedDateTime midnight = now.toLocalDate().atStartOfDay(now.getZone());
Expand Down Expand Up @@ -51,7 +51,7 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException {
});
}

Log.eventf("STREAKWARN", "Sent three-day streak expiry warning to %d %s.", expireInThreeDays.size(), English.plural("user", expireInThreeDays.size()));
Log.eventf("StreakWarn", "Sent three-day streak expiry warning to %d %s.", expireInThreeDays.size(), English.plural("user", expireInThreeDays.size()));

embed.setTitle("Your streak expires in 1 day!");

Expand All @@ -64,8 +64,8 @@ public void execute(JobExecutionContext arg0) throws JobExecutionException {
});
}

Log.eventf("STREAKWARN", "Sent next-day streak expiry warning to %d %s.", expireTomorrow.size(), English.plural("user", expireTomorrow.size()));
Log.event("STREAKWARN", "Finished streak warnings task.");
Log.eventf("StreakWarn", "Sent next-day streak expiry warning to %d %s.", expireTomorrow.size(), English.plural("user", expireTomorrow.size()));
Log.event("StreakWarn", "Finished streak warnings task.");

}
}
4 changes: 2 additions & 2 deletions src/main/java/com/cominatyou/util/versioning/Version.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.cominatyou.util.versioning;

public class Version {
public static final String VERSION = "2.5.0";
public static final String BUILD_NUMBER = "11F041";
public static final String VERSION = "2.5.1";
public static final String BUILD_NUMBER = "11F042";
public static final String VERSION_STRING = String.format("%s (%s)", VERSION, BUILD_NUMBER);
}
2 changes: 1 addition & 1 deletion src/main/java/com/cominatyou/xp/RestoreRoles.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public static void restore(UserChangePendingEvent event) {
role.addUser(event.getUser());
}

Log.eventf("RESTORE", "Restored roles for %s (%d), starting from level %d\n", event.getUser().getName(), event.getUser().getId(), rankLevel);
Log.eventf("Restore", "Restored roles for %s (%d), starting from level %d\n", event.getUser().getName(), event.getUser().getId(), rankLevel);
}
}
6 changes: 3 additions & 3 deletions src/main/java/com/cominatyou/xp/XPSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static void checkForLevelUp(int beforeActionLevel, User user, Server serv
final String levelUpMessage = String.format("Congrats on leveling up! You are now level **%d**! :tada:", currentLevel);
final String embedTitle = RankUtil.isLevelRankLevel(currentLevel) ? rankUpMessage : levelUpMessage;

Log.eventf("LEVELUP", "%s (%d) leveled up to %d: %s XP", user.getName(), user.getId(), currentLevel, ThousandsFormat.format(currentXP));
Log.eventf("LevelUp", "%s (%d) leveled up to %d: %s XP", user.getName(), user.getId(), currentLevel, ThousandsFormat.format(currentXP));

if (!userEntry.getBoolean("levelalertsdisabled")) {
final EmbedBuilder embed = new EmbedBuilder()
Expand Down Expand Up @@ -97,7 +97,7 @@ public static void checkForLevelUp(int beforeActionLevel, User user, Server serv

try {
role.addUser(user).get();
Log.eventf("LEVELUP", "Assigned role %s to %s (%d)", role.getName(), user.getName(), user.getId());
Log.eventf("LevelUp", "Assigned role %s to %s (%d)", role.getName(), user.getName(), user.getId());
}
catch (Exception e) {
final EmbedBuilder errorEmbed = new EmbedBuilder()
Expand All @@ -107,7 +107,7 @@ public static void checkForLevelUp(int beforeActionLevel, User user, Server serv
.addInlineField("Role", String.format("%s (%d)", role.getName(), currentLevel))
.setColor(Values.ERROR_RED);

Log.errorf("LEVELUP", "Failed to assign %s to %s (%d)!", role.getName(), user.getName(), user.getId());
Log.errorf("LevelUp", "Failed to assign %s to %s (%d)!", role.getName(), user.getName(), user.getId());
user.getApi().getOwner().get().join().openPrivateChannel().join().sendMessage(errorEmbed);

if (e.getCause() == null) e.printStackTrace();
Expand Down

0 comments on commit 572345e

Please sign in to comment.