diff options
author | 2021-08-26 14:37:16 -0700 | |
---|---|---|
committer | 2021-08-26 14:37:16 -0700 | |
commit | e92d87d791957d5b7ec01d0a8c679012c2370248 (patch) | |
tree | 9f72e6bd6333da788d4390950b674217d486e6b5 | |
parent | Add time units to the `!remind edit` and `!remind edit duration` help messages (diff) | |
parent | Merge pull request #1785 from python-discord/Output-public-url-when-sharing (diff) |
Merge branch 'main' into update-remind-help
-rw-r--r-- | bot/constants.py | 1 | ||||
-rw-r--r-- | bot/exts/info/information.py | 7 | ||||
-rw-r--r-- | bot/exts/moderation/metabase.py | 2 | ||||
-rw-r--r-- | config-default.yml | 1 |
4 files changed, 9 insertions, 2 deletions
diff --git a/bot/constants.py b/bot/constants.py index 80e01b174..4e99df7f3 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -569,6 +569,7 @@ class Metabase(metaclass=YAMLGetter): username: Optional[str] password: Optional[str] base_url: str + public_url: str max_session_age: int diff --git a/bot/exts/info/information.py b/bot/exts/info/information.py index 38b436b7d..ae547b1b8 100644 --- a/bot/exts/info/information.py +++ b/bot/exts/info/information.py @@ -221,8 +221,13 @@ class Information(Cog): await ctx.send(embed=embed) @command(name="user", aliases=["user_info", "member", "member_info", "u"]) - async def user_info(self, ctx: Context, user: MemberOrUser = None) -> None: + async def user_info(self, ctx: Context, user_or_message: Union[MemberOrUser, Message] = None) -> None: """Returns info about a user.""" + if isinstance(user_or_message, Message): + user = user_or_message.author + else: + user = user_or_message + if user is None: user = ctx.author diff --git a/bot/exts/moderation/metabase.py b/bot/exts/moderation/metabase.py index 3b454ab18..9eeeec074 100644 --- a/bot/exts/moderation/metabase.py +++ b/bot/exts/moderation/metabase.py @@ -167,7 +167,7 @@ class Metabase(Cog): async with self.bot.http_session.post(url, headers=self.headers, raise_for_status=True) as resp: response_json = await resp.json(encoding="utf-8") - sharing_url = f"{MetabaseConfig.base_url}/public/question/{response_json['uuid']}" + sharing_url = f"{MetabaseConfig.public_url}/public/question/{response_json['uuid']}" await ctx.send(f":+1: {ctx.author.mention} Here's your sharing link: {sharing_url}") # This cannot be static (must have a __func__ attribute). diff --git a/config-default.yml b/config-default.yml index 8e0b97a51..baece5c51 100644 --- a/config-default.yml +++ b/config-default.yml @@ -441,6 +441,7 @@ metabase: username: !ENV "METABASE_USERNAME" password: !ENV "METABASE_PASSWORD" base_url: "http://metabase.default.svc.cluster.local" + public_url: "https://metabase.pythondiscord.com" # 14 days, see https://www.metabase.com/docs/latest/operations-guide/environment-variables.html#max_session_age max_session_age: 20160 |