Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Master License, better typography
Browse files Browse the repository at this point in the history
  • Loading branch information
Texlo-Dev committed Apr 21, 2019
1 parent ce47c48 commit 3b9d4a7
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 14 deletions.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2019 Rich Rancy

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ If you so choose, you may even have your bot use different programming languages
## Getting started
This library features several important crates to help you get started.

[Spedctacles Brokers](brokers/) - Message brokers which allow for powerful communication between services.
[Spectacles Client](client/) - A standalone binary for Spectacles, which includes a Discord gateway and an event publishing system.

[Spectacles Gateway](gateway/) - A Spectacles gateway implementation for Discord with enables stateless sharding.
Expand Down
1 change: 1 addition & 0 deletions brokers/src/amqp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl AmqpBroker {
/// })
/// ```
///
pub fn consume(&self, evt: &str) -> AmqpConsumer {
let (tx, rx) = unbounded();
let exch_opts = ExchangeDeclareOptions {
Expand Down
12 changes: 3 additions & 9 deletions brokers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
//! let result = connect.and_then(|broker| {
//! let json = r#"{"message": "Example Publish."}"#.as_bytes();
//! broker.publish("HELLO", json.to_vec())
//! });
//! let success = result.map(|_| {
//! }).map(|_| {
//! println!("Message publish succeeded, check the other window!");
//! }).map_err(|err| {
//! eprintln!("An error was encountered during publish: {}", err);
//! });
//!
//! tokio::run(success);
//! tokio::run(result);
//! }
//! ```
//!
Expand All @@ -38,9 +37,4 @@ pub use errors::Error;

mod errors;
/// Utilities for interfacing with an AMQP-based message broker.
pub mod amqp;

/// Event handler for receiving messages from a message brokers.
pub trait MessageHandler {
fn on_message(&self, event: &str, payload: String);
}
pub mod amqp;
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ parking_lot = "0.7.1"
hyper = "0.12.25"
clap = "2.32.0"
toml = "0.4.10"
pretty_env_logger = "0.3.0"
tokio = "0.1.16"
env_logger = "0.6.1"
log = "0.4.6"
kankyo = "0.2.0"
futures = "0.1.25"
Expand Down
2 changes: 1 addition & 1 deletion client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main () {
std::env::set_var("RUST_LOG", "INFO");
};
let _ = kankyo::load();
env_logger::init();
pretty_env_logger::init_timed();

match argv::get_args().subcommand() {
("shard", Some(matches)) => {
Expand Down
9 changes: 7 additions & 2 deletions gateway/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,17 @@ impl ShardManager {
};
},
ShardAction::Reconnect => {
info!("[Shard {}] Reconnection successful.", shard.lock().info[0]);
let sd = Arc::clone(&shard);
tokio::spawn(shard.lock().reconnect().map(move |_| {
info!("[Shard {}] Reconnection successful.", sd.lock().info[0]);
}).map_err(|err| {
error!("Shard failed to reconnect to the gateway. {}", err);
}));
},
ShardAction::Resume => {
let sd = Arc::clone(&shard);
tokio::spawn(shard.lock().resume().map(move |_| {
debug!("[Shard {}] Successfully resumed session.", sd.lock().info[0]);
info!("[Shard {}] Successfully resumed session.", sd.lock().info[0]);
}).map_err(|err| {
error!("Shard failed to resume session. {}", err);
}));
Expand Down
2 changes: 1 addition & 1 deletion rest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub struct RestClient {
pub token: String,
/// The base URL of the client. This may be changed to accomodate an external proxy system.
pub base_url: String,
pub http: ReqwestClient,
http: ReqwestClient,
ratelimiter: Option<Arc<Mutex<Ratelimter>>>,
}

Expand Down

0 comments on commit 3b9d4a7

Please sign in to comment.