mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
VkMessager: New SendMessage RandomID core (#1198)
This commit is contained in:
parent
e6d34c3cf1
commit
3f94814bda
1 changed files with 4 additions and 9 deletions
|
|
@ -105,11 +105,11 @@ internal class VkLongPoolClient
|
|||
private WebClient SenderWebClient { get; set; }
|
||||
private string Token { get; set; }
|
||||
private int LastTs { get; set; }
|
||||
private int lastrand;
|
||||
private string Server { get; set; }
|
||||
private string Key { get; set; }
|
||||
private Action<string, string, string> OnMessageReceivedCallback { get; set; }
|
||||
private string BotCommunityId { get; set; }
|
||||
private Random rnd = new Random();
|
||||
|
||||
private void Init()
|
||||
{
|
||||
|
|
@ -119,15 +119,13 @@ internal class VkLongPoolClient
|
|||
Key = data.Properties["response"].Properties["key"].StringValue;
|
||||
Server = data.Properties["response"].Properties["server"].StringValue;
|
||||
LastTs = Convert.ToInt32(data.Properties["response"].Properties["ts"].StringValue);
|
||||
lastrand = LastTs + 1;
|
||||
}
|
||||
|
||||
public void SendMessage(string chatId, string text, string keyboard = "", int random_id = 0)
|
||||
{
|
||||
if (random_id == 0)
|
||||
{
|
||||
random_id = lastrand;
|
||||
lastrand++;
|
||||
random_id = rnd.Next();
|
||||
}
|
||||
|
||||
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&message=" + text + "&keyboard=" + keyboard);
|
||||
|
|
@ -137,8 +135,7 @@ internal class VkLongPoolClient
|
|||
{
|
||||
if (random_id == 0)
|
||||
{
|
||||
random_id = lastrand;
|
||||
lastrand++;
|
||||
random_id = rnd.Next();
|
||||
}
|
||||
var c = new WebClient();
|
||||
//
|
||||
|
|
@ -160,8 +157,7 @@ internal class VkLongPoolClient
|
|||
{
|
||||
if (random_id == 0)
|
||||
{
|
||||
random_id = lastrand;
|
||||
lastrand++;
|
||||
random_id = rnd.Next();
|
||||
}
|
||||
|
||||
CallVkMethod("messages.send", "peer_id=" + chatId + "&random_id=" + random_id + "&sticker_id=" + sticker_id);
|
||||
|
|
@ -246,7 +242,6 @@ internal class VkLongPoolClient
|
|||
Init();
|
||||
|
||||
LastTs = Convert.ToInt32(data.Properties["ts"].StringValue);
|
||||
lastrand = LastTs + 1;
|
||||
|
||||
var updates = data.Properties["updates"].DataArray;
|
||||
var messages = new List<Tuple<string, string, string>>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue