Add auto-crop command
This commit is contained in:
parent
716ce0e06c
commit
e3b7a1b13e
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1100,7 +1100,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wynnrobot"
|
||||
version = "0.1.0"
|
||||
version = "0.9.1"
|
||||
dependencies = [
|
||||
"diesel 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
13
src/main.rs
13
src/main.rs
@ -46,8 +46,10 @@ impl EventHandler for Handler {
|
||||
wc_livefeed(msg);
|
||||
} else if msg.content.starts_with("wc!unlivefeed") {
|
||||
wc_unlivefeed(msg);
|
||||
} else if msg.content == "wc!info" {
|
||||
} else if msg.content == "wc!info" || msg.content == "wc!help" || msg.content == "wc!" {
|
||||
wc_info(msg);
|
||||
} else if msg.content.starts_with("wc!crop ") {
|
||||
wc_crop(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +234,7 @@ fn wc_unlivefeed(msg: Message) {
|
||||
let connection = establish_connection();
|
||||
|
||||
let channel_id = msg.channel_id.0 as i64;
|
||||
let num_deleted = diesel::delete(livefeedlisteners.filter(id.eq(channel_id)))
|
||||
diesel::delete(livefeedlisteners.filter(id.eq(channel_id)))
|
||||
.execute(&connection)
|
||||
.expect("Error deleting posts");
|
||||
|
||||
@ -242,10 +244,17 @@ fn wc_unlivefeed(msg: Message) {
|
||||
fn wc_info(msg: Message) {
|
||||
let guilds = serenity::http::get_current_user().unwrap().guilds().unwrap().len();
|
||||
msg.channel_id.say(format!("Developer: Wurst#1783
|
||||
Forum thread: https://forums.wynncraft.com/threads/discord-bot.212142/
|
||||
Version: {}
|
||||
Servers: {}", env!("CARGO_PKG_VERSION"), guilds)).unwrap();
|
||||
}
|
||||
|
||||
fn wc_crop(msg: Message) {
|
||||
let url = &msg.content[8..];
|
||||
let new_url = reqwest::get(&format!("https://wynncraft-autocrop.herokuapp.com/?url={}", url)).unwrap().text().unwrap();
|
||||
msg.channel_id.say(&new_url).unwrap();
|
||||
}
|
||||
|
||||
fn territory_livefeed() {
|
||||
use models::LivefeedListener;
|
||||
use schema::livefeedlisteners::dsl::*;
|
||||
|
Loading…
Reference in New Issue
Block a user