discord-needle icon indicating copy to clipboard operation
discord-needle copied to clipboard

💡 Customize default title for auto-threads

Open MarcusOtter opened this issue 3 years ago • 12 comments

Is your request for improvement related to a problem? Please describe. From MumbleMarvin#2812 on Discord:

Only thing that would be cool if there were customize options for the autocreate thread titles. Like "use message", "use image name", "use link title" or stuff like this

Right now the default title for a thread is Username (yyyy-MM-dd). As Marvin points out, it would be nice if this was customizeable.

Describe the solution you'd like

Title options (?):

  • Name (yyyy-MM-dd)
  • First X characters of message
  • First line of message
  • Use image alt text (if possible? also, what's the fallback if no image here)
  • Use link title (sounds like we need to do a HTTP request and like scrape the title but I could be wrong. also, what's the fallback?)

Perhaps the default can be Name (yyyy-MM-dd) but if an image or link exists, override it? Though that has problems if someone links to, say, documentation for some programming thing as a source for their question, you wouldn't want that to override. Needs some thinking about.

Solutions:

  • Option A When creating a thread, add another optional parameter for the default thread title, where you are given different options. Something like /configure autothreading channel: #general default-title: First X characters of message

  • Option B A new command like /configure default-title value: First X characters of message which would set the default for all auto-threads.

Additional context Leaning towards Option A because it's not an extra command, and it would be configurable on a per-channel basis. Would like feedback on the different title options!

MarcusOtter avatar Jan 12 '22 18:01 MarcusOtter

I think you could do all of those variants with variables? Similar to the way default messages have $USER.

  • $DATE(format) - date in the user-specified format, e.g. $DATE(yyyy-MM-dd)
  • $FIRSTCHARS(count) - first X characters of the message*
  • $LINKTITLE(count) - image alt text OR link title OR image filename OR link url OR first X characters of the message*
  • $LINKURL(count) - image filename OR link url OR first X characters of the message*

*count will shorten any text variants to specified length or, if empty, max that discord allows

Madis0 avatar Jan 15 '22 22:01 Madis0

While it would be nice for programmers I worry about the general public having to look up the available variables/options and entering free text. Would be nice to get some sort of dropdown list for this imo, even if it limits customization slightly.

MarcusOtter avatar Jan 15 '22 22:01 MarcusOtter

How about this? /configure autothreading channel:#channel default-title type:user-date value:$user (yyyy-MM-dd) for specific /configure default-title type:first-characters value:10 for global

Types:

  • user-date
  • first-characters
  • link-title
  • link-url

value would depend on the type and be optional.

Madis0 avatar Jan 15 '22 22:01 Madis0

Good idea

ririko5834 avatar Feb 01 '22 14:02 ririko5834

After having used Needle on my server this feature is definitely something that would beneficial. Particularly as I am using it auto-thread posts made by a bot. In my instance Link Title is definitely the most important option. I'm not sure I see the value in Link URL.

First characters is also a good option. Though a more suitable name would be prefix.

runloop avatar Feb 10 '22 08:02 runloop

My members want a user friendly title too! I want to use first line of message :)

Will use it ASAP when its released. Need it!

image

maddie-wang avatar Mar 30 '22 20:03 maddie-wang

push - would love that

CodeAnthem avatar May 17 '22 20:05 CodeAnthem

That would be so great!

distantnative avatar May 25 '22 06:05 distantnative

Not sure if this falls under this issue, or if I should make s new one, so here goes.

It would be nice if we could customize the first message sent by needle after a thread is created.

We can sort of do this already. That is we can customize the text, but not the buttons below it.

It would be nice if we could also customize the buttons below.

See this for example: Screenshot_20220614_171042.jpg

If it was possible to customize buttons here, we could add a button for changing the title, instead of asking the user to change the title through the message.

Another option would be to prompt the user straight away for what they want the thread title to be, and then the first message they type after that prompt is set to the title. Then when they have written a title, the bot can respond with a message saying that they can change the title with the /title command.

Anyways, let me know if I should make a new issue for this, or if it fits under this one

Snailedlt avatar Jun 14 '22 15:06 Snailedlt

How about this? /configure autothreading channel:#channel default-title type:user-date value:$user (yyyy-MM-dd) for specific /configure default-title type:first-characters value:10 for global

Types:

  • user-date
  • first-characters
  • link-title
  • link-url

value would depend on the type and be optional.

I very much like this idea!

It works well both for customization and simplicity.

Snailedlt avatar Jun 14 '22 15:06 Snailedlt

@Snailedlt Button customization goes under issue #31

we could add a button for changing the title

This is the plan :)

Another option would be to prompt the user straight away for what they want the thread title to be, and then the first message they type after that prompt is set to the title.

I don't really like this UX, and Discord wants basically all intreactions to be through commands (not when users write messages, etc)

I do have a plan for implementing this. I just need to find the time... I started working on something in PR #155 which is promising. It basically looks like this.

image

MarcusOtter avatar Jun 14 '22 15:06 MarcusOtter

@MarcusOtter ohh yes! That modal feature would be great for titles . Especially if it can be opened by buttons

Snailedlt avatar Jun 14 '22 15:06 Snailedlt

Update on this: I added support for RegEx, message variables, and a custom max title length. Will be out with the next update (along with a LOT of other changes). Example of the feature:

image image

Oh, and of course we provide options for people that don't want to write RegEx: image

MarcusOtter avatar Aug 24 '22 20:08 MarcusOtter

How would this feature respond to the message being an embed? For example I'm thinking of using needle to auto create threads on my sesh.fyi posts. Would it be possible to pull the title value from an embed? @MarcusOtter

DoNotResuscitate avatar Aug 29 '22 23:08 DoNotResuscitate

Excellent question @DooNotResuscitate, I had not tested it. Right now it doesn't work!

How do you suggest I implement support for this? My initial idea is to just append all embeds (title + description + fields + footer) for every embed. It might look messy but we can't really assume that an embed will always have the most important content in the description or in the fields, I think.

MarcusOtter avatar Aug 29 '22 23:08 MarcusOtter

Excellent question @DooNotResuscitate, I had not tested it. Right now it doesn't work!

How do you suggest I implement support for this? My initial idea is to just append all embeds (title + description + fields + footer) for every embed. It might look messy but we can't really assume that an embed will always have the most important content in the description or in the fields, I think.

My personal suggestion would be to just pull the value from the title field - the Apollo bot (which has built-in thread creation) just uses the embed title for the thread title. It also includes the event time, but that's because it knows what date exactly to pull.

Screen Shot 2022-08-29 at 19 40 06

Screen Shot 2022-08-29 at 19 40 28

So for my purposes I would be content with just the embed title being pulled, but I'm wondering how it would be listed as an option like the others above. Maybe a separate parameter would need to be added for embeds specifically? Something like the already existing "title-format" and also "title-format-embed"? That way you could give a couple options specifically for if an embed is detected like: Title, Description, Title + Description, etc. @MarcusOtter

DoNotResuscitate avatar Aug 29 '22 23:08 DoNotResuscitate

This is not something I would make configurable, we should just pick a reasonable default to keep the amount of unnecessary options down. Since you will be able to regex on this anyways, I think I'll just do (title + \n\n + description + \n\n + field title + \n + field description + \n\n + footer) and then if you know you only want the title you can just target that with a regex.

The message content for the embed you showed would be ("..." for lazyness)

<@&XXXXXXXXXXXXXXXXXX>

DURF Weekly Game

Requirements: 18+, good mic and solid internet connection. Players: 3-5 total Desc...

Time <t:1662296400:F> - <t:1662307200:t> <:clock:XXXXX....

MarcusOtter avatar Aug 29 '22 23:08 MarcusOtter

Yeah if the returned output can be regexed, then I think your default is just fine.

DoNotResuscitate avatar Aug 29 '22 23:08 DoNotResuscitate

So with this implemented, would the plain default with no title-format option be the above if an embed is detected?

DoNotResuscitate avatar Aug 30 '22 00:08 DoNotResuscitate

The default would be the first 50 characters of the message, where the message in this case is the message content + embeds content. So if you have more than 50 characters in the message, you will never see the embed part (with the default settings).

MarcusOtter avatar Aug 30 '22 00:08 MarcusOtter

Got it - so in the case of the message being just the embed by itself, would be first 50 chars of the embed. That works, and I assume the regex will parse over the whole entire message so I could pull whatever part out?

DoNotResuscitate avatar Aug 30 '22 00:08 DoNotResuscitate

Yep!

MarcusOtter avatar Aug 30 '22 00:08 MarcusOtter

Seems to work now, thanks for the comment. New lines are obviously not shown in thread titles but you could regex on them :) This is just grabbing the 100 first chars.

image image

MarcusOtter avatar Aug 30 '22 22:08 MarcusOtter