mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Add discussion quiz
New translation strings: * `[{author}]({author_url}) created a quiz [{title}](<{url}f/p/{threadId}>) in {forumName}` * `Created a quiz "{title}"`
This commit is contained in:
parent
077871d82c
commit
975bfe1c18
|
@ -278,6 +278,10 @@
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"color":null
|
"color":null
|
||||||
},
|
},
|
||||||
|
"discussion/forum/quiz": {
|
||||||
|
"icon": "",
|
||||||
|
"color":null
|
||||||
|
},
|
||||||
"discussion/wall/post": {
|
"discussion/wall/post": {
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"color":null
|
"color":null
|
||||||
|
@ -285,6 +289,14 @@
|
||||||
"discussion/wall/reply": {
|
"discussion/wall/reply": {
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"color":null
|
"color":null
|
||||||
|
},
|
||||||
|
"discussion/comment/post": {
|
||||||
|
"icon": "",
|
||||||
|
"color":null
|
||||||
|
},
|
||||||
|
"discussion/comment/reply": {
|
||||||
|
"icon": "",
|
||||||
|
"color":null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,6 +31,8 @@ def compact_formatter(post_type, post):
|
||||||
msg_text = "[{author}]({author_url}) created [{title}](<{url}f/p/{threadId}>) in {forumName}"
|
msg_text = "[{author}]({author_url}) created [{title}](<{url}f/p/{threadId}>) in {forumName}"
|
||||||
if thread_funnel == "POLL":
|
if thread_funnel == "POLL":
|
||||||
msg_text = "[{author}]({author_url}) created a poll [{title}](<{url}f/p/{threadId}>) in {forumName}"
|
msg_text = "[{author}]({author_url}) created a poll [{title}](<{url}f/p/{threadId}>) in {forumName}"
|
||||||
|
elif thread_funnel == "QUIZ":
|
||||||
|
msg_text = "[{author}]({author_url}) created a quiz [{title}](<{url}f/p/{threadId}>) in {forumName}"
|
||||||
elif thread_funnel != "TEXT":
|
elif thread_funnel != "TEXT":
|
||||||
discussion_logger.warning("The type of {} is an unknown discussion post type. Please post an issue on the project page to have it added https://gitlab.com/piotrex43/RcGcDw/-/issues.".format(thread_funnel))
|
discussion_logger.warning("The type of {} is an unknown discussion post type. Please post an issue on the project page to have it added https://gitlab.com/piotrex43/RcGcDw/-/issues.".format(thread_funnel))
|
||||||
message = _(msg_text).format(author=author, author_url=author_url, title=post["title"], url=settings["fandom_discussions"]["wiki_url"], threadId=post["threadId"], forumName=post["forumName"])
|
message = _(msg_text).format(author=author, author_url=author_url, title=post["title"], url=settings["fandom_discussions"]["wiki_url"], threadId=post["threadId"], forumName=post["forumName"])
|
||||||
|
@ -83,15 +85,24 @@ def embed_formatter(post_type, post):
|
||||||
thread_funnel = post.get("funnel")
|
thread_funnel = post.get("funnel")
|
||||||
if thread_funnel == "POLL":
|
if thread_funnel == "POLL":
|
||||||
embed.event_type = "discussion/forum/poll"
|
embed.event_type = "discussion/forum/poll"
|
||||||
poll = post["poll"]
|
embed["title"] = _("Created a poll \"{title}\"").format(title=post["title"])
|
||||||
embed["title"] = _("Created a poll \"{title}\"").format(title=poll["question"])
|
if settings["fandom_discussions"]["appearance"]["embed"]["show_content"]:
|
||||||
image_type = False
|
poll = post["poll"]
|
||||||
if poll["answers"][0]["image"] is not None:
|
image_type = False
|
||||||
image_type = True
|
if poll["answers"][0]["image"] is not None:
|
||||||
for num, option in enumerate(poll["answers"]):
|
image_type = True
|
||||||
embed.add_field(option["text"] if image_type is True else _("Option {}").format(num+1),
|
for num, option in enumerate(poll["answers"]):
|
||||||
option["text"] if image_type is False else _("__[View image]({image_url})__").format(image_url=option["image"]["url"]),
|
embed.add_field(option["text"] if image_type is True else _("Option {}").format(num+1),
|
||||||
inline=True)
|
option["text"] if image_type is False else _("__[View image]({image_url})__").format(image_url=option["image"]["url"]),
|
||||||
|
inline=True)
|
||||||
|
elif thread_funnel == "QUIZ":
|
||||||
|
embed.event_type = "discussion/forum/quiz"
|
||||||
|
embed["title"] = _("Created a quiz \"{title}\"").format(title=post["title"])
|
||||||
|
if settings["fandom_discussions"]["appearance"]["embed"]["show_content"]:
|
||||||
|
quiz = post["_embedded"]["quizzes"][0]
|
||||||
|
embed["description"] = quiz["title"]
|
||||||
|
if quiz["image"] is not None:
|
||||||
|
embed["image"]["url"] = quiz["image"]
|
||||||
elif thread_funnel == "TEXT":
|
elif thread_funnel == "TEXT":
|
||||||
embed.event_type = "discussion/forum/post"
|
embed.event_type = "discussion/forum/post"
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue