T
T
the_extreames2018-09-17 17:03:29
Python
the_extreames, 2018-09-17 17:03:29

How are the commands for banning and muting and getting an ID?

Hello, how to make commands to ban, mute, and get a person's ID in a python bot? Commands like: mute amount of time, ban amount of time, and id

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dragaleff, 2020-10-19
@dragaleff

elif (len(answer) == 2) and (answer[0] == "!мут"):
      if event.user_id in admins or event.user_id in allow:
            id = answer[1]
            id = id.split("|")[0]
            id = id.replace("[id", "")
            member = vk.method("messages.getConversationMembers", {"peer_id": event.peer_id})
            for member in member["items"]:
                  if member["member_id"] == 555054793:
                      admin = member.get('is_admin', False)
                      if admin == False:
                          vk.method("messages.send", {"peer_id": event.peer_id,
                                                                    "message": "Отсутствуют права Администратора, для выполнения данной команды!", "random_id": 0})
                      if admin == True:
                          adm1 = vk.method("messages.getConversationMembers", {"peer_id": event.peer_id})
                          for i in adm1["items"]:
                                if i["member_id"] == int(id):
                                     check = i.get('is_admin', False)
                                                if check == True:
                                                    vk.method("messages.send", {"peer_id": event.peer_id, "message":
                                                        "Невозможно выдать мут пользователю, т.к он является Администратором беседы.",
                                                                                "random_id": 0})
                                                if check == False:
                                                    mute.append(int(id))
                                                    vk.method("messages.send", {"peer_id": event.peer_id, "message": "Участнику выдан мут. Теперь он не сможет общаться в чате.", "random_id": 0}

M
Michael666, 2021-01-30
@Michael666

What needs to be done to install it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question