Skip to content
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

NewsChannel is not returned by Message.MentionType.CHANNEL #2034

Closed
3 tasks done
RedcodesDev opened this issue Feb 20, 2022 · 2 comments
Closed
3 tasks done

NewsChannel is not returned by Message.MentionType.CHANNEL #2034

RedcodesDev opened this issue Feb 20, 2022 · 2 comments
Labels
status: completed has been completed but is not yet released

Comments

@RedcodesDev
Copy link
Contributor

RedcodesDev commented Feb 20, 2022

General Troubleshooting

  • I have checked for similar issues.
  • I have updated to the latest JDA version.
  • I have checked the branches or the maintainers' PRs for upcoming bug fixes.

Bug Report

Message.MentionType.CHANNEL does not return NewsChannels. This was discovered by @ItzKiwiSap in #2027.
I am using 5.0.0-alpha.6. I also tried v4 and it worked perfectly fine.

Expected Behavior

Message.MentionType.CHANNEL should also return NewsChannels.

Code Example or Reproduction Steps

public void onMessageReceived(MessageReceivedEvent e) {

	List<IMentionable> mentionedChannels = e.getMessage().getMentions(Message.MentionType.CHANNEL);
	if (mentionedChannels.isEmpty()) {
		System.out.println("empty");
		return;
	}

}
  1. Mention a normal TextChannel in a message - nothing will be returned.
  2. Mention a NewsChannel in a message - empty will be returned, indicating that there is no Channel Mention in the Message according to the JDA.

Code for JDABuilder or DefaultShardManagerBuilder Used

JDABuilder builder = JDABuilder.createDefault(token);

builder.setActivity(Activity.watching("Bot starting..."));
builder.setStatus(OnlineStatus.IDLE);

List<GatewayIntent> intents = new ArrayList<GatewayIntent>();
intents.addAll(EnumSet.allOf(GatewayIntent.class));
intents.remove(GatewayIntent.GUILD_PRESENCES);

builder.setEnabledIntents(intents);
builder.setMemberCachePolicy(MemberCachePolicy.ALL);
		
builder.addEventListeners(new MessageTest());

Exception or Error

N/A

@MinnDevelopment
Copy link
Member

This will should get fixed in #2015

@MinnDevelopment MinnDevelopment added the status: in progress already in the process of being implemented label Apr 15, 2022
@MinnDevelopment MinnDevelopment added status: completed has been completed but is not yet released and removed status: in progress already in the process of being implemented labels May 10, 2022
@MinnDevelopment
Copy link
Member

You can now use Message#getMentions and Mentions#getChannels as of 5.0.0-alpha.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed has been completed but is not yet released
Projects
None yet
Development

No branches or pull requests

2 participants