remove serenity, add poise

This commit is contained in:
mii443
2024-10-08 09:49:17 +00:00
parent 9f06cf201c
commit e82284281b
4 changed files with 18 additions and 31 deletions

View File

@ -21,12 +21,7 @@ strum = "0.24"
strum_macros = "0.24" strum_macros = "0.24"
log = "0.4.0" log = "0.4.0"
env_logger = "0.9.0" env_logger = "0.9.0"
poise = "0.6.1"
[dependencies.serenity]
default-features = true
features = ["builder", "cache", "client", "gateway", "model", "utils", "unstable_discord_api", "collector", "rustls_backend", "framework"]
git = "https://github.com/serenity-rs/serenity"
branch = "next"
[dependencies.tokio] [dependencies.tokio]
version = "1.0" version = "1.0"

View File

@ -84,12 +84,7 @@ impl Container {
attach_stdout: Some(true), attach_stdout: Some(true),
attach_stdin: Some(true), attach_stdin: Some(true),
attach_stderr: Some(true), attach_stderr: Some(true),
cmd: Some( cmd: Some(language.get_run_command(file_name).split(" ").collect()),
language
.get_run_command(file_name)
.split(" ")
.collect(),
),
..Default::default() ..Default::default()
}, },
) )
@ -188,11 +183,7 @@ impl Container {
let tar_gz = File::create(&format!("code/{}.tar.gz", file_name)).unwrap(); let tar_gz = File::create(&format!("code/{}.tar.gz", file_name)).unwrap();
let encoder = GzEncoder::new(tar_gz, Compression::default()); let encoder = GzEncoder::new(tar_gz, Compression::default());
let mut tar = tar::Builder::new(encoder); let mut tar = tar::Builder::new(encoder);
tar.append_file( tar.append_file(path.clone(), &mut f).unwrap();
path.clone(),
&mut f,
)
.unwrap();
tar.finish().unwrap(); tar.finish().unwrap();
} }

View File

@ -1,5 +1,5 @@
use bollard::{container::Config, service::HostConfig}; use bollard::{container::Config, service::HostConfig};
use serde::{Serialize, Deserialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Language { pub struct Language {
@ -9,7 +9,7 @@ pub struct Language {
pub path: String, pub path: String,
pub run_command: String, pub run_command: String,
pub compile_command: Option<String>, pub compile_command: Option<String>,
pub image: String pub image: String,
} }
impl Language { impl Language {

View File

@ -3,14 +3,15 @@ mod docker;
mod event_handler; mod event_handler;
mod language; mod language;
use std::{env, fs::File, io::Read, sync::{Arc, Mutex}}; use std::{
env,
fs::File,
io::Read,
sync::{Arc, Mutex},
};
use config::Config; use config::Config;
use event_handler::Handler; use event_handler::Handler;
use serenity::{
framework::StandardFramework, http::Http,
prelude::{GatewayIntents, TypeMapKey}, Client,
};
struct ConfigStorage; struct ConfigStorage;
@ -61,11 +62,11 @@ async fn main() -> Result<(), ()> {
GatewayIntents::MESSAGE_CONTENT GatewayIntents::MESSAGE_CONTENT
| GatewayIntents::GUILD_MESSAGES | GatewayIntents::GUILD_MESSAGES
| GatewayIntents::DIRECT_MESSAGES, | GatewayIntents::DIRECT_MESSAGES,
) )
.framework(framework) .framework(framework)
.event_handler(Handler) .event_handler(Handler)
.await .await
.expect("Err creating client"); .expect("Err creating client");
{ {
let mut data = client.data.write().await; let mut data = client.data.write().await;