Running direct diesel sql query

This commit is contained in:
Benjamin Sherriff
2023-07-06 23:17:16 -04:00
parent 4a366d6237
commit 81b5cb4b32
4 changed files with 29 additions and 49 deletions

View File

@@ -4,6 +4,7 @@ use std::env;
use commands::audio::create_response;
use diesel::r2d2::{Pool, ConnectionManager};
use diesel::pg::PgConnection;
use dotenv::dotenv;
use log::{error, warn, info};
use serenity::async_trait;
@@ -18,6 +19,8 @@ use songbird::SerenityInit;
mod commands;
mod database;
pub const MIGRATIONS: diesel_migrations::EmbeddedMigrations = diesel_migrations::embed_migrations!("migrations");
struct Handler {
// Open AI Config
oai: Option<commands::oai::OAI>,
@@ -116,7 +119,7 @@ async fn main() {
};
let pool = database::establish_connection();
// database::run_migrations(&pool);
database::run_migrations(&pool);
let handler = match env::var("OPENAI_API_KEY") {
Ok(token) => {
@@ -135,9 +138,7 @@ async fn main() {
let mut client = Client::builder(token, intents)
.event_handler(handler)
.framework(StandardFramework::new()
.configure(|c| c
.owners(owners)
))
.configure(|c| c.owners(owners)))
.register_songbird()
.await
.expect("Error creating client");