mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Added use spoilers functionality (#4877)
* Added use spoilers functionallity * Update trivia.py * Update session.py
This commit is contained in:
parent
c78ee14617
commit
0c3e772135
@ -21,6 +21,13 @@ _REVEAL_MESSAGES = (
|
|||||||
_("Easy: {answer}."),
|
_("Easy: {answer}."),
|
||||||
_("Oh really? It's {answer} of course."),
|
_("Oh really? It's {answer} of course."),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SPOILER_REVEAL_MESSAGES = (
|
||||||
|
_("I know this one! ||{answer}!||"),
|
||||||
|
_("Easy: ||{answer}.||"),
|
||||||
|
_("Oh really? It's ||{answer}|| of course."),
|
||||||
|
)
|
||||||
|
|
||||||
_FAIL_MESSAGES = (
|
_FAIL_MESSAGES = (
|
||||||
_("To the next one I guess..."),
|
_("To the next one I guess..."),
|
||||||
_("Moving on..."),
|
_("Moving on..."),
|
||||||
@ -204,6 +211,9 @@ class TriviaSession:
|
|||||||
self.stop()
|
self.stop()
|
||||||
return False
|
return False
|
||||||
if self.settings["reveal_answer"]:
|
if self.settings["reveal_answer"]:
|
||||||
|
if self.settings["use_spoilers"]:
|
||||||
|
reply = T_(random.choice(SPOILER_REVEAL_MESSAGES)).format(answer=answers[0])
|
||||||
|
else:
|
||||||
reply = T_(random.choice(_REVEAL_MESSAGES)).format(answer=answers[0])
|
reply = T_(random.choice(_REVEAL_MESSAGES)).format(answer=answers[0])
|
||||||
else:
|
else:
|
||||||
reply = T_(random.choice(_FAIL_MESSAGES))
|
reply = T_(random.choice(_FAIL_MESSAGES))
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class Trivia(commands.Cog):
|
|||||||
reveal_answer=True,
|
reveal_answer=True,
|
||||||
payout_multiplier=0.0,
|
payout_multiplier=0.0,
|
||||||
allow_override=True,
|
allow_override=True,
|
||||||
|
use_spoilers=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.config.register_member(wins=0, games=0, total_score=0)
|
self.config.register_member(wins=0, games=0, total_score=0)
|
||||||
@ -92,7 +93,8 @@ class Trivia(commands.Cog):
|
|||||||
"Points to win: {max_score}\n"
|
"Points to win: {max_score}\n"
|
||||||
"Reveal answer on timeout: {reveal_answer}\n"
|
"Reveal answer on timeout: {reveal_answer}\n"
|
||||||
"Payout multiplier: {payout_multiplier}\n"
|
"Payout multiplier: {payout_multiplier}\n"
|
||||||
"Allow lists to override settings: {allow_override}"
|
"Allow lists to override settings: {allow_override}\n"
|
||||||
|
"Use Spoilers in answers: {use_spoilers}"
|
||||||
).format(**settings_dict),
|
).format(**settings_dict),
|
||||||
lang="py",
|
lang="py",
|
||||||
)
|
)
|
||||||
@ -149,6 +151,19 @@ class Trivia(commands.Cog):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@triviaset.command(name="usespoilers", usage="<true_or_false>")
|
||||||
|
async def trivaset_use_spoilers(self, ctx: commands.Context, enabled: bool):
|
||||||
|
"""Set if bot will display the answers in spoilers.
|
||||||
|
|
||||||
|
If enabled, the bot will use spoilers to hide answers.
|
||||||
|
"""
|
||||||
|
settings = self.config.guild(ctx.guild)
|
||||||
|
await settings.use_spoilers.set(enabled)
|
||||||
|
if enabled:
|
||||||
|
await ctx.send(_("Done. I'll put the answers in spoilers next time."))
|
||||||
|
else:
|
||||||
|
await ctx.send(_("Alright, I won't use spoilers to hide answers anymore."))
|
||||||
|
|
||||||
@triviaset.command(name="botplays", usage="<true_or_false>")
|
@triviaset.command(name="botplays", usage="<true_or_false>")
|
||||||
async def trivaset_bot_plays(self, ctx: commands.Context, enabled: bool):
|
async def trivaset_bot_plays(self, ctx: commands.Context, enabled: bool):
|
||||||
"""Set whether or not the bot gains points.
|
"""Set whether or not the bot gains points.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user