Merge pull request #48 from Trivernis/develop

Update dependencies
develop v0.9.11
Julius Riegel 3 years ago committed by GitHub
commit 6479a44c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

537
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -3,7 +3,7 @@ members=["bot-coreutils", "bot-database", "."]
[package]
name = "tobi-rs"
version = "0.9.10"
version = "0.9.11"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"
@ -16,27 +16,27 @@ panic = 'abort'
bot-database = {path="./bot-database"}
bot-coreutils = {path="./bot-coreutils"}
serenity-rich-interaction = "0.2.6"
serenity = "0.10.9"
serenity = "0.10.10"
dotenv = "0.15.0"
serde_derive = "1.0.133"
serde = "1.0.133"
serde_derive = "1.0.136"
serde = "1.0.136"
thiserror = "1.0.30"
minecraft-data-rs = "0.4.1"
songbird = "0.2.1"
serde_json = "1.0.74"
rand = "0.8.4"
regex = "1.5.4"
minecraft-data-rs = "0.4.5"
songbird = "0.2.2"
serde_json = "1.0.79"
rand = "0.8.5"
regex = "1.5.5"
aspotify = "0.7.1"
lazy_static = "1.4.0"
futures = "0.3.19"
log = "0.4.14"
futures = "0.3.21"
log = "0.4.16"
fern = "0.6.0"
chrono = "0.4.19"
colored = "2.0.0"
sysinfo = "0.22.5"
reqwest = "0.11.8"
sysinfo = "0.23.8"
reqwest = "0.11.10"
chrono-tz = "0.6.1"
sauce-api = "0.9.1"
sauce-api = "0.9.3"
rustc_version_runtime = "0.2.1"
trigram = "0.4.4"
typemap_rev = "0.1.5"
@ -46,11 +46,11 @@ animethemes-rs = "0.3.0"
build-time = "0.1.1"
[dependencies.tokio]
version = "1.15.0"
version = "1.17.0"
features = ["macros", "rt-multi-thread"]
[dependencies.lavalink-rs]
git = "https://gitlab.com/vicky5124/lavalink-rs/"
rev = "61badd46"
rev = "2487c295"
features=["native", "serenity", "songbird", "normal-log"]
default-features = false
default-features = false

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.0-experimental
ARG QALCULATE_VERSION=3.22.0
ARG QALCULATE_VERSION=4.1.1
ARG DEBIAN_RELEASE=bullseye
FROM rust:slim-${DEBIAN_RELEASE} AS builder
@ -34,5 +34,5 @@ RUN apt install openssl libopus0 ffmpeg python3 python3-pip libpq5 pkg-config -y
COPY --from=qalculate-builder /tmp/qalculate/* /usr/bin/
COPY --from=builder /tmp/tobi/tobi-rs .
RUN pip3 install youtube-dl
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN rm -rf /var/lib/{apt,dpkg,cache,log}/ /var/cache
ENTRYPOINT ["/tobi-rs"]

@ -7,8 +7,8 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = {version = "1.15.0", features = ["process", "io-util"]}
log = "0.4.14"
tokio = { version = "1.17.0", features = ["process", "io-util"] }
log = "0.4.16"
url = "2.2.2"
mime_guess = "2.0.3"
rand = "0.8.4"
mime_guess = "2.0.4"
rand = "0.8.5"

@ -10,8 +10,8 @@ edition = "2018"
dotenv = "0.15.0"
chrono = "0.4.19"
thiserror = "1.0.30"
diesel = {version="1.4.8", features=["postgres", "r2d2", "chrono"]}
log = "0.4.14"
diesel = { version = "1.4.8", features = ["postgres", "r2d2", "chrono"] }
log = "0.4.16"
diesel_migrations = "1.4.0"
r2d2 = "0.8.9"
tokio-diesel = {git = "https://github.com/Trivernis/tokio-diesel"}
tokio-diesel = {git = "https://github.com/Trivernis/tokio-diesel"}

@ -18,12 +18,15 @@ impl Database {
}
/// Returns a list of gifs by assigned category
pub async fn get_media_by_category(&self, category: &str) -> DatabaseResult<Vec<Media>> {
pub async fn get_media_by_category<S: AsRef<str> + 'static>(
&self,
category: S,
) -> DatabaseResult<Vec<Media>> {
use media::dsl;
log::debug!("Searching for gifs in category '{}'", category);
log::debug!("Searching for gifs in category '{}'", category.as_ref());
let gifs: Vec<Media> = dsl::media
.filter(dsl::category.eq(category))
.filter(dsl::category.eq(category.as_ref()))
.load_async::<Media>(&self.pool)
.await?;
Ok(gifs)

@ -21,13 +21,13 @@ async fn pain(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
let pain_type = args.message().to_lowercase();
let database = get_database_from_context(ctx).await;
let mut media = database
.get_media_by_category(format!("{}{}", CATEGORY_PREFIX, pain_type).as_str())
.get_media_by_category(format!("{}{}", CATEGORY_PREFIX, pain_type))
.await?;
if media.is_empty() {
log::debug!("No media found for pain {}. Using 404", pain_type);
media = database
.get_media_by_category(format!("{}{}", CATEGORY_PREFIX, NOT_FOUND_PAIN).as_str())
.get_media_by_category(format!("{}{}", CATEGORY_PREFIX, NOT_FOUND_PAIN))
.await?;
}

@ -1,12 +1,12 @@
use std::process;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use std::time::Duration;
use chrono::Duration as ChronoDuration;
use serenity::framework::standard::macros::command;
use serenity::framework::standard::CommandResult;
use serenity::model::channel::Message;
use serenity::prelude::*;
use sysinfo::{ProcessExt, SystemExt};
use sysinfo::{Pid, PidExt, ProcessExt, SystemExt};
use crate::commands::common::handle_autodelete;
use crate::utils::context_data::{get_database_from_context, MusicPlayers};
@ -22,8 +22,7 @@ async fn stats(ctx: &Context, msg: &Message) -> CommandResult {
system.refresh_all();
let kernel_version = system.kernel_version().unwrap_or("n/a".to_string());
//system.refresh_process(process::id() as i32);
let own_process = system.process(process::id() as i32).unwrap();
let own_process = system.process(Pid::from_u32(process::id())).unwrap();
let memory_usage = own_process.memory();
let cpu_usage = own_process.cpu_usage();
let thread_count = own_process.tasks.len();

@ -37,7 +37,11 @@ mod theme;
pub struct Weeb;
/// Posts a random media entry with the given category
async fn post_random_media(ctx: &Context, msg: &Message, category: &str) -> CommandResult {
async fn post_random_media<S: AsRef<str> + 'static>(
ctx: &Context,
msg: &Message,
category: S,
) -> CommandResult {
let database = get_database_from_context(ctx).await;
let media = database.get_media_by_category(category).await?;
let gif = media

@ -26,9 +26,7 @@ impl StoreData {
env::var("SAUCENAO_API_KEY").expect("No SAUCENAO_API_KEY key in environment."),
);
Self {
minecraft_data_api: minecraft_data_rs::api::Api::new(
minecraft_data_rs::api::versions::latest_stable().unwrap(),
),
minecraft_data_api: minecraft_data_rs::api::Api::latest().unwrap(),
spotify_api: SpotifyApi::new(),
sauce_nao,
}

Loading…
Cancel
Save