factorized help and triple-quote multi-line

This commit is contained in:
Klemek
2021-04-09 15:34:03 +02:00
parent 5f903db929
commit b7a6f3313b
18 changed files with 134 additions and 185 deletions
+35 -38
View File
@@ -3,45 +3,42 @@ import discord
from logs import GuildLogs
HELP = (
"```\n"
+ "%gdpr: Displays GDPR information\n"
+ "arguments:\n"
+ "* agree - agree to GDPR\n"
+ "* revoke - remove this server's data\n"
+ "```"
)
HELP = """```
%gdpr: Displays GDPR information
arguments:
* agree - agree to GDPR
* revoke - remove this server's data
```"""
TEXT = (
""
+ "__**About Analyst-bot's data usage**__\n"
+ "**TL;DR**\n"
+ "Analyst-bot collects text message information. It does not share collected data with any third-party and data is retained 12 months or until the bot is leaving the guild/server.\n"
+ "**Data collection**\n"
+ "Analyst-bot collects a Discord guild/server's history when asked to.\n"
+ "This includes:\n"
+ "- Visible text channel names\n"
+ "- Visible text messages: date and time of creation and edition, author, content, reactions and other available metadata (pinned, tts, etc.)\n"
+ "This does __not__ includes:\n"
+ "- Voice channels and not visible channels\n"
+ "- Not visible text messages\n"
+ "- Visible text messages' embedded content, images and other attachments\n"
+ "**Data processing**\n"
+ "Any data collected is only processed in order to produce a one-time report sent to the user immediately. No temporary data are retained.\n"
+ "**Data storage and retain policy**\n"
+ "Analyst-bot stores the collected data in files that are accessible by the software and its administrator only.\n"
+ "Any collected data are retained maximum 12 months until deletion or when the bot is leaving a guild/server.\n"
+ "**Data sharing**\n"
+ "Analyst-bot does not share the data collected with any third-party.\n"
+ "**Right to retract**\n"
+ "If you want to have your data removed, you can use the `%gdpr revoke` command or remove this bot from your guild/server.\n"
+ "**Terms agreement**\n"
+ "By agreeing to these terms, you ensure having the legal age if you are in a country that does have one and you also ensure having the consent of every member involved.\n"
+ "\n"
+ "*If you want more information, please contact the creator of this bot: <https://github.com/Klemek/discord-analyst>.*\n"
+ "\n"
+ "Type `%gdpr agree` to agree to these terms, `%gdpr revoke` to remove this guild/server's collected data or `%gdpr` to see this message again."
)
TEXT = """
__**About Analyst-bot's data usage**__
**TL;DR**
Analyst-bot collects text message information. It does not share collected data with any third-party and data is retained 18 months or until the bot is leaving the guild/server.
**Data collection**
Analyst-bot collects a Discord guild/server's history when asked to.
This includes:
- Visible text channel names
- Visible text messages: date and time of creation and edition, author, content, reactions and other available metadata (pinned, tts, etc.)
This does __not__ includes:
- Voice channels and not visible channels
- Not visible text messages
- Visible text messages' embedded content, images and other attachments
**Data processing**
Any data collected is only processed in order to produce a one-time report sent to the user immediately. No temporary data are retained.
**Data storage and retain policy**
Analyst-bot stores the collected data in files that are accessible by the software and its administrator only.
Any collected data are retained maximum 18 months until deletion or when the bot is leaving a guild/server.
**Data sharing**
Analyst-bot does not share the data collected with any third-party.
**Right to retract**
If you want to have your data removed, you can use the `%gdpr revoke` command or remove this bot from your guild/server.
**Terms agreement**
By agreeing to these terms, you ensure having the legal age if you are in a country that does have one and you also ensure having the consent of every member involved.
*If you want more information, please contact the creator of this bot: <https://github.com/Klemek/discord-analyst>.*
Type `%gdpr agree` to agree to these terms, `%gdpr revoke` to remove this guild/server's collected data or `%gdpr` to see this message again.
"""
AGREE_TEXT = "Thanks for agreeing for these terms, you can now run analysis on this guild/server."
+25 -7
View File
@@ -7,13 +7,31 @@ from datetime import datetime
# OTHER
COMMON_HELP_ARGS = (
""
+ "* @member/me - filter for one or more member\n"
+ "* #channel/here - filter for one or more channel\n"
+ "* fast - only read cache\n"
+ "* fresh - does not read cache (long)\n"
)
COMMON_HELP_ARGS = [
"@member/me - filter for one or more member",
"#channel/here - filter for one or more channel",
"fast - only read cache",
"fresh - does not read cache (long)",
]
def generate_help(
cmd: str,
info: str,
*,
args=["all/everyone - include bots"],
example="#mychannel1 @user",
replace_args=[],
):
arg_list = "* " + "\n* ".join(
replace_args + COMMON_HELP_ARGS[len(replace_args) :] + args
)
return f"""```
%{cmd}: {info}
arguments:
{arg_list}
Example: %{cmd} {example}
```"""
def delta(t0: datetime):