From 146d9df460171a41548d204bd3497d666dd99909 Mon Sep 17 00:00:00 2001 From: Twentysix Date: Tue, 31 Jan 2017 15:54:40 +0100 Subject: [PATCH] [Downloader] Reworded disclaimer, show only once every session --- cogs/downloader.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/cogs/downloader.py b/cogs/downloader.py index 4bf225c0b..6800b17a4 100644 --- a/cogs/downloader.py +++ b/cogs/downloader.py @@ -20,6 +20,13 @@ REPO_CLONE = 0x2 REPO_SAME = 0x4 REPOS_LIST = "https://twentysix26.github.io/Red-Docs/red_cog_approved_repos/" +DISCLAIMER = ("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." + "\nBy typing 'I agree' you declare to have read and understand " + "the above message. This message won't be shown again until the" + " next reboot.") + class UpdateError(Exception): pass @@ -38,6 +45,7 @@ class Downloader: def __init__(self, bot): self.bot = bot + self.disclaimer_accepted = False self.path = "data/downloader/" self.file_path = "data/downloader/repos.json" # {name:{url,cog1:{installed},cog1:{installed}}} @@ -69,24 +77,18 @@ class Downloader: Warning: Adding 3RD Party Repositories is at your own Risk.""" - await self.bot.say("Type 'I agree' to confirm " - "adding a 3rd party repo. This has the possibility" - " of being harmful. You will not receive help " - "in Red - Discord Bot #support for any cogs " - "installed from this repo. If you do require " - "support you should contact the owner of this " - "repo.\n\nAgain, ANY repo you add is at YOUR" - " discretion and the creator of Red has " - "ABSOLUTELY ZERO responsibility to help if " - "something goes wrong.") - answer = await self.bot.wait_for_message(timeout=15, - author=ctx.message.author) - if answer is None: - await self.bot.say('Not adding repo.') - return - elif "i agree" not in answer.content.lower(): - await self.bot.say('Not adding repo.') - return + if not self.disclaimer_accepted: + await self.bot.say(DISCLAIMER) + answer = await self.bot.wait_for_message(timeout=30, + author=ctx.message.author) + if answer is None: + await self.bot.say('Not adding repo.') + return + elif "i agree" not in answer.content.lower(): + await self.bot.say('Not adding repo.') + return + else: + self.disclaimer_accepted = True self.repos[repo_name] = {} self.repos[repo_name]['url'] = repo_url try: