Skip to content

Commit

Permalink
Correct caps
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Aug 24, 2024
1 parent 83e5d9b commit e908ddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.jagrosh.jdautilities.command.SlashCommand;
import com.jagrosh.jdautilities.command.SlashCommandEvent;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.UserSnowflake;
import net.dv8tion.jda.api.interactions.InteractionHook;
import net.dv8tion.jda.api.utils.TimeFormat;
import org.rtm516.discordbot.util.BotColors;
Expand All @@ -40,7 +39,7 @@
public class CheckDonateCommand extends SlashCommand {
public CheckDonateCommand() {
this.name = "checkdonate";
this.help = "Checks if your linked github account has an active sponsorship";
this.help = "Checks if your linked GitHub account has an active sponsorship";
this.guildOnly = true;
}

Expand All @@ -52,8 +51,8 @@ protected void execute(SlashCommandEvent event) {
String ghUsername = SponsorUtil.getGithub(event.getUser());
if (ghUsername == null) {
interactionHook.editOriginalEmbeds(new EmbedBuilder()
.setTitle("No linked github account found")
.setDescription("Please link your github account on " + SponsorUtil.getGithubLink(event.getUser()))
.setTitle("No linked GitHub account found")
.setDescription("Please link your GitHub account on " + SponsorUtil.getGithubLink(event.getUser()))
.setColor(BotColors.FAILURE.getColor())
.build()).queue();
return;
Expand All @@ -66,7 +65,7 @@ protected void execute(SlashCommandEvent event) {
if (foundSponsor.isPresent() && foundSponsor.get().active()) {
interactionHook.editOriginalEmbeds(new EmbedBuilder()
.setTitle("Active Sponsorship Found!")
.addField("Github Username", foundSponsor.get().username(), true)
.addField("GitHub Username", foundSponsor.get().username(), true)
.addField("Amount", "$" + String.format("%.02f", foundSponsor.get().amount()) + (foundSponsor.get().amount() == 0 ? " (still processing, try again shortly)" : ""), true)
.addField("Re-occuring", String.valueOf(!foundSponsor.get().oneTime()), true)
.addField("Started", TimeFormat.DATE_TIME_SHORT.format(foundSponsor.get().started()), true)
Expand All @@ -78,7 +77,7 @@ protected void execute(SlashCommandEvent event) {
} else {
interactionHook.editOriginalEmbeds(new EmbedBuilder()
.setTitle("No active sponsorship found")
.addField("Github Username", ghUsername, true)
.addField("GitHub Username", ghUsername, true)
.setColor(BotColors.FAILURE.getColor())
.build()).queue();
}
Expand Down
38 changes: 0 additions & 38 deletions src/main/java/org/rtm516/discordbot/util/BotHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,44 +334,6 @@ public static String trim(String input, int length) {
return input.substring(0, length - 3) + "...";
}

/**
* Get a Github repository
*
* @param repository Input string to get repository
* @return Repository A repository if one was found, or null otherwise.
*/
public static GHRepository getRepo(String repository, String owner) throws IOException {
GHRepository repo;
GHRepository defaultRepo = DiscordBot.getGithub().getRepository("GeyserMC/Geyser");

// if optional is used we get repo from optional first.
if (!owner.isEmpty()) {
try {
repo = DiscordBot.getGithub().getRepository(owner + "/" + repository);
return repo;
} catch (IOException e) {
// default to geyser repo.
return defaultRepo;
}
}

// if no owner is given search github repo's.
Matcher matcherRepo = REPO_PATTERN.matcher(repository);
if (matcherRepo.find()) {
if (matcherRepo.group(2) == null) {
PagedSearchIterable<GHRepository> results = DiscordBot.getGithub().searchRepositories().q(matcherRepo.group(3)).list();
repo = results.toArray()[0];
} else {
repo = DiscordBot.getGithub().getRepository(matcherRepo.group(2) + matcherRepo.group(3));
}
} else {
// default to Geyser repo.
repo = defaultRepo;
}

return repo;
}

/**
* Check if a moderator can target a member
* Also covered the bots permissions
Expand Down

0 comments on commit e908ddc

Please sign in to comment.