mirror of
https://github.com/mii443/rs-docker-bot.git
synced 2025-08-22 16:15:40 +00:00
remove serenity, add poise
This commit is contained in:
@ -21,12 +21,7 @@ strum = "0.24"
|
||||
strum_macros = "0.24"
|
||||
log = "0.4.0"
|
||||
env_logger = "0.9.0"
|
||||
|
||||
[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"
|
||||
poise = "0.6.1"
|
||||
|
||||
[dependencies.tokio]
|
||||
version = "1.0"
|
||||
|
@ -84,12 +84,7 @@ impl Container {
|
||||
attach_stdout: Some(true),
|
||||
attach_stdin: Some(true),
|
||||
attach_stderr: Some(true),
|
||||
cmd: Some(
|
||||
language
|
||||
.get_run_command(file_name)
|
||||
.split(" ")
|
||||
.collect(),
|
||||
),
|
||||
cmd: Some(language.get_run_command(file_name).split(" ").collect()),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
@ -188,11 +183,7 @@ impl Container {
|
||||
let tar_gz = File::create(&format!("code/{}.tar.gz", file_name)).unwrap();
|
||||
let encoder = GzEncoder::new(tar_gz, Compression::default());
|
||||
let mut tar = tar::Builder::new(encoder);
|
||||
tar.append_file(
|
||||
path.clone(),
|
||||
&mut f,
|
||||
)
|
||||
.unwrap();
|
||||
tar.append_file(path.clone(), &mut f).unwrap();
|
||||
tar.finish().unwrap();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bollard::{container::Config, service::HostConfig};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct Language {
|
||||
@ -9,7 +9,7 @@ pub struct Language {
|
||||
pub path: String,
|
||||
pub run_command: String,
|
||||
pub compile_command: Option<String>,
|
||||
pub image: String
|
||||
pub image: String,
|
||||
}
|
||||
|
||||
impl Language {
|
||||
|
21
src/main.rs
21
src/main.rs
@ -3,14 +3,15 @@ mod docker;
|
||||
mod event_handler;
|
||||
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 event_handler::Handler;
|
||||
use serenity::{
|
||||
framework::StandardFramework, http::Http,
|
||||
prelude::{GatewayIntents, TypeMapKey}, Client,
|
||||
};
|
||||
|
||||
struct ConfigStorage;
|
||||
|
||||
@ -61,11 +62,11 @@ async fn main() -> Result<(), ()> {
|
||||
GatewayIntents::MESSAGE_CONTENT
|
||||
| GatewayIntents::GUILD_MESSAGES
|
||||
| GatewayIntents::DIRECT_MESSAGES,
|
||||
)
|
||||
.framework(framework)
|
||||
.event_handler(Handler)
|
||||
.await
|
||||
.expect("Err creating client");
|
||||
)
|
||||
.framework(framework)
|
||||
.event_handler(Handler)
|
||||
.await
|
||||
.expect("Err creating client");
|
||||
|
||||
{
|
||||
let mut data = client.data.write().await;
|
||||
|
Reference in New Issue
Block a user