Added (useless) add command
This commit is contained in:
parent
755e50739c
commit
6dc458af54
|
@ -1,2 +1,8 @@
|
||||||
# Fishy!
|
# Fishy!
|
||||||
A discord bot made for Question of the Day in Oceanland!
|
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!({
|
group!({
|
||||||
name: "general",
|
name: "general",
|
||||||
options: {},
|
options: {},
|
||||||
commands: [hello],
|
commands: [hello, add],
|
||||||
});
|
});
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -71,9 +71,23 @@ fn main() {
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
fn hello(ctx: &mut Context, msg: &Message) -> CommandResult {
|
fn hello(ctx: &mut Context, msg: &Message) -> CommandResult {
|
||||||
println!("Executing HELLO...");
|
println!("Executing command HELLO as \"{}\"", msg.content);
|
||||||
msg.reply(ctx, "Hello!")?;
|
msg.reply(ctx, "Hello!")?;
|
||||||
|
|
||||||
Ok(())
|
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