From 414fdf78705d1950ec1c78dbb2f75d451a9956eb Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Fri, 22 Nov 2024 21:27:31 +0000 Subject: [PATCH] Fix example breakage due to Token changes --- Cargo.lock | 161 +++++++++++---------------- examples/advanced_cooldowns/main.rs | 4 +- examples/basic_structure/main.rs | 6 +- examples/event_handler/main.rs | 6 +- examples/feature_showcase/main.rs | 4 +- examples/fluent_localization/main.rs | 4 +- examples/invocation_data/main.rs | 4 +- examples/manual_dispatch/main.rs | 4 +- examples/quickstart/main.rs | 4 +- 9 files changed, 84 insertions(+), 113 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26c83ba661c3..909b111fa032 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,7 +38,7 @@ dependencies = [ "bytestring", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -82,7 +82,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -136,7 +136,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "to-arraystring", ] @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "shlex", ] @@ -209,9 +209,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -262,7 +262,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -273,7 +273,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -336,7 +336,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -370,9 +370,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -481,7 +481,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -636,9 +636,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", @@ -663,10 +663,10 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.16", + "rustls", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls", "tower-service", "webpki-roots", ] @@ -828,7 +828,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -906,9 +906,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" [[package]] name = "js-sys" @@ -921,9 +921,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.162" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "litemap" @@ -1100,7 +1100,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1120,9 +1120,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -1138,7 +1138,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls", "socket2", "thiserror 2.0.3", "tokio", @@ -1156,7 +1156,7 @@ dependencies = [ "rand", "ring", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls", "rustls-pki-types", "slab", "thiserror 2.0.3", @@ -1281,7 +1281,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.16", + "rustls", "rustls-pemfile", "rustls-pki-types", "serde", @@ -1289,7 +1289,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -1336,23 +1336,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls" -version = "0.23.16" +version = "0.23.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" dependencies = [ "once_cell", "ring", @@ -1459,14 +1445,14 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -1488,8 +1474,8 @@ dependencies = [ [[package]] name = "serenity" -version = "0.12.3" -source = "git+https://github.com/serenity-rs/serenity?branch=next#92960175452efe4b8795d8868488d96831607d31" +version = "0.12.4" +source = "git+https://github.com/serenity-rs/serenity?branch=next#46096e8cde0e49360fd739079f3054eb0ab17796" dependencies = [ "aformat", "arrayvec", @@ -1612,7 +1598,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1634,9 +1620,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -1645,9 +1631,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] @@ -1660,7 +1646,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1698,7 +1684,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1709,7 +1695,7 @@ checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1803,18 +1789,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", -] - -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio", + "syn 2.0.89", ] [[package]] @@ -1823,23 +1798,23 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.16", + "rustls", "rustls-pki-types", "tokio", ] [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "edc5f74e248dc973e0dbb7b74c7e0d6fcc301c694ff50049504004ef4d0cdcd9" dependencies = [ "futures-util", "log", - "rustls 0.22.4", + "rustls", "rustls-pki-types", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls", "tungstenite", "webpki-roots", ] @@ -1883,7 +1858,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -1909,9 +1884,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "18e5b8366ee7a95b16d32197d0b2604b43a0be89dc5fac9f8e96ccafbaedda8a" dependencies = [ "byteorder", "bytes", @@ -1920,7 +1895,7 @@ dependencies = [ "httparse", "log", "rand", - "rustls 0.22.4", + "rustls", "rustls-pki-types", "sha1", "thiserror 1.0.69", @@ -1951,7 +1926,7 @@ checksum = "0cbc2d8952dd1e08b0164a5b51549e80631ac9da4107669d26c8ea89cb0b5545" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "to-arraystring", ] @@ -1980,7 +1955,7 @@ checksum = "fd9fc0ad9e03a2b0c2e2a0eafaecccef2121829e1ab6ce9c9d790e6c6766bd1c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2009,9 +1984,9 @@ checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "untrusted" @@ -2021,9 +1996,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.3" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -2092,7 +2067,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "wasm-bindgen-shared", ] @@ -2126,7 +2101,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2172,9 +2147,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.6" +version = "0.26.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" dependencies = [ "rustls-pki-types", ] @@ -2341,7 +2316,7 @@ checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "synstructure", ] @@ -2363,7 +2338,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] [[package]] @@ -2383,7 +2358,7 @@ checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", "synstructure", ] @@ -2412,5 +2387,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.89", ] diff --git a/examples/advanced_cooldowns/main.rs b/examples/advanced_cooldowns/main.rs index 43026e389301..f6ef073326d9 100644 --- a/examples/advanced_cooldowns/main.rs +++ b/examples/advanced_cooldowns/main.rs @@ -38,7 +38,7 @@ async fn register_commands(ctx: Context<'_>) -> Result<(), Error> { #[tokio::main] async fn main() { - let token = std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN"); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let options = poise::FrameworkOptions { commands: vec![register_commands(), dynamic_cooldowns()], @@ -48,7 +48,7 @@ async fn main() { ..Default::default() }; - let client = serenity::Client::builder(&token, serenity::GatewayIntents::non_privileged()) + let client = serenity::Client::builder(token, serenity::GatewayIntents::non_privileged()) .framework(poise::Framework::new(options)) .await; diff --git a/examples/basic_structure/main.rs b/examples/basic_structure/main.rs index 7044454784dc..58f2c4089d46 100644 --- a/examples/basic_structure/main.rs +++ b/examples/basic_structure/main.rs @@ -5,7 +5,6 @@ mod commands; use poise::serenity_prelude as serenity; use std::{ collections::HashMap, - env::var, sync::{Arc, Mutex}, time::Duration, }; @@ -101,12 +100,11 @@ async fn main() { ..Default::default() }; - let token = var("DISCORD_TOKEN") - .expect("Missing `DISCORD_TOKEN` env var, see README for more information."); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged() | serenity::GatewayIntents::MESSAGE_CONTENT; - let client = serenity::ClientBuilder::new(&token, intents) + let client = serenity::ClientBuilder::new(token, intents) .framework(poise::Framework::new(options)) .data(Arc::new(Data { votes: Mutex::new(HashMap::new()), diff --git a/examples/event_handler/main.rs b/examples/event_handler/main.rs index 6afc50edd8c1..450f6f96d6e8 100644 --- a/examples/event_handler/main.rs +++ b/examples/event_handler/main.rs @@ -1,4 +1,3 @@ -use std::env::var; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; @@ -18,8 +17,7 @@ pub struct Data { async fn main() { env_logger::init(); - let token = var("DISCORD_TOKEN") - .expect("Missing `DISCORD_TOKEN` env var, see README for more information."); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged() | serenity::GatewayIntents::MESSAGE_CONTENT; @@ -28,7 +26,7 @@ async fn main() { ..Default::default() }; - let client = serenity::ClientBuilder::new(&token, intents) + let client = serenity::ClientBuilder::new(token, intents) .framework(poise::Framework::new(options)) .data(Arc::new(Data { poise_mentions: AtomicU32::new(0), diff --git a/examples/feature_showcase/main.rs b/examples/feature_showcase/main.rs index 379d0c69f929..b0dd0dbd0c8e 100644 --- a/examples/feature_showcase/main.rs +++ b/examples/feature_showcase/main.rs @@ -112,11 +112,11 @@ async fn main() { ..Default::default() }; - let token = std::env::var("DISCORD_TOKEN").unwrap(); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged() | serenity::GatewayIntents::MESSAGE_CONTENT; - let client = serenity::ClientBuilder::new(&token, intents) + let client = serenity::ClientBuilder::new(token, intents) .framework(poise::Framework::new(framework_options)) .await; diff --git a/examples/fluent_localization/main.rs b/examples/fluent_localization/main.rs index b9ed8d6daf5e..db8f89e35d73 100644 --- a/examples/fluent_localization/main.rs +++ b/examples/fluent_localization/main.rs @@ -71,7 +71,7 @@ async fn main() { translation::apply_translations(translations, &mut commands); - let token = std::env::var("TOKEN").unwrap(); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged(); let framework = poise::Framework::builder() @@ -81,7 +81,7 @@ async fn main() { }) .build(); - let client = serenity::ClientBuilder::new(&token, intents) + let client = serenity::ClientBuilder::new(token, intents) .data(Arc::new(Data { translations }) as _) .framework(framework) .await; diff --git a/examples/invocation_data/main.rs b/examples/invocation_data/main.rs index dda93ee0784b..4975344a1410 100644 --- a/examples/invocation_data/main.rs +++ b/examples/invocation_data/main.rs @@ -61,7 +61,7 @@ async fn register_commands(ctx: Context<'_>) -> Result<(), Error> { #[tokio::main] async fn main() { - let token = std::env::var("TOKEN").unwrap(); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged() | serenity::GatewayIntents::MESSAGE_CONTENT; @@ -119,7 +119,7 @@ async fn main() { ..Default::default() }; - let client = serenity::ClientBuilder::new(&token, intents) + let client = serenity::ClientBuilder::new(token, intents) .framework(poise::Framework::new(options)) .await; diff --git a/examples/manual_dispatch/main.rs b/examples/manual_dispatch/main.rs index 100c72663af3..63b0fb3eb8b8 100644 --- a/examples/manual_dispatch/main.rs +++ b/examples/manual_dispatch/main.rs @@ -51,7 +51,7 @@ impl serenity::EventHandler for Handler { #[tokio::main] async fn main() -> Result<(), Error> { - let token = std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN"); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged(); let mut handler = Handler { options: poise::FrameworkOptions { @@ -63,7 +63,7 @@ async fn main() -> Result<(), Error> { poise::set_qualified_names(&mut handler.options.commands); // some setup let handler = std::sync::Arc::new(handler); - let mut client = serenity::Client::builder(&token, intents) + let mut client = serenity::Client::builder(token, intents) .event_handler::(handler.clone()) .await?; diff --git a/examples/quickstart/main.rs b/examples/quickstart/main.rs index 8baa001b40a5..43be1bb44559 100644 --- a/examples/quickstart/main.rs +++ b/examples/quickstart/main.rs @@ -27,7 +27,7 @@ async fn register_commands(ctx: Context<'_>) -> Result<(), Error> { #[tokio::main] async fn main() { - let token = std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN"); + let token = serenity::Token::from_env("DISCORD_TOKEN").unwrap(); let intents = serenity::GatewayIntents::non_privileged(); let options = poise::FrameworkOptions { @@ -35,7 +35,7 @@ async fn main() { ..Default::default() }; - let client = serenity::ClientBuilder::new(&token, intents) + let client = serenity::ClientBuilder::new(token, intents) .framework(poise::Framework::new(options)) .await;