mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Allow DLLs in scripts, Update VKAPI (#1158)
* Update VKAPI * KeyBoard Update * Add Custom Libs * Change add method
This commit is contained in:
parent
beebe506d1
commit
55f8988bbc
2 changed files with 55 additions and 4 deletions
|
|
@ -51,12 +51,17 @@ namespace MinecraftClient
|
||||||
List<string> script = new List<string>();
|
List<string> script = new List<string>();
|
||||||
List<string> extensions = new List<string>();
|
List<string> extensions = new List<string>();
|
||||||
List<string> libs = new List<string>();
|
List<string> libs = new List<string>();
|
||||||
|
List<string> dlls = new List<string>();
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
if (line.StartsWith("//using"))
|
if (line.StartsWith("//using"))
|
||||||
{
|
{
|
||||||
libs.Add(line.Replace("//", "").Trim());
|
libs.Add(line.Replace("//", "").Trim());
|
||||||
}
|
}
|
||||||
|
else if (line.StartsWith("//dll"))
|
||||||
|
{
|
||||||
|
dlls.Add(line.Replace("//dll ", "").Trim());
|
||||||
|
}
|
||||||
else if (line.StartsWith("//MCCScript"))
|
else if (line.StartsWith("//MCCScript"))
|
||||||
{
|
{
|
||||||
if (line.EndsWith("Extensions"))
|
if (line.EndsWith("Extensions"))
|
||||||
|
|
@ -107,6 +112,7 @@ namespace MinecraftClient
|
||||||
.Select(a => a.Location).ToArray());
|
.Select(a => a.Location).ToArray());
|
||||||
parameters.CompilerOptions = "/t:library";
|
parameters.CompilerOptions = "/t:library";
|
||||||
parameters.GenerateInMemory = true;
|
parameters.GenerateInMemory = true;
|
||||||
|
parameters.ReferencedAssemblies.AddRange(dlls.ToArray());
|
||||||
CompilerResults result = compiler.CompileAssemblyFromSource(parameters, code);
|
CompilerResults result = compiler.CompileAssemblyFromSource(parameters, code);
|
||||||
|
|
||||||
//Process compile warnings and errors
|
//Process compile warnings and errors
|
||||||
|
|
|
||||||
|
|
@ -115,15 +115,15 @@ internal class VkLongPoolClient
|
||||||
lastrand = LastTs + 1;
|
lastrand = LastTs + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(string chatId, string text, int random_id = 0)
|
public void SendMessage(string chatId, string text, string keyboard = "", int random_id = 0)
|
||||||
{
|
{
|
||||||
if (random_id == 0)
|
if (random_id == 0)
|
||||||
{
|
{
|
||||||
random_id = lastrand;
|
random_id = lastrand;
|
||||||
lastrand++;
|
lastrand++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&message=" + text);
|
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&message=" + text + "&keyboard=" + keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendSticker(string chatId, int sticker_id, int random_id = 0)
|
public void SendSticker(string chatId, int sticker_id, int random_id = 0)
|
||||||
|
|
@ -144,6 +144,51 @@ internal class VkLongPoolClient
|
||||||
else
|
else
|
||||||
CallVkMethod("groups.disableOnline", "group_id=" + BotCommunityId);
|
CallVkMethod("groups.disableOnline", "group_id=" + BotCommunityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void KickChatUser(string chat_id, string user_id)
|
||||||
|
{
|
||||||
|
CallVkMethod("messages.removeChatUser", "chat_id=" + chat_id + "&user_id=" + user_id + "&member_id=" + user_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Keyboard
|
||||||
|
{
|
||||||
|
public bool one_time = false;
|
||||||
|
public List<List<object>> buttons = new List<List<object>>();
|
||||||
|
public Keyboard(bool one_time2)
|
||||||
|
{
|
||||||
|
one_time = one_time2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddButton(string label, string payload, string color)
|
||||||
|
{
|
||||||
|
buttons button = new Buttons(label, payload, color);
|
||||||
|
buttons.Add( new List<object>() { button });
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Buttons
|
||||||
|
{
|
||||||
|
public Action action;
|
||||||
|
public string color;
|
||||||
|
public Buttons(string labe11, string payload1, string color2)
|
||||||
|
{
|
||||||
|
action = new Action(labe11, payload1);
|
||||||
|
color = color2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Action
|
||||||
|
{
|
||||||
|
public string type;
|
||||||
|
public string payload;
|
||||||
|
public string label;
|
||||||
|
public Action(string label3, string payload3)
|
||||||
|
{
|
||||||
|
type = "text";
|
||||||
|
payload = "{\"button\": \"" + payload3 + "\"}";
|
||||||
|
label = label3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void StartLongPoolAsync()
|
private void StartLongPoolAsync()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue