mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 09:52:30 -05:00
* Do not include 'I agree' prompt in translation string
* Add more stuff
* Address review comment
* Address review comments
(cherry picked from commit 4b70acb989)
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
@@ -2,23 +2,12 @@ import asyncio
|
||||
|
||||
from redbot.core import commands
|
||||
from redbot.core.i18n import Translator
|
||||
from redbot.core.utils.chat_formatting import bold
|
||||
from redbot.core.utils.predicates import MessagePredicate
|
||||
|
||||
__all__ = ["do_install_agreement"]
|
||||
|
||||
T_ = Translator("DownloaderChecks", __file__)
|
||||
|
||||
_ = lambda s: s
|
||||
REPO_INSTALL_MSG = _(
|
||||
"You're about to add a 3rd party repository. The creator of Red"
|
||||
" and its community have no responsibility for any potential "
|
||||
"damage that the content of 3rd party repositories might cause."
|
||||
"\n\nBy typing '**I agree**' you declare that you have read and"
|
||||
" fully understand the above message. This message won't be "
|
||||
"shown again until the next reboot.\n\nYou have **30** seconds"
|
||||
" to reply to this message."
|
||||
)
|
||||
_ = T_
|
||||
_ = Translator("DownloaderChecks", __file__)
|
||||
|
||||
|
||||
async def do_install_agreement(ctx: commands.Context) -> bool:
|
||||
@@ -26,11 +15,24 @@ async def do_install_agreement(ctx: commands.Context) -> bool:
|
||||
if downloader is None or downloader.already_agreed:
|
||||
return True
|
||||
|
||||
await ctx.send(T_(REPO_INSTALL_MSG))
|
||||
confirmation_message = "I agree"
|
||||
await ctx.send(
|
||||
_(
|
||||
"You're about to add a 3rd party repository. The creator of Red"
|
||||
" and its community have no responsibility for any potential "
|
||||
"damage that the content of 3rd party repositories might cause."
|
||||
"\n\nBy typing '{confirmation_message}' you declare that you have read and"
|
||||
" fully understand the above message. This message won't be "
|
||||
"shown again until the next reboot.\n\nYou have **30** seconds"
|
||||
" to reply to this message."
|
||||
).format(confirmation_message=bold(confirmation_message))
|
||||
)
|
||||
|
||||
try:
|
||||
await ctx.bot.wait_for(
|
||||
"message", check=MessagePredicate.lower_equal_to("i agree", ctx), timeout=30
|
||||
"message",
|
||||
check=MessagePredicate.lower_equal_to(confirmation_message.lower(), ctx),
|
||||
timeout=30,
|
||||
)
|
||||
except asyncio.TimeoutError:
|
||||
await ctx.send(_("Your response has timed out, please try again."))
|
||||
|
||||
Reference in New Issue
Block a user