Skip to content

Commit d4d9ebb

Browse files
Fix errors with /youtube and mute role persists
1 parent cd86d3e commit d4d9ebb

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/java/technobot/commands/utility/YouTubeCommand.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,15 @@ public void onResponse(Call call, final Response response2) throws IOException {
9494
String views = FORMATTER.format(stats.get("viewCount").getAsLong());
9595
String subs = FORMATTER.format(stats.get("subscriberCount").getAsLong());
9696
String videos = FORMATTER.format(stats.get("videoCount").getAsLong());
97-
String link = "https://www.youtube.com/"+channel.toLowerCase();
97+
String link = "https://www.youtube.com/channel/"+channelID;
9898

9999
// Build nice embed displaying all info
100100
EmbedBuilder embed = new EmbedBuilder()
101101
.setColor(EmbedColor.DEFAULT.color)
102102
.setAuthor(title + " | YouTube Channel", link, avatar)
103103
.setThumbnail(avatar)
104104
.setDescription(desc)
105-
.addField("Statistics", "**Subscribers:** "+subs+"\n**Views:** "+views+"\n**Videos:** "+videos, false)
106-
.setFooter(link);
105+
.addField("Statistics", "**Subscribers:** "+subs+"\n**Views:** "+views+"\n**Videos:** "+videos, false);
107106
event.getHook().sendMessageEmbeds(embed.build()).queue();
108107
}
109108
});

src/main/java/technobot/handlers/ModerationHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import kotlin.Pair;
77
import net.dv8tion.jda.api.EmbedBuilder;
88
import net.dv8tion.jda.api.entities.*;
9+
import net.dv8tion.jda.api.exceptions.HierarchyException;
910
import org.bson.conversions.Bson;
1011
import technobot.TechnoBot;
1112
import technobot.data.cache.moderation.Ban;
@@ -299,7 +300,9 @@ public void persistMuteRole(Member member) {
299300
if (moderation.getMutes().contains(member.getIdLong())) {
300301
Role muteRole = guild.getRoleById(moderation.getMuteRole());
301302
if (muteRole != null) {
302-
guild.addRoleToMember(member, muteRole).queue();
303+
try {
304+
guild.addRoleToMember(member, muteRole).queue();
305+
} catch (HierarchyException ignored) { }
303306
}
304307
}
305308
}

0 commit comments

Comments
 (0)