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

Implement searching threads by creator. #256

Open
ShreyasAyyengar opened this issue Aug 26, 2024 · 8 comments
Open

Implement searching threads by creator. #256

ShreyasAyyengar opened this issue Aug 26, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@ShreyasAyyengar
Copy link
Member

ShreyasAyyengar commented Aug 26, 2024

Explain your idea.

Discord does not natively support searching forum channels for a post created by a specific user. The discord bot can facilitate doing so because the JDA provides this functionality:

ForumChannel channel = {...} // get the #help channel.
String creatorId = {...} // requested discord user who created a help thread post.
List<ThreadChannel> foundThreads = new ArrayList<>();

for (ThreadChannel threadChannel : channel.getThreadChannels()) {
    if (threadChannel.getOwnerId().equalsIgnoreCase(creatorId)) {
        foundThreads.add(threadChannel);
    }
}

I realise the Discord bot is written in Kotlin, but I wanted to help anyone who wishes to PR this in finding the proper JDA methods.

Anything else?

No response

@ShreyasAyyengar ShreyasAyyengar added the enhancement New feature or request label Aug 26, 2024
@flytegg flytegg deleted a comment Aug 26, 2024
@granpacho
Copy link

i mean whats the point

@granpacho
Copy link

granpacho commented Sep 4, 2024

anyways this is the code in kotlin

val helpChannel: ForumChannel = guild.getChannelById(1234)
val creatorID = userId
val threads: MutableList<ThreadChannel> = mutableListOf()

for (thread in helpChannel.threadChannels) {
	if (thread.ownerId.equals(creatorID)) {
		threads.add(thread)
	}
}

@ShreyasAyyengar
Copy link
Member Author

support searching forum channels for a post created by a specific user.

"support searching forum channels for a post created by a specific user."

@granpacho
Copy link

granpacho commented Sep 4, 2024

i mean i guess i could make a pr later I'm bored anyways

@granpacho
Copy link

so how should we make this work, like have three per page and have a button that changes pages or just the top 5 recent

@Tofpu
Copy link
Contributor

Tofpu commented Sep 4, 2024

so how should we make this work, like have three per page and have a button that changes pages or just the top 5 recent

I personally think that having it three per page with a button to change pages would be a nicer addition. You're the one PRing it though, so up to you

@MLGPenguin
Copy link
Member

anyways this is the code in kotlin

val helpChannel: ForumChannel = guild.getChannelById(1234)
val creatorID = userId
val threads: MutableList<ThreadChannel> = mutableListOf()

for (thread in helpChannel.threadChannels) {
	if (thread.ownerId.equals(creatorID)) {
		threads.add(thread)
	}
}

Here's the code in Kotlin but easier and uses our existing utils:

Server.helpChannel.threadChannels.filter { it.ownerId == userId }

I also think 5 per page, in line with the /reputation command would be nice and consistent.

@granpacho
Copy link

Here's the code in Kotlin but easier and uses our existing utils:

Yeah I didn't look at any of the codebase I was just changing their code into kotlin, but that'll help actually I don't need to create a new postregistry method then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants
@Tofpu @granpacho @ShreyasAyyengar @MLGPenguin and others