Use Serenity from Poise package directly

This commit is contained in:
toast 2024-03-21 09:03:09 +11:00
parent ee9143ef0a
commit 62f62c674f
3 changed files with 5 additions and 39 deletions

34
Cargo.lock generated
View File

@ -202,17 +202,6 @@ dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "command_attr"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f08c85a02e066b7b4f7dcb60eee6ae0793ef7d6452a3547d1f19665df070a9"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
@ -758,12 +747,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "levenshtein"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
[[package]]
name = "libc"
version = "0.2.153"
@ -1156,7 +1139,6 @@ dependencies = [
"cargo_toml",
"once_cell",
"poise",
"serenity",
"sysinfo",
"tempfile",
"tokio",
@ -1358,12 +1340,10 @@ dependencies = [
"bitflags 2.4.2",
"bytes",
"chrono",
"command_attr",
"dashmap",
"flate2",
"futures",
"fxhash",
"levenshtein",
"mime_guess",
"parking_lot",
"percent-encoding",
@ -1371,7 +1351,6 @@ dependencies = [
"secrecy",
"serde",
"serde_json",
"static_assertions",
"time",
"tokio",
"tokio-tungstenite",
@ -1379,7 +1358,6 @@ dependencies = [
"typemap_rev",
"typesize",
"url",
"uwl",
]
[[package]]
@ -1458,12 +1436,6 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
version = "0.10.0"
@ -1913,12 +1885,6 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
[[package]]
name = "uwl"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0"
[[package]]
name = "version_check"
version = "0.9.4"

View File

@ -7,7 +7,6 @@ edition = "2021"
cargo_toml = "0.19.2"
once_cell = "1.19.0"
poise = "0.6.1"
serenity = "0.12.1"
sysinfo = "0.30.7"
tempfile = "3.10.1"
tokio = { version = "1.36.0", features = ["macros", "signal", "rt-multi-thread"] }

View File

@ -1,12 +1,11 @@
mod commands;
mod internals;
use poise::serenity_prelude::{self as serenity};
use std::{
env::var,
error
};
use serenity::{
use poise::serenity_prelude::{
builder::{
CreateMessage,
CreateEmbed,
@ -15,6 +14,8 @@ use serenity::{
Context,
Ready,
ClientBuilder,
ChannelId,
Command,
GatewayIntents
};
@ -35,13 +36,13 @@ async fn on_ready(
.thumbnail(ready.user.avatar_url().unwrap_or_default())
.author(CreateEmbedAuthor::new(format!("{} is ready!", ready.user.name)).clone());
serenity::ChannelId::new(BOT_READY_NOTIFY).send_message(&ctx.http, message.add_embed(ready_embed)).await?;
ChannelId::new(BOT_READY_NOTIFY).send_message(&ctx.http, message.add_embed(ready_embed)).await?;
let register_commands = var("REGISTER_CMDS").unwrap_or_else(|_| String::from("true")).parse::<bool>().unwrap_or(true);
if register_commands {
let builder = poise::builtins::create_application_commands(&framework.options().commands);
let commands = serenity::Command::set_global_commands(&ctx.http, builder).await;
let commands = Command::set_global_commands(&ctx.http, builder).await;
match commands {
Ok(cmdmap) => for command in cmdmap.iter() {