initial
This commit is contained in:
parent
95ce2c7015
commit
7b8198aac0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "soundfx-rs"
|
||||
version = "0.1.0"
|
||||
authors = ["jude-lafitteIII <judewrs@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serenity = "0.8"
|
||||
sqlx = "0.3"
|
||||
dotenv = "0.15"
|
57
src/main.rs
Normal file
57
src/main.rs
Normal file
@ -0,0 +1,57 @@
|
||||
use serenity::{
|
||||
client::Client,
|
||||
framework::StandardFramework,
|
||||
prelude::{
|
||||
EventHandler, Context, TypeMapKey
|
||||
}
|
||||
};
|
||||
|
||||
use sqlx::{
|
||||
Pool,
|
||||
mysql::MySqlPool
|
||||
};
|
||||
|
||||
use dotenv::dotenv;
|
||||
|
||||
use std::env;
|
||||
|
||||
struct SQLPool;
|
||||
|
||||
impl TypeMapKey for SQLPool {
|
||||
type Value = Pool<MySqlConnection>;
|
||||
}
|
||||
|
||||
#[group]
|
||||
#[commands()]
|
||||
struct Commands;
|
||||
|
||||
// create event handler for bot
|
||||
struct Handler;
|
||||
|
||||
impl EventHandler for Handler {}
|
||||
|
||||
// entry point
|
||||
fn main() {
|
||||
dotenv();
|
||||
|
||||
let mut client = Client::new(&env::var("DISCORD_TOKEN").expect("Missing token from environment"), Handler).expect("Failed to create client");
|
||||
|
||||
client.with_framework(StandardFramework::new()
|
||||
.configure(|c| c.prefix("?"))
|
||||
.group(&GENERAL_GROUP));
|
||||
|
||||
{
|
||||
let mut data = client.data.write();
|
||||
|
||||
let pool = MySqlPool::new(env::var("DATABASE_URL"));
|
||||
|
||||
data.insert::<SQLPool>(pool);
|
||||
}
|
||||
|
||||
client.start().expect("Failed to start client");
|
||||
}
|
||||
|
||||
#[command]
|
||||
fn play() {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user