mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
add discussion quiz
This commit is contained in:
parent
ddb104c3b7
commit
3bfe117f8b
|
@ -263,6 +263,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
|
||||||
|
@ -270,6 +274,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ async def feeds_compact_formatter(post_type, post, message_target, wiki, _):
|
||||||
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":
|
||||||
logger.warning("No entry for {event} with params: {params}".format(event=thread_funnel, params=post))
|
logger.warning("No entry for {event} with params: {params}".format(event=thread_funnel, params=post))
|
||||||
message = _(msg_text).format(author=author, author_url=author_url, title=post["title"], url=wiki, threadId=post["threadId"], forumName=post["forumName"])
|
message = _(msg_text).format(author=author, author_url=author_url, title=post["title"], url=wiki, threadId=post["threadId"], forumName=post["forumName"])
|
||||||
|
@ -83,8 +85,9 @@ async def feeds_embed_formatter(post_type, post, message_target, wiki, _):
|
||||||
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"
|
||||||
|
embed["title"] = _("Created a poll \"{title}\"").format(title=post["title"])
|
||||||
|
if message_target[0][1] > 1:
|
||||||
poll = post["poll"]
|
poll = post["poll"]
|
||||||
embed["title"] = _("Created a poll \"{title}\"").format(title=poll["question"])
|
|
||||||
image_type = False
|
image_type = False
|
||||||
if poll["answers"][0]["image"] is not None:
|
if poll["answers"][0]["image"] is not None:
|
||||||
image_type = True
|
image_type = True
|
||||||
|
@ -92,6 +95,14 @@ async def feeds_embed_formatter(post_type, post, message_target, wiki, _):
|
||||||
embed.add_field(option["text"] if image_type is True else _("Option {}").format(num+1),
|
embed.add_field(option["text"] if image_type is True else _("Option {}").format(num+1),
|
||||||
option["text"] if image_type is False else _("__[View image]({image_url})__").format(image_url=option["image"]["url"]),
|
option["text"] if image_type is False else _("__[View image]({image_url})__").format(image_url=option["image"]["url"]),
|
||||||
inline=True)
|
inline=True)
|
||||||
|
elif thread_funnel == "QUIZ":
|
||||||
|
embed.event_type = "discussion/forum/quiz"
|
||||||
|
embed["title"] = _("Created a quiz \"{title}\"").format(title=post["title"])
|
||||||
|
if message_target[0][1] > 1:
|
||||||
|
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