mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add UnLoadBot to ChatBot API (#1164)
Add UnloadBot Add BotList Update VkMessager Remove debug info
This commit is contained in:
parent
55f8988bbc
commit
712875251e
2 changed files with 32 additions and 0 deletions
|
|
@ -35,6 +35,8 @@ namespace MinecraftClient
|
||||||
public void SetHandler(McClient handler) { this._handler = handler; }
|
public void SetHandler(McClient handler) { this._handler = handler; }
|
||||||
protected void SetMaster(ChatBot master) { this.master = master; }
|
protected void SetMaster(ChatBot master) { this.master = master; }
|
||||||
protected void LoadBot(ChatBot bot) { Handler.BotUnLoad(bot); Handler.BotLoad(bot); }
|
protected void LoadBot(ChatBot bot) { Handler.BotUnLoad(bot); Handler.BotLoad(bot); }
|
||||||
|
protected List<ChatBot> GetLoadedChatBots() { return Handler.GetLoadedChatBots(); }
|
||||||
|
protected void UnLoadBot(ChatBot bot) { Handler.BotUnLoad(bot); }
|
||||||
private McClient _handler = null;
|
private McClient _handler = null;
|
||||||
private ChatBot master = null;
|
private ChatBot master = null;
|
||||||
private List<string> registeredPluginChannels = new List<String>();
|
private List<string> registeredPluginChannels = new List<String>();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
//MCCScript 1.0
|
//MCCScript 1.0
|
||||||
//using System.Threading.Tasks;
|
//using System.Threading.Tasks;
|
||||||
|
//dll Newtonsoft.Json.dll
|
||||||
|
//using Newtonsoft.Json;
|
||||||
|
//using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
//==== INFO START ====
|
||||||
|
// Download Newtonsoft.Json.dll and install it into the program folder Link: https://www.newtonsoft.com/json
|
||||||
|
//==== INFO END ====
|
||||||
|
|
||||||
//==== CONFIG START ====
|
//==== CONFIG START ====
|
||||||
string vkToken = "";
|
string vkToken = "";
|
||||||
|
|
@ -125,6 +132,29 @@ internal class VkLongPoolClient
|
||||||
|
|
||||||
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&message=" + text + "&keyboard=" + keyboard);
|
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&message=" + text + "&keyboard=" + keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendMessageAndDocument(string chatId, string text, string file, string title, string keyboard = "", int random_id = 0)
|
||||||
|
{
|
||||||
|
if (random_id == 0)
|
||||||
|
{
|
||||||
|
random_id = lastrand;
|
||||||
|
lastrand++;
|
||||||
|
}
|
||||||
|
var c = new WebClient();
|
||||||
|
//
|
||||||
|
var u = CallVkMethod("docs.getMessagesUploadServer", "peer_id=" + chatId + "&type=doc");
|
||||||
|
var j = JsonConvert.DeserializeObject(u) as JObject;
|
||||||
|
//
|
||||||
|
var u2 = j["response"]["upload_url"].ToString();
|
||||||
|
var r2 = Encoding.UTF8.GetString(c.UploadFile(u2, "POST", file));
|
||||||
|
var j2 = JsonConvert.DeserializeObject(r2) as JObject;
|
||||||
|
//
|
||||||
|
var r3 = CallVkMethod("docs.save", "&file=" + j2["file"]
|
||||||
|
+ "&title=" + title);
|
||||||
|
var j3 = JsonConvert.DeserializeObject(r3) as JObject;
|
||||||
|
var at = "doc"+ j3["response"]["doc"]["owner_id"].ToString() + "_" + j3["response"]["doc"]["id"].ToString();
|
||||||
|
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&message=" + text + "&keyboard=" + keyboard + "&attachment=" + at);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendSticker(string chatId, int sticker_id, int random_id = 0)
|
public void SendSticker(string chatId, int sticker_id, int random_id = 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue