コード例 #1
0
 public static void Main(string[] args)
 {
     TDLibCore.Helper hpcore = new Helper()
     {
         debuglevel = TDLibCore.enums.DebugLevel.Full,
         useproxy   = false,
         APIHASH    = "",
         APIID      = 0,
     };
     TDLibCore.TDLibCore core = new TDLibCore.TDLibCore(hpcore)
     {
         phonenumber = "+98....",
     };
     core.OnVerificationCodeNeeded     += Core_OnVerificationCodeNeeded;
     core.OnVerificationPasswordNeeded += Core_OnVerificationPasswordNeededAsync;
     core.OnReady += Core_OnReady;
     core.initializeclient();
     Task.Factory.StartNew(() =>
     {
         while (true)
         {
             Console.Title = core.connectionstate.ToString();
             Thread.Sleep(100);
         }
     });
     Console.WriteLine("finished everything");
     Console.ReadKey();
 }
コード例 #2
0
        private static async void Core_OnReady(object sender, TDLibCoreEventArgs e)
        {
            TDLibCore.TDLibCore core = e.core;
            Console.WriteLine("ready");
            Console.WriteLine("Gathering chatslist ...");
            Responseobject me = await core.ExecuteCommandAsync(new tdapi.GetMe(), new tdapi.User());

            if (me.response == TDLibCore.enums.Response.Success)
            {
                List <tdapi.Chat> chatslist = await core.GetMainChatList();

                core.mainresponsehandlers.Add(new tdapi.UpdateNewMessage().GetType(), (a) =>
                {
                    Console.WriteLine(a.additionalobject);
                });
                if (chatslist.Count > 0)
                {
                    Console.WriteLine(chatslist.Count);
                }
                else
                {
                    Console.WriteLine("you have no chats in your main chatlist");
                }
            }
            else
            {
                Console.WriteLine("Gathering me failed");
            }
        }
コード例 #3
0
 public Reshandler(TDLibCore cr)
 {
     response  = enums.Response.Processing;
     this.core = cr;
     if (command is null)
     {
         command = "";
     }
 }