<commit_before>/*extern crate hyper;
extern crate rustc_serialize;*/

//use std::io;
use std::io::Read;

use super::rustc_serialize::json;
use super::rustc_serialize::Decodable;

use super::hyper::Client;
use super::hyper::header::Connection;

static BASE_PATH: &'static str = "https://api.telegram.org/";

pub struct Bot {
    api_key: String
}


#[derive(RustcDecodable)]
struct _GetMeResult {
    id: i32,
    first_name: String,
    username: String
}

#[derive(RustcDecodable)]
pub struct GetMe {
    ok: bool,
    result: _GetMeResult
}

impl Bot {
    pub fn new(api_key: &str) -> Bot {
        Bot {
            api_key: api_key.to_string()
        }
    }

    pub fn get_me(&self) -> String {
        let path = format!("{}bot{}/getMe", BASE_PATH, self.api_key);
        let client = Client::new();
        let mut res = client.get(&path)
            .send()
            .unwrap();

        let mut body = String::new();
        res.read_to_string(&mut body).unwrap();
        return body;
    }

    pub fn send_message(&self, chat_id: i32, text: String) -> String {
        let path = format!("{}bot{}/sendMessage?chat_id={}&text={}", BASE_PATH, self.api_key, chat_id, text);
        let client = Client::new();
        let mut res = client.get(&path)<commit_msg>fix some minor scope problems<commit_after>/*extern crate hyper;
extern crate rustc_serialize;*/

//use std::io;
use std::io::Read;

use super::rustc_serialize::json;
use super::rustc_serialize::Decodable;

use super::hyper::Client;
use super::hyper::header::Connection;

static BASE_PATH: &'static str = "https://api.telegram.org/";

pub struct Bot {
    api_key: String
}


#[derive(RustcDecodable)]
struct _GetMeResult {
    id: i32,
    first_name: String,
    username: String
}

#[derive(RustcDecodable)]
pub struct GetMe {
    pub ok: bool,
    pub result: _GetMeResult
}

impl Bot {
    pub fn new(api_key: &str) -> Bot {
        Bot {
            api_key: api_key.to_string()
        }
    }

    pub fn get_me(&self) -> String {
        let path = format!("{}bot{}/getMe", BASE_PATH, self.api_key);
        let client = Client::new();
        let mut res = client.get(&path)
            .send()
            .unwrap();

        let mut body = String::new();
        res.read_to_string(&mut body).unwrap();
        return body;
    }

    pub fn send_message(&self, chat_id: i32, text: String) -> String {
        let path = format!("{}bot{}/sendMessage?chat_id={}&text={}", BASE_PATH, self.api_key, chat_id, text);
        let client = Client::new();
        let mut res = client.get(&path)
{'fraction_non_alphanumeric': 0.15151515151515152, 'fraction_numerical': 0.003108003108003108, 'mean_word_length': 2.8605697151424287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2034111', 'n_tokens_mistral': 877, 'n_tokens_neox': 875, 'n_words': 211}