diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..b829a6a --- /dev/null +++ b/cog.toml @@ -0,0 +1,28 @@ +pre_bump_hooks = [ + "echo {{version}}", + "cargo audit && cargo bump {{version}} && git add Cargo.toml && git commit -m \"chore(version): set cargo version to {{version}}\"", +] +post_bump_hooks = ["git push", "git push origin {{version}}"] + +[changelog] +path = "CHANGELOG.md" +template = "remote" +remote = "git.weebo.fr" +repository = "BotDiscord" +owner = "sandbox" +authors = [ + { username = "batleforc", signature = "Max" }, + { username = "max", signature = "Max" }, +] + +[bump_profiles] + +[packages] + +[git_hooks.commit-msg] +script = """#!/bin/sh +set -e +cargo fmt -v --all --check +cargo clippy +gitleaks protect --verbose --redact --staged +""" diff --git a/src/botv2/cmd/meme/mod.rs b/src/botv2/cmd/meme/mod.rs index a669103..611fd0d 100644 --- a/src/botv2/cmd/meme/mod.rs +++ b/src/botv2/cmd/meme/mod.rs @@ -1,3 +1,3 @@ -pub mod list; +pub mod answer; pub mod enable; -pub mod answer; \ No newline at end of file +pub mod list; diff --git a/src/botv2/cmd/ping.rs b/src/botv2/cmd/ping.rs index 09fc94e..7d8885c 100644 --- a/src/botv2/cmd/ping.rs +++ b/src/botv2/cmd/ping.rs @@ -1,11 +1,8 @@ -use crate::botv2::init::{Context,Error}; +use crate::botv2::init::{Context, Error}; /// Ping command -#[poise::command( - slash_command, - prefix_command, -)] +#[poise::command(slash_command, prefix_command)] pub async fn ping(ctx: Context<'_>) -> Result<(), Error> { ctx.say("Pong from framework!").await?; Ok(()) -} \ No newline at end of file +} diff --git a/src/botv2/domain/meme/mod.rs b/src/botv2/domain/meme/mod.rs index 5f77f8c..d925332 100644 --- a/src/botv2/domain/meme/mod.rs +++ b/src/botv2/domain/meme/mod.rs @@ -1,2 +1,2 @@ +pub mod answer; pub mod change_auto_meme; -pub mod answer; \ No newline at end of file diff --git a/src/db/concour.rs b/src/db/concour.rs index 92784d9..572c513 100644 --- a/src/db/concour.rs +++ b/src/db/concour.rs @@ -136,4 +136,19 @@ impl Concour { } Ok(concours) } + + pub async fn find_by_status(status: &ConcourStatus) -> Result, surrealdb::Error> { + let sql = format!("SELECT * FROM {} WHERE status = '{}'", CONCOUR, status); + let mut results = match DB.query(&sql).await { + Ok(results) => results, + Err(e) => { + return Err(e); + } + }; + let mut concours = Vec::new(); + while let Ok(Some(concour)) = results.take(0) { + concours.push(concour); + } + Ok(concours) + } } diff --git a/src/event/concour/mod.rs b/src/event/concour/mod.rs index e69de29..8b13789 100644 --- a/src/event/concour/mod.rs +++ b/src/event/concour/mod.rs @@ -0,0 +1 @@ + diff --git a/src/tracing/level.rs b/src/tracing/level.rs index d239625..fd313cd 100644 --- a/src/tracing/level.rs +++ b/src/tracing/level.rs @@ -48,7 +48,7 @@ impl Debug for VerboseLevel { } } -impl Display for VerboseLevel{ +impl Display for VerboseLevel { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::ERROR => write!(f, "ERROR"), @@ -58,4 +58,4 @@ impl Display for VerboseLevel{ Self::TRACE => write!(f, "TRACE"), } } -} \ No newline at end of file +} diff --git a/src/tracing/mod.rs b/src/tracing/mod.rs index a9caea8..9901e23 100644 --- a/src/tracing/mod.rs +++ b/src/tracing/mod.rs @@ -1,3 +1,3 @@ +pub mod init; pub mod level; pub mod tracing_kind; -pub mod init; \ No newline at end of file diff --git a/src/tracing/tracing_kind.rs b/src/tracing/tracing_kind.rs index 9323104..8f96081 100644 --- a/src/tracing/tracing_kind.rs +++ b/src/tracing/tracing_kind.rs @@ -16,5 +16,5 @@ pub struct Tracing { pub kind: TracingKind, pub name: String, pub level: VerboseLevel, - pub additional: HashMap + pub additional: HashMap, }