diff --git a/src/config.rs b/src/config.rs index 0790fd8042775e68268ce93eb792fba29b59fcb2..5fc3bb7609b2223a34b248e2df3b244c263e1cd3 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,6 +21,8 @@ pub static TIEBREAKER_ROLE: u64 = 607509283483025409; pub static UNREGISTERED_MEMBER_ROLE: u64 = 608282247350714408; pub static REGISTERED_MEMBER_ROLE: u64 = 608282133118582815; +pub static COMMAND_PREFIX: &str = "!"; + pub static FOR_VOTE: &str = "ðŸ‘"; pub static AGAINST_VOTE: &str = "👎"; pub static ABSTAIN_VOTE: &str = "🙊"; diff --git a/src/main.rs b/src/main.rs index c14064f4b4b20497ca1ef8902ccdb43940bc7a46..e4c67b4c5e4dca7473dcccb40f6d5b6a3a44c60c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,7 +26,7 @@ impl EventHandler for Handler { // Event handlers are dispatched through a threadpool, and so multiple // events can be dispatched simultaneously. fn message(&self, ctx: Context, msg: Message) { - if msg.content.starts_with("!") { + if msg.content.starts_with(config::COMMAND_PREFIX) { let message_content: Vec<_> = msg.content[1..].splitn(2, ' ').collect(); match message_content[0] { "register" => { @@ -49,9 +49,14 @@ impl EventHandler for Handler { } "help" => { let mut message = MessageBuilder::new(); - message.push_line("Use !move <action> to make a circular motion"); - message - .push_line("Use !poll <proposal> to see what people think about something"); + message.push_line(format!( + "Use {}move <action> to make a circular motion", + config::COMMAND_PREFIX + )); + message.push_line(format!( + "Use {}poll <proposal> to see what people think about something", + config::COMMAND_PREFIX + )); e!( "Error sending message: {:?}", msg.channel_id.say(&ctx.http, message.build()) @@ -60,8 +65,10 @@ impl EventHandler for Handler { _ => { e!( "Error sending message: {:?}", - msg.channel_id - .say(&ctx.http, "Unrecognised command. Try !help") + msg.channel_id.say( + &ctx.http, + format!("Unrecognised command. Try {}help", config::COMMAND_PREFIX) + ) ); } }