|
@@ -8,12 +8,13 @@ extern crate serde_derive;
|
|
|
use std::fs::File;
|
|
|
use std::io::prelude::*;
|
|
|
use discord::{Discord, State};
|
|
|
-use discord::model::Event;
|
|
|
+use discord::model::{Event, ChannelId};
|
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
struct Config {
|
|
|
discord_token: String,
|
|
|
command_prefix: String,
|
|
|
+ command_channel: Option<u64>,
|
|
|
}
|
|
|
|
|
|
pub fn main() {
|
|
@@ -60,6 +61,13 @@ pub fn main() {
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
+ // ignore message outside of command channel
|
|
|
+ if let Some(channel_id) = config.command_channel {
|
|
|
+ if ChannelId(channel_id) != message.channel_id {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// reply to a command if there was one
|
|
|
let mut split = message.content.split_whitespace();
|
|
|
let first_word = split.next().unwrap_or("");
|