Skip to content

Commit 86273b4

Browse files
committed
fixed a bug with argument handling for admin commands
1 parent ac9fedc commit 86273b4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from operator import index
2+
13
from vk_api.longpoll import VkLongPoll, VkEventType
24
from vk_api.utils import get_random_id
35
import vk_api
@@ -68,7 +70,11 @@ def resolve_entity(entity_id: int | str) -> dict:
6870
return {}
6971

7072
def get_numeric_entity_id(entity_id: str) -> int:
71-
entity_id = entity_id.strip().replace("@id", "").replace("@", "")
73+
entity_id = entity_id.lstrip()
74+
if "|" in entity_id:
75+
entity_id = entity_id[1:entity_id.index("|")]
76+
if entity_id.startswith("id"):
77+
entity_id = entity_id.replace("id", "")
7278
if entity_id.isdigit() or is_negative(entity_id):
7379
return int(entity_id)
7480
entity_info = resolve_entity(entity_id)

0 commit comments

Comments
 (0)