| src | ||
| Cargo.toml | ||
| README.md | ||
Echobox
Echobox is a database of quotes. You put in a quote, it will return back a quote. The echobox is backed by a sqlite database.
Echobox was inspired by fivequestionmarks's !echobox command; accordingly, it is mainly intended for use in a tenquestionmarks module. However, this Echobox may not behave the same way the original does.
In particular, echo(&str) may return back the input quote (not sure if fivequestionmarks does this or not).
Usage
Command Line
cargo run "<quote>"
Notes
- The entire quote is one argument, so it needs to be quoted if there are spaces.
- Echobox uses the file
echobox.dbin the current working directory. There is currently not a way to change this.
Library
The Echobox type provides two constructors, Echobox::with_file(&str) and Echobox::with_connection(sqlite::Connection). Both of these will create the database, including the single table, if it does not exist. The Echobox provides three methods, echo(&str) which inserts the input quote into the database and then returns a single random Quote from the database, put(&str) which inserts a quote, and get(i64) which returns a Vec<Quote> containing the requested number of random quotes.
The Quote struct represents a single quote from the echobox, and has id and content.