Added (useless) add command
This commit is contained in:
parent
755e50739c
commit
6dc458af54
|
@ -1,2 +1,8 @@
|
|||
# Fishy!
|
||||
A discord bot made for Question of the Day in Oceanland!
|
||||
|
||||
### Building
|
||||
Assuming you have [Rust](https://rust-lang.org) installed, a simple `cargo run` should build fishy and its dependancies.
|
||||
|
||||
### Usage
|
||||
The command syntax is simply `fishy TOKEN`, where TOKEN is the token for the bot you're running.
|
||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -11,7 +11,7 @@ use serenity::framework::standard::{
|
|||
group!({
|
||||
name: "general",
|
||||
options: {},
|
||||
commands: [hello],
|
||||
commands: [hello, add],
|
||||
});
|
||||
|
||||
use std::env;
|
||||
|
@ -71,9 +71,23 @@ fn main() {
|
|||
|
||||
#[command]
|
||||
fn hello(ctx: &mut Context, msg: &Message) -> CommandResult {
|
||||
println!("Executing HELLO...");
|
||||
println!("Executing command HELLO as \"{}\"", msg.content);
|
||||
msg.reply(ctx, "Hello!")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
fn add(ctx: &mut Context, msg: &Message) -> CommandResult {
|
||||
println!("Executing command ADD as \"{}\"", msg.content);
|
||||
let split: Vec<&str> = msg.content.split(" ").collect();
|
||||
if split.len() < 3 {
|
||||
msg.reply(ctx, "Please add a message!")?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let addition = &split[2..];
|
||||
msg.reply(ctx, format!("{}", addition.join(" ")))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue