Skip to content

Instantly share code, notes, and snippets.

@SkyzohKey
Created July 4, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SkyzohKey/6e9d4f5b860fc5f8edc8 to your computer and use it in GitHub Desktop.
Save SkyzohKey/6e9d4f5b860fc5f8edc8 to your computer and use it in GitHub Desktop.
fn init_tox() -> Tox
{
// load Tox Profile
let mut xp: Vec<u8> = Vec::new();
let mut tox = match Tox::new(ToxOptions::new(), match File::open(Path::new(HFB_PROFILE))
{
Ok(mut data) =>
{
data.read_to_end(&mut xp).ok().expect("[ERROR] Impossible de lire le profil.");
Some(&xp)
},
Err(_) => None
})
{
Ok(t) => t,
Err(err) => panic!("[ERROR] Tox InitError: {:?}", err)
};
let bootstrap_key = match BOOTSTRAP_KEY.parse()
{
Ok(b) => b,
Err(_) => panic!("[ERROR] Erreur lors de la creation de la clef de bootstrap"),
};
// config + bootstrap
tox.set_name("Hack-Free Bot").unwrap();
tox.set_status_message("Développé par Skyzohkey et Ogromny").unwrap();
tox.bootstrap(BOOTSTRAP_IP, BOOTSTRAP_PORT, bootstrap_key).unwrap();
tox
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment