Skip to content

Commit

Permalink
Using shlex.split instead of pythons own split. (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
cviper13 authored Mar 15, 2024
1 parent b4925d8 commit 20b4a1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ http-ece
requests
numpy
scipy
betterproto==2.0.0b6
betterproto==2.0.0b6
shlex
7 changes: 4 additions & 3 deletions rustplus/commands/command_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import shlex
from datetime import datetime

from . import Command, CommandTime
Expand All @@ -22,7 +23,7 @@ def register_command(self, data: CommandData) -> None:

async def run_command(self, message: RustChatMessage, prefix) -> None:
if prefix == self.command_options.prefix:
command = message.message.split(" ")[0][len(prefix) :]
command = shlex.split(message.message)[0][len(prefix) :]
else:
command = prefix

Expand All @@ -35,7 +36,7 @@ async def run_command(self, message: RustChatMessage, prefix) -> None:
message.steam_id,
CommandTime(datetime.utcfromtimestamp(message.time), message.time),
command,
message.message.split(" ")[1:],
shlex.split(message.message)[1:],
)
)
else:
Expand All @@ -52,7 +53,7 @@ async def run_command(self, message: RustChatMessage, prefix) -> None:
datetime.utcfromtimestamp(message.time), message.time
),
command,
message.message.split(" ")[1:],
shlex.split(message.message)[1:],
),
)
break
Expand Down

0 comments on commit 20b4a1d

Please sign in to comment.