Closed iwixw closed 2 years ago
Here is a script that can foreward messages between the client and VKontakte. But at the moment there is no way to control the bot directly through it. You could maybe get a second account on the server and activate this script on it. Then you could control the first account through remote control through minecraft chat messages.
Edit: If you only want to send server commands, you could try the script. It looks like this should work.
Вот скрипт, который может обмениваться сообщениями между клиентом и ВКонтакте. Но на данный момент нет возможности управлять ботом непосредственно через него. Возможно, вы могли бы получить вторую учетную запись на сервере и активировать на ней этот скрипт. Затем вы можете управлять первой учетной записью через удаленное управление через сообщения чата minecraft.
Изменить: Если вы хотите только отправлять команды сервера, вы можете попробовать сценарий. Похоже, это должно сработать.
Can I use commands like: /msg, /ban, /mute, /tp With this script
I am not sure, you should be able to do so. I would suggest to try it out.
Я не уверен, что вы сможете это сделать. Я бы посоветовал вам попробовать это сделать.
Can you help with customizing the script?
I am sorry, but I am neither the author, nor very familliar with VKontakte. It depends on what you want to do with it.
Where to get it from?
Maybe @Nekiplay can help here?
@Daenges friend, I was able to launch the bot. But there, to send a message to the server, it must start with a dot (.Hello) But the problem is that the message is sent to the server in the same way with a dot. Here's an example: I am sending a message: .Hello The server receives: .Hello
How can you fix this? To send a message to the server without a dot
You could replace this line SendText(text);
with SendText(text.Remove(0,1));
.
Just open the .cs file with any text editor and replace it. This command should delete the first Character in the string (which is always the dot).
Another way could be, that you remove the whole if (text.StartsWith(".")) { }
bracket and replace it with only SendText(text);
then all incoming text will be send to the chat.
Вы можете заменить эту строку
SendText(text);
наSendText(text.Remove(0,1));
. Просто откройте файл .cs в любом текстовом редакторе и замените его. Эта команда должна удалить первый символ в строке (который всегда является точкой). Другой способ может заключаться в том, что вы снимаете всюif (text.StartsWith(".")) { }
скобку и заменяете ее толькоSendText(text);
тогда, когда весь входящий текст будет отправлен в чат.
Thank you, now the next question is: D
How to display messages from chat in VK?
Again, I am not familiar with this script, but the comment says: "// Example below: Forward a message to VKonrakte if it starts with a dot".
@Daenges I found a script that can exchange messages between VK and the server. But there was a problem, the commands of the client itself by type: /move, /useitem, /script cannot be used. Do you know how to fix this?
So there is a function to execute an internal command. You could make an if-statement in the script function, which receives the messages from vk and call an internal command if the message starts with a certain character.
Таким образом, существует функция для выполнения внутренней команды. Вы можете сделать if-оператор в функции скрипта, которая получает сообщения от vk, и вызвать внутреннюю команду, если сообщение начинается с определенного символа.
Can you help me, please? Since I do not really understand this. I can give you the code
I thought you would work with the script that is already integrated. It has all the functionality you want.
@Daenges I tried to use the script that was in CONSOLE\config\ChatBots\VKMessager.cs (I still can't send MCC commands and I don't receive messages from the server to VK)
Yeah. You need to configure the script. In the standard configuration this script only sends textmessages which start with a dot from Minacraft to VK and backwards. If you want to execute internal commands you need to program this into the script. (which is a one line change)
Да. Вам нужно настроить скрипт. В стандартной конфигурации этот скрипт отправляет только текстовые сообщения, которые начинаются с точки от Minacraft до VK и обратно. Если вы хотите выполнять внутренние команды, вам нужно запрограммировать это в сценарий. (что является изменением в одну строку)
Can you help do this?
private void ProcessMsgFromVk(string senderId, string peer_id, string text, string conversation_message_id, string id, string event_id)
{
// Here you can process a message coming from VKonrakte
// Example below: Forward a message to Minecraft if it starts wit a dot
if (text.StartsWith("."))
{
string response = "";
PerformInternalCommand(text.Remove(0,1), ref response);
LogToConsole(GetVerbatim(response));
}
else
{
SendText(text);
}
}
This should forward every command that starts with a dot to the client instead of the server.
private void ProcessMsgFromVk(string senderId, string peer_id, string text, string conversation_message_id, string id, string event_id) { // Here you can process a message coming from VKonrakte // Example below: Forward a message to Minecraft if it starts wit a dot if (text.StartsWith(".")) { string response = ""; PerformInternalCommand(text.Remove(0,1), ref response); LogToConsole(GetVerbatim(response)); } else { SendText(text); } }
This should forward every command that starts with a dot to the client instead of the server.
Where should it be inserted?
It should replace the whole function.
Can you replace it please? Because I don't quite understand
thanks a lot
@Daenges Can you try adding this function to a similar script? If you have free time Script: https://pastebin.com/hJbLiXbA
Not really sure what the peer id exactly is, but I am assuming this is something like a channel ID on discord.. https://pastebin.com/2c7NBtG7
Не совсем уверен, что именно такое peer id, но я предполагаю, что это что-то вроде идентификатора канала в discord.. https://pastebin.com/2c7NBtG7
Everything is working. Thank you very much for such a great help! I hope not so much nerves were spent on me :D
If anyone wants to use this script, here's what they can do:
Is it possible to control a bot using Telegram / VKontakte?