-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Naming threads #10
Comments
@honzajavorek I'd go for this next but need a bit more information:
Is it time to chat about this in more detail? |
On Discord, threads have explicit names. In two channels in the club, #past-vedle-pasti and #můj-dnešní-objev, this bot automatically creates a thread under every message someone posts there. Because the thread requires an explicit name, bot generates one according to current weekday, so that people could at least somewhat orientate if discussing in multiple of those threads. The function responsible for that is here: As you can see in the screenshot, there's a bottom-up convention where people denote the topic of their post in brackets before the actual post. What @benabraham suggests is that the mechanism for naming those threads parses the message content and if there's something in the brackets in the beginning, it could use it for the thread name instead of the weekday. Regarding tests, there is already the folder and they're ran on CI, so no need to set them up anymore, but I can definitely imagine testing the parsing. Just by doing a superficial scroll in either #past-vedle-pasti or #můj-dnešní-objev, I can see people get creative with whitespace or emoji, so picking up a few specimen and putting them into |
To avoid messing with async and IO in the tests, the following lines should become a separate sync function: weekday = datetime.now().weekday()
name = name_template.format(weekday=DAYS[weekday], author=starting_message.author.display_name) It would take necessary inputs and return a name for the thread. In the beginning, we can test it work correctly for the weekdays, then add the logic for parsing. I assume that the function will still return name based on the weekday in case there are no brackets to parse or the brackets parsing produce something confusing (better return weekday than crash the bot). |
Idea from @benabraham:
Do we want this? Seems like a neat idea 🤔 This could be also a nice opportunity to have some tests added to the repository. I can help with setting them up.
The text was updated successfully, but these errors were encountered: