-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.rs
22 lines (19 loc) · 800 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use urbit_chatbot_framework::{AuthoredMessage, Chatbot, Message};
fn respond_to_message(authored_message: AuthoredMessage) -> Option<Message> {
// If the message author has a name with more than 28 characters (therefore is a comet)
if authored_message.author.len() > 28 {
// Return a message that calls out the comet
return Some(
Message::new()
.add_mention(&format!("~{}", authored_message.author))
.add_text(" You have been noticed by the Anti Comet Defense League."),
);
}
if authored_message.author == "mocrux-nomdep" {}
// Otherwise do not respond to message
None
}
fn main() {
let chat_bot = Chatbot::new_with_local_config(respond_to_message, "~mocrux-nomdep", "test-93");
chat_bot.run();
}