Пример #1
0
        public static void Execute()
        {
            var config = ConfigFile.Parse();

            Console.Write("Setting offline...");
            var response = VkApi.SetOffline((string)config["access_token"]);

            if ((string)response["response"] == "1")
            {
                Console.Write("OK\n");
            }
            else
            {
                PiniginFunctions.WriteColorLine("ERROR: " + response.ToString(), ConsoleColor.Red);
            }
        }
Пример #2
0
 public static void Execute(string input_text)
 {
     if (input_text.Split(' ').Length > 1)
     {
         var status   = input_text.Replace("setstatus ", "");
         var config   = ConfigFile.Parse();
         var response = VkApi.SetStatus((string)config["access_token"], status);
         if ((string)response["response"] == "1")
         {
             Console.WriteLine("Status changed");
         }
         else
         {
             PiniginFunctions.WriteColorLine("ERROR: " + response.ToString(), ConsoleColor.Red);
         }
     }
     else
     {
         Console.WriteLine("Usage: setstatus <text>");
     }
 }
Пример #3
0
 public static void Execute(string input_text)
 {
     string[] param = input_text.Split(' ');
     if (param.Length > 1)
     {
         var config = ConfigFile.Parse();
         if (Int32.TryParse(param[1], out int result))
         {
             int    owner_id = result;
             string text     = input_text.Replace("post " + param[1] + " ", "");
             var    response = VkApi.WallPost((string)config["access_token"], owner_id, text);
             try
             {
                 Console.WriteLine("Post created. Id: " + response["response"]["post_id"]);
             }
             catch
             {
                 PiniginFunctions.WriteColorLine(response.ToString(), ConsoleColor.Red);
             }
         }
         else
         {
             int    owner_id = (int)config["user_id"];
             string text     = input_text.Replace("post ", "");
             var    response = VkApi.WallPost((string)config["access_token"], owner_id, text);
             try
             {
                 Console.WriteLine("Post created. Id: " + response["response"]["post_id"]);
             }
             catch
             {
                 PiniginFunctions.WriteColorLine(response.ToString(), ConsoleColor.Red);
             }
         }
     }
     else
     {
         Console.WriteLine("Usage: post [owner id] <text>");
     }
 }