about summary refs log tree commit diff stats
path: root/src/tracker_panel.cpp
Commit message (Expand)AuthorAgeFilesLines
* Double buffered painting looks betterStar Rauchenberger2024-05-141-1/+5
* Added player position trackingStar Rauchenberger2024-04-031-0/+32
* Make win condition checkableStar Rauchenberger2024-02-181-1/+3
* Area popups are now paintedStar Rauchenberger2024-01-191-4/+6
* Stop relying on correctly set working directoryStar Rauchenberger2023-11-261-1/+3
* Fixed hunt-only areas not showing up for huntsStar Rauchenberger2023-11-171-1/+2
* Show hunt panels optionStar Rauchenberger2023-11-171-2/+8
* Added hybrid areas and settings dialogStar Rauchenberger2023-11-171-18/+40
* Use hardcoded AP ids nowStar Rauchenberger2023-09-171-6/+4
* Panelsanity supportStar Rauchenberger2023-08-251-5/+11
* Support reduce_checksStar Rauchenberger2023-05-091-1/+9
* Refactored away singletonsStar Rauchenberger2023-05-051-3/+3
* Organised repoStar Rauchenberger2023-05-051-0/+149
.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#include <yaml-cpp/yaml.h>
#include <twitter.h>
#include <fstream>
#include <iostream>
#include <thread>
#include <chrono>

int main(int argc, char** argv)
{
  YAML::Node config = YAML::LoadFile("config.yml");
    
  twitter::auth auth;
  auth.setConsumerKey(config["consumer_key"].as<std::string>());
  auth.setConsumerSecret(config["consumer_secret"].as<std::string>());
  auth.setAccessKey(config["access_key"].as<std::string>());
  auth.setAccessSecret(config["access_secret"].as<std::string>());
  
  twitter::client client(auth);
  
  long loc = 0;
  if (config["current_location"])
  {
    loc = config["current_location"].as<long>();
  }
  
  std::list<std::string> tweets;
  {
    std::ifstream corpus(config["corpus"].as<std::string>());
    corpus.ignore(loc);
  
    char buffer[140];
    while (corpus)
    {
      corpus.read(buffer, 140);
      tweets.push_back(std::string(buffer, 140));
    }
  }
  
  while (!tweets.empty())
  {
    try
    {
      std::string nextTweet = tweets.front();
      client.updateStatus(nextTweet);
      
      std::cout << "Tweeted!" << std::endl;

      loc += 140;
      {
        std::ofstream fout("config.yml");
        config["current_location"] = loc;
        fout << config;
      }

      tweets.pop_front();
    } catch (const twitter::twitter_error& e)
    {
      std::cout << "Twitter error: " << e.what() << std::endl;
    }
    
    std::cout << "Waiting..." << std::endl;
    
    std::this_thread::sleep_for(std::chrono::hours(6));
  }
}