aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2019-02-18 02:04:29 -0500
committerNathan Perry <avaglir@gmail.com>2019-02-18 02:04:29 -0500
commit0b525cfe5b1d9999736c34d577da3a936e57c94c (patch)
tree763bf01ab4752af61d1bd02f7f8c86da88753b29
parent3d31b071ff9172018f40004d9c911ad33471cda4 (diff)
fix newline problem
-rw-r--r--src/commands/meme.rs19
-rw-r--r--src/main.rs2
2 files changed, 9 insertions, 12 deletions
diff --git a/src/commands/meme.rs b/src/commands/meme.rs
index eb2885f..9cba630 100644
--- a/src/commands/meme.rs
+++ b/src/commands/meme.rs
@@ -103,12 +103,11 @@ pub fn wat(_: &mut Context, msg: &Message, _: Args) -> Result<()> {
meme.map(|_| {})
}
-pub fn addmeme(_: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
+pub fn addmeme(_: &mut Context, msg: &Message, args: Args) -> Result<()> {
+ let mut args = Args::new(args.rest(), &[" ".to_owned(), "\n".to_owned(), "\t".to_owned()]);
+
let title = args.single_quoted::<String>()?;
- let text = match args.multiple_quoted::<String>() {
- Ok(text) => text.join(" "),
- Err(_) => "".to_owned(),
- };
+ let text = args.rest().to_owned();
let text = if text.is_empty() { None } else { Some(text) };
@@ -137,7 +136,9 @@ pub fn addmeme(_: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
msg.react("👌")
}
-pub fn addaudiomeme(_: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
+pub fn addaudiomeme(_: &mut Context, msg: &Message, args: Args) -> Result<()> {
+ let mut args = Args::new(args.rest(), &[" ".to_owned(), "\n".to_owned(), "\t".to_owned()]);
+
let title = args.single_quoted::<String>()?;
let audio_str = args.single_quoted::<String>()?;
@@ -186,11 +187,7 @@ pub fn addaudiomeme(_: &mut Context, msg: &Message, mut args: Args) -> Result<()
let mut audio_reader = ffmpeg_command.stdout.unwrap();
- let text = match args.multiple_quoted::<String>() {
- Ok(text) => text.join(" "),
- Err(_) => "".to_owned(),
- };
-
+ let text = args.rest().to_owned();
let text = if text.is_empty() { None } else { Some(text) };
let conn = connection()?;
diff --git a/src/main.rs b/src/main.rs
index 228ef30..b13137e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,6 @@
#![feature(impl_trait_in_bindings)]
#![feature(try_trait)]
+#![feature(pattern)]
extern crate chrono;
#[cfg(feature = "diesel")]
@@ -97,7 +98,6 @@ fn run() -> Result<()> {
.on_mention(false)
.owners(vec![UserId(owner_id)].into_iter().collect())
.case_insensitivity(true)
- .delimiter("\n")
.delimiter("\t")
)
.before(|_ctx, message, cmd| {