From 60a1b3294db831120a307262573e984d1aa58bad Mon Sep 17 00:00:00 2001 From: zephyrkul Date: Fri, 27 Dec 2019 09:43:25 -0700 Subject: [PATCH] [CustomCom] add Query typehint for URI-based CCs (#3228) * [cc] add Query typehint for URI query ccs * Create 3228.enhance.rst --- changelog.d/customcom/3228.enhance.rst | 1 + redbot/cogs/customcom/customcom.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 changelog.d/customcom/3228.enhance.rst diff --git a/changelog.d/customcom/3228.enhance.rst b/changelog.d/customcom/3228.enhance.rst new file mode 100644 index 000000000..5728754f9 --- /dev/null +++ b/changelog.d/customcom/3228.enhance.rst @@ -0,0 +1 @@ +Add query option for CC typehints, for URL-based CCs. diff --git a/redbot/cogs/customcom/customcom.py b/redbot/cogs/customcom/customcom.py index 3bfa88bba..b5cf2a7e6 100644 --- a/redbot/cogs/customcom/customcom.py +++ b/redbot/cogs/customcom/customcom.py @@ -4,6 +4,7 @@ from datetime import datetime, timedelta from inspect import Parameter from collections import OrderedDict from typing import Mapping, Tuple, Dict, Set +from urllib.parse import quote_plus import discord @@ -521,6 +522,7 @@ class CustomCommands(commands.Cog): "set": set, "str": str, "tuple": tuple, + "query": quote_plus, } indices = [int(a[0]) for a in args] low = min(indices)