update all dependencies to latest version. Need to wait for discord-rs to update though
This commit is contained in:
14
Cargo.toml
14
Cargo.toml
@@ -1,16 +1,16 @@
|
||||
[package]
|
||||
name="tenquestionmarks"
|
||||
version="0.0.2"
|
||||
version="0.0.3"
|
||||
authors=["Adrian Malacoda <adrian.malacoda@monarch-pass.net>"]
|
||||
|
||||
[dependencies]
|
||||
hlua = "0.3"
|
||||
hlua = "0.4.1"
|
||||
discord = "0.8.0"
|
||||
toml = "0.2.1"
|
||||
crossbeam = "0.2"
|
||||
rand = "0.3"
|
||||
log = "0.3.6"
|
||||
env_logger = "0.4.0"
|
||||
toml = "0.4.5"
|
||||
crossbeam = "0.3.2"
|
||||
rand = "0.4.2"
|
||||
log = "0.4.1"
|
||||
env_logger = "0.5.3"
|
||||
transformable_channels = "0.1.1"
|
||||
time = "0.1"
|
||||
regex = "0.2"
|
||||
|
@@ -12,7 +12,7 @@ extern crate regex;
|
||||
extern crate hlua;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
mod modules;
|
||||
use modules::Module;
|
||||
@@ -177,7 +177,7 @@ struct Subscription {
|
||||
impl Subscription {
|
||||
pub fn new (name: String, module: Module) -> Subscription {
|
||||
let filters: Vec<Box<EventFilter>> = module.config.get("filters")
|
||||
.and_then(|value| value.as_slice())
|
||||
.and_then(|value| value.as_array())
|
||||
.map(|value| value.to_vec())
|
||||
.unwrap_or(vec![])
|
||||
.into_iter()
|
||||
|
37
src/main.rs
37
src/main.rs
@@ -1,12 +1,11 @@
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::io::{Read, Write};
|
||||
|
||||
extern crate tenquestionmarks;
|
||||
use tenquestionmarks::Tenquestionmarks;
|
||||
|
||||
extern crate toml;
|
||||
use toml::Parser;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
@@ -15,17 +14,17 @@ extern crate env_logger;
|
||||
extern crate time;
|
||||
|
||||
fn init_logger () {
|
||||
let mut builder = env_logger::LogBuilder::new();
|
||||
builder.format(|record: &log::LogRecord| {
|
||||
let mut builder = env_logger::Builder::new();
|
||||
builder.format(|buf, record: &log::Record| {
|
||||
let t = time::now();
|
||||
format!("{} {}:{}: {}", time::strftime("%Y-%m-%d %H:%M:%S", &t).unwrap(), record.level(), record.location().module_path(), record.args())
|
||||
}).filter(None, log::LogLevelFilter::Info);;
|
||||
writeln!(buf, "{} {}:{}: {}", time::strftime("%Y-%m-%d %H:%M:%S", &t).unwrap(), record.level(), record.module_path().unwrap_or("?"), record.args())
|
||||
}).filter(None, log::LevelFilter::Info);;
|
||||
|
||||
if env::var("RUST_LOG").is_ok() {
|
||||
builder.parse(&env::var("RUST_LOG").unwrap());
|
||||
}
|
||||
|
||||
builder.init().unwrap();
|
||||
builder.init();
|
||||
}
|
||||
|
||||
fn main () {
|
||||
@@ -37,18 +36,18 @@ fn main () {
|
||||
if let Err(e) = file.read_to_string(&mut contents) {
|
||||
error!("Failed to open config file {}: {:?}", config_file_name, e);
|
||||
} else {
|
||||
let mut parser = Parser::new(&contents);
|
||||
if let Some(configuration) = parser.parse() {
|
||||
info!("Loaded configuration from: {}", config_file_name);
|
||||
match Tenquestionmarks::from_configuration(configuration) {
|
||||
Ok(tqm) => {
|
||||
info!("tenquestionmarks initialized successfully");
|
||||
tqm.run();
|
||||
},
|
||||
Err(e) => error!("Failed to initialize tenquestionmarks: {:?}", e)
|
||||
}
|
||||
} else {
|
||||
error!("Failed to parse config file {}: {:?}. Config file must be a valid TOML file.", config_file_name, parser.errors);
|
||||
match toml::from_str(&contents) {
|
||||
Ok(configuration) => {
|
||||
info!("Loaded configuration from: {}", config_file_name);
|
||||
match Tenquestionmarks::from_configuration(configuration) {
|
||||
Ok(tqm) => {
|
||||
info!("tenquestionmarks initialized successfully");
|
||||
tqm.run();
|
||||
},
|
||||
Err(e) => error!("Failed to initialize tenquestionmarks: {:?}", e)
|
||||
}
|
||||
},
|
||||
Err(error) => error!("Failed to parse config file {}: {:?}. Config file must be a valid TOML file.", config_file_name, error)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
@@ -4,7 +4,7 @@ use discord::model::{Event, PossibleServer};
|
||||
|
||||
use modules::Module;
|
||||
use modules::EventLoop;
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use event;
|
||||
use event::Envelope;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use modules::Module;
|
||||
use modules::discord::DiscordModule;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
use modules::{Module, EventLoop};
|
||||
|
||||
use toml::{Table, Value};
|
||||
use toml::Value;
|
||||
use toml::value::Table;
|
||||
|
||||
use hlua;
|
||||
use hlua::{Lua, LuaFunction, Push};
|
||||
|
@@ -17,7 +17,7 @@ use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
use transformable_channels::mpsc::ExtSender;
|
||||
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
pub struct Module {
|
||||
event_loop: Box<EventLoop>,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::Receiver;
|
||||
@@ -21,7 +21,7 @@ impl RandomModule {
|
||||
.unwrap_or("?random");
|
||||
|
||||
let responses = configuration.get("responses")
|
||||
.and_then(|value| value.as_slice())
|
||||
.and_then(|value| value.as_array())
|
||||
.map(|value| value.to_vec())
|
||||
.unwrap_or(vec![])
|
||||
.into_iter()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use std::io;
|
||||
|
||||
use modules::{Module, EventLoop};
|
||||
use toml::Table;
|
||||
use toml::value::Table;
|
||||
|
||||
use {MessageSender, Message, User};
|
||||
|
||||
|
Reference in New Issue
Block a user