Better split without space

This commit is contained in:
Crystal Melting Dot 2021-01-13 18:04:14 +03:00
parent 4501018078
commit 8c49d3f0b6
6 changed files with 6 additions and 6 deletions

View File

@ -110,7 +110,7 @@ class CheckerBaseHandler(SimpleCommandHandler):
def process_args_for_host_port(text: str, default_port: int) -> list: def process_args_for_host_port(text: str, default_port: int) -> list:
port = None port = None
args = text.split(" ") args = text.split()
if len(args) < 2: if len(args) < 2:
raise NotEnoughArgs() raise NotEnoughArgs()
if len(args) == 2: if len(args) == 2:

View File

@ -31,7 +31,7 @@ class ICMPCheckerHandler(CheckerBaseHandler):
await self.check(message.chat.id, message.bot, dict(target=args[0], target_fq=args[0])) await self.check(message.chat.id, message.bot, dict(target=args[0], target_fq=args[0]))
async def process_args(self, text: str) -> list: async def process_args(self, text: str) -> list:
args = text.split(" ") args = text.split()
if len(args) == 1: if len(args) == 1:
raise NotEnoughArgs() raise NotEnoughArgs()
if len(args) >= 2: if len(args) >= 2:

View File

@ -35,7 +35,7 @@ class IPCalcCommandHandler(SimpleCommandHandler):
await message.answer(msg) await message.answer(msg)
async def process_args(self, text: str) -> list: async def process_args(self, text: str) -> list:
args = text.split(" ") args = text.split()
if len(args) == 1: if len(args) == 1:
raise NotEnoughArgs raise NotEnoughArgs
return args return args

View File

@ -30,7 +30,7 @@ class TCPCheckerHandler(CheckerBaseHandler):
async def process_args(self, text: str) -> list: async def process_args(self, text: str) -> list:
port = None port = None
args = text.split(" ") args = text.split()
if len(args) < 3: if len(args) < 3:
raise NotEnoughArgs() raise NotEnoughArgs()
if len(args) >= 3: if len(args) >= 3:

View File

@ -82,7 +82,7 @@ def create_whois_message(domain: str) -> str:
@rate_limit @rate_limit
async def whois_cmd(msg: Message): async def whois_cmd(msg: Message):
args = msg.text.split(" ") args = msg.text.split()
if len(args) == 1: if len(args) == 1:
return await msg.answer(no_domain_text) return await msg.answer(no_domain_text)
if len(args) >= 2: if len(args) >= 2:

View File

@ -17,7 +17,7 @@ class WriteCommandMetric(BaseMiddleware):
value=1, value=1,
), ),
tags=dict( tags=dict(
command=message.text.split(" ")[0], command=message.text.split()[0],
type="command" type="command"
) )
) )