2

我一直在尝试让我的 whatsapp 控制台应用程序正常工作。不幸的是,在尝试注册时出现错误:old_version。这是我的程序在控制台中记录的内容(程序代码如下):

Succesfully connected...
Failed to log in...
  Reason: Auth response error
Phone number validation:
Type "y" in the console if you want to get a validation code send via SMS
y
SMS code send
Error with sending the request...
Reason: {"login":"mynumber","status":"fail","reason":"old_version"}

有谁知道我如何更新whatsapp API?它是我的 NuGet 包管理器中当前的最新版本。我知道有两个版本,我都试过了,都没有成功。

我正在使用 .NET 框架解决方案而不是 .NET 核心,因为我正在处理由微软引起的 NuGet 包管理器错误。此外,我还在 .NET 框架中使用其他 NuGet 包,例如 Discord.NET。

所以我可以在 NuGet 包管理器中找到 2 个 Whatsapp API。API 的第一个版本在 v1.2.2 上,另一个在 v15.4.29 上。

此外,我想添加用于注册的代码。

bool registrationSucces = WhatsRegisterV2.RequestCode(number, out password, out error);

要完全重现错误: https : //pastebin.com/EJhjALwz 以及前面提到的两个可用的 nuget 包(v1.2.2 或 v15.4.29 上的那个)

我期待任何对 API 或编码有更多了解的人可以帮助我解决这个挫折。

4

1 回答 1

0

下载github这个项目试试这个配置:

    using System;
    using System.Globalization;

    namespace WhatsAppApi.Settings
       {
               /// <summary>
               /// Holds constant information used to connect to whatsapp 
             server
                 /// </summary>
                  public class WhatsConstants
                   {
                    #region ServerConstants

        /// <summary>
        /// The whatsapp host
        /// </summary>
        public const string WhatsAppHost = "c3.whatsapp.net";

        /// <summary>
        /// The whatsapp XMPP realm
        /// </summary>
        public const string WhatsAppRealm = "s.whatsapp.net";

        /// <summary>
        /// The whatsapp server
        /// </summary>
        public const string WhatsAppServer = "s.whatsapp.net";

        /// <summary>
        /// The whatsapp group chat server
        /// </summary>
        public const string WhatsGroupChat = "g.us";

        /// <summary>
        /// The whatsapp version the client complies to
        /// </summary>
        //public const string WhatsAppVer = "2.13.21";
        //public const string WhatsAppVer = "2.12.440";
        //public const string WhatsAppVer = "2.12.556";
        public const string WhatsAppVer = "2.19.368";

        /// <summary>
        /// The port that needs to be connected to
        /// </summary>
        public const int WhatsPort = 443;

        /// <summary>
        /// iPhone device
        /// </summary>
        //  public const string Device = "S40";
        public const string Device = "Android";

        /// <summary>
        /// manufacturer
        /// </summary>
        public const string Manufacturer = "HTC";

        /// <summary>
        /// OS Version
        /// </summary>
        public const string OS_Version = "4.3";

        /// <summary>
        /// The useragent used for http requests
        /// </summary>
        //public const string UserAgent = "WhatsApp/2.13.21 S40Version/14.26 Device/Nokia302";
        //public const string UserAgent = "WhatsApp/2.12.440 Android/4.3 Device/Xiaomi-HM_1SW";
        public const string UserAgent = "WhatsApp/2.19.368 Android/4.3 Device/endeavoru-IMM76D";


        #endregion

        #region ParserConstants
        /// <summary>
        /// The number style used
        /// </summary>
        public static NumberStyles WhatsAppNumberStyle = (NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign);

        /// <summary>
        /// Unix epoch DateTime
        /// </summary>
        public static DateTime UnixEpoch = new DateTime(0x7b2, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
        #endregion
    }
}
于 2020-01-05T05:57:05.130 回答