Another emoji reaction bot(this one is for Discord)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 lines
801 B

#[macro_use]
extern crate diesel;
mod config;
mod framebuffer;
mod handler;
mod models;
mod program;
mod schema;
use crate::handler::Handler;
use diesel::{Connection, PgConnection};
use dotenv::dotenv;
use serenity::Client;
use std::env;
fn establish_connection() -> PgConnection {
dotenv().ok();
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
PgConnection::establish(&database_url).expect("Error connecting to database")
}
#[tokio::main]
async fn main() {
let config = config::get_conf();
let token = config.token;
let conn = establish_connection();
let mut client = Client::builder(&token)
.event_handler(Handler::new(conn))
.await
.expect("Error creating client");
if let Err(e) = client.start().await {
println!("Client error: {}", e);
}
}