Skip to content

Voice channel mention #932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 2, 2021
Merged

Voice channel mention #932

merged 3 commits into from
Oct 2, 2021

Conversation

lorivaro
Copy link
Contributor

@lorivaro lorivaro commented Sep 28, 2021

This pull request...

  • Fixes a bug
  • Introduces a new feature
  • Improves an existing feature
  • Boosts code quality or performance

Description

I recently noticed voice channels can be mentioned just like text channels. A small change to the code can implement this feature.

image
The top example is the current way the bot would mention a channel, the bottom is what I wish it would look like.
This is my first pull request. I have not tested this change as I consider it to be too simple and don't expect it to fail.

Purpose

Aesthetics and ease of use: clicking on the mentioned channel will automatically connect you to it.

I recently noticed voice channels can be mentioned just like text channels. A small change to the code to implement this feature.
@lorivaro lorivaro marked this pull request as ready for review September 28, 2021 17:24
Copy link
Collaborator

@MichailiK MichailiK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDA offers a method to get a channel's mention string. Use that method instead.

@MichailiK
Copy link
Collaborator

MichailiK commented Sep 29, 2021

Additionally, my IDE has found another 3 usages of the voice channel name that you've missed:

mb.append(FormatUtil.filter(manager.getBot().getConfig().getSuccess()+" **Now Playing in "+guild.getSelfMember().getVoiceState().getChannel().getName()+"...**"));

+ "\nVoice Channel: " + (vchan == null ? "Any" : "**" + vchan.getName() + "**")

out+="\n - "+list.get(i).getName()+" (ID:"+list.get(i).getId()+")";

Please update these as well.

@lorivaro
Copy link
Contributor Author

lorivaro commented Oct 1, 2021

Thanks for the elaborate feedback.
I agree with getAsMention() being more appropriate than "<#"+vc.getId()+">".
I also applied these changes to the 3 other usages that I had missed earlier.

After successfully compiling the project, I ran the commands and got some good results, a few of which you can see below:

image

Copy link
Collaborator

@MichailiK MichailiK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! @jagrosh will have to take another look & merge if everything looks good.

@jagrosh jagrosh merged commit e08c149 into jagrosh:master Oct 2, 2021
ElerWohlmuthFH pushed a commit to ElerWohlmuthFH/MusicBot that referenced this pull request Sep 20, 2024
* 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants