Skip to content

Commit e08c149

Browse files
authored
Voice channel mention (#932)
* Voice channel mention I recently noticed voice channels can be mentioned just like text channels. A small change to the code to implement this feature. * Voice channel mention * vc.getName() changed to vc.getAsMention()
1 parent 95de05f commit e08c149

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/main/java/com/jagrosh/jmusicbot/audio/AudioHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public Message getNowPlaying(JDA jda)
202202
Guild guild = guild(jda);
203203
AudioTrack track = audioPlayer.getPlayingTrack();
204204
MessageBuilder mb = new MessageBuilder();
205-
mb.append(FormatUtil.filter(manager.getBot().getConfig().getSuccess()+" **Now Playing in "+guild.getSelfMember().getVoiceState().getChannel().getName()+"...**"));
205+
mb.append(FormatUtil.filter(manager.getBot().getConfig().getSuccess()+" **Now Playing in "+guild.getSelfMember().getVoiceState().getChannel().getAsMention()+"...**"));
206206
EmbedBuilder eb = new EmbedBuilder();
207207
eb.setColor(guild.getSelfMember().getColor());
208208
RequestMetadata rm = getRequestMetadata();

src/main/java/com/jagrosh/jmusicbot/commands/MusicCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected void execute(CommandEvent event)
7070
GuildVoiceState userState = event.getMember().getVoiceState();
7171
if(!userState.inVoiceChannel() || userState.isDeafened() || (current!=null && !userState.getChannel().equals(current)))
7272
{
73-
event.replyError("You must be listening in "+(current==null ? "a voice channel" : "**"+current.getName()+"**")+" to use that!");
73+
event.replyError("You must be listening in "+(current==null ? "a voice channel" : current.getAsMention())+" to use that!");
7474
return;
7575
}
7676

@@ -89,7 +89,7 @@ protected void execute(CommandEvent event)
8989
}
9090
catch(PermissionException ex)
9191
{
92-
event.reply(event.getClient().getError()+" I am unable to connect to **"+userState.getChannel().getName()+"**!");
92+
event.reply(event.getClient().getError()+" I am unable to connect to "+userState.getChannel().getAsMention()+"!");
9393
return;
9494
}
9595
}

src/main/java/com/jagrosh/jmusicbot/commands/admin/SetvcCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ else if (list.size()>1)
6262
else
6363
{
6464
s.setVoiceChannel(list.get(0));
65-
event.reply(event.getClient().getSuccess()+" Music can now only be played in **"+list.get(0).getName()+"**");
65+
event.reply(event.getClient().getSuccess()+" Music can now only be played in "+list.get(0).getAsMention());
6666
}
6767
}
6868
}

src/main/java/com/jagrosh/jmusicbot/commands/general/SettingsCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected void execute(CommandEvent event)
5757
EmbedBuilder ebuilder = new EmbedBuilder()
5858
.setColor(event.getSelfMember().getColor())
5959
.setDescription("Text Channel: " + (tchan == null ? "Any" : "**#" + tchan.getName() + "**")
60-
+ "\nVoice Channel: " + (vchan == null ? "Any" : "**" + vchan.getName() + "**")
60+
+ "\nVoice Channel: " + (vchan == null ? "Any" : vchan.getAsMention())
6161
+ "\nDJ Role: " + (role == null ? "None" : "**" + role.getName() + "**")
6262
+ "\nCustom Prefix: " + (s.getPrefix() == null ? "None" : "`" + s.getPrefix() + "`")
6363
+ "\nRepeat Mode: " + (s.getRepeatMode() == RepeatMode.OFF

src/main/java/com/jagrosh/jmusicbot/utils/FormatUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static String listOfVChannels(List<VoiceChannel> list, String query)
7474
{
7575
String out = " Multiple voice channels found matching \""+query+"\":";
7676
for(int i=0; i<6 && i<list.size(); i++)
77-
out+="\n - "+list.get(i).getName()+" (ID:"+list.get(i).getId()+")";
77+
out+="\n - "+list.get(i).getAsMention()+" (ID:"+list.get(i).getId()+")";
7878
if(list.size()>6)
7979
out+="\n**And "+(list.size()-6)+" more...**";
8080
return out;

0 commit comments

Comments
 (0)