Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 695965f

Browse files
authored
Merge pull request #222 from jonas-schievink/fix-mini
Fix playbot-mini
2 parents 5425191 + 5ad7b68 commit 695965f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/bin/playbot.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,13 @@ fn main() {{
158158
/// Called when any user writes a public message
159159
fn handle_pubmsg(&mut self, from: &str, chan: &str, msg: &str) {
160160
if msg.starts_with(self.conn.current_nickname()) {
161-
let command = &msg[self.conn.current_nickname().len()..]
162-
.trim_left_matches(|ch| ch == ',' || ch == ':')
163-
.trim();
161+
let msg = &msg[self.conn.current_nickname().len()..];
162+
163+
if msg.len() <= 2 || !msg.starts_with(&[' ', ',', ':'] as &[char]) {
164+
return;
165+
}
166+
167+
let command = &msg[1..];
164168
info!("<{}> {}", from, command);
165169
self.handle_cmd(chan, command);
166170
}

0 commit comments

Comments
 (0)