Added (useless) add command

This commit is contained in:
Skye Bleed 2019-09-07 20:30:27 -05:00
parent 755e50739c
commit 6dc458af54
2 changed files with 22 additions and 2 deletions

View File

@ -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.

View File

@ -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(())
}