[Downloader] Reworded disclaimer, show only once every session

This commit is contained in:
Twentysix 2017-01-31 15:54:40 +01:00
parent f2fc5330fa
commit 146d9df460

View File

@ -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,17 +77,9 @@ 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,
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.')
@ -87,6 +87,8 @@ class Downloader:
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: