-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: revamp db, autorole add, autorole toggle
- Loading branch information
Showing
41 changed files
with
1,049 additions
and
594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"generate": { | ||
"description": "Generate a command function", | ||
"scope": "rust", | ||
"prefix": "cmd", | ||
"body": [ | ||
"use johnny::preludes::command::*;", | ||
"", | ||
"/// $3", | ||
"#[command(slash_command, category = \"$2\")]", | ||
"pub async fn $1(ctx: Context<'_>) -> Result<()> {", | ||
" Ok(())", | ||
"}" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"rust-lang.rust-analyzer" | ||
"rust-lang.rust-analyzer", | ||
"github.vscode-github-actions", | ||
"aaron-bond.better-comments" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
use johnny::load_command; | ||
|
||
load_command!(pride, pride); | ||
load_command!(pride | pride); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use super::{fetch_image, flag_autocomplete}; | ||
use johnny::preludes::command::*; | ||
use pride_overlay::{circle as circle_pride, Flags}; | ||
use std::{borrow::Cow, io::Cursor, str::FromStr}; | ||
|
||
/// Draw a circle with the colours of a pride flag around an image | ||
#[command(slash_command)] | ||
pub async fn circle( | ||
ctx: Context<'_>, | ||
#[description = "The flag to use"] | ||
#[autocomplete = "flag_autocomplete"] | ||
flag: String, | ||
#[description = "The file to apply the effect to"] attachment: Option<Attachment>, | ||
#[description = "The thickness of the ring"] thickness: Option<u8>, | ||
) -> Result<()> { | ||
ctx.defer().await?; | ||
|
||
let flag = Flags::from_str(&flag)?; | ||
let image = circle_pride( | ||
&mut fetch_image(&ctx, attachment).await?, | ||
flag.into(), | ||
thickness, | ||
); | ||
|
||
let mut bytes = vec![]; | ||
image.write_to(&mut Cursor::new(&mut bytes), image::ImageOutputFormat::Png)?; | ||
|
||
// send the image | ||
ctx.send(|msg| { | ||
msg.attachment(AttachmentType::Bytes { | ||
data: Cow::Borrowed(bytes.as_slice()), | ||
filename: "pride.png".into(), | ||
}) | ||
}) | ||
.await?; | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.