Unverified Commit b19d64b6 authored by tec's avatar tec

Make command prefix more easily variable

parent cf3d7abe
......@@ -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 = "🙊";
......
......@@ -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)
)
);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment