Present application ID to discord
This commit is contained in:
parent
6729695714
commit
0dbe3272a9
|
|
@ -22,5 +22,5 @@ regex = "1.5.4"
|
|||
reqwest = "0.11.6"
|
||||
serde = "1.0.130"
|
||||
serde_json = "1.0.69"
|
||||
serenity = { version = "0.10", features = [ "collector" ] }
|
||||
serenity = { version = "0.10", features = [ "collector", "unstable_discord_api" ] }
|
||||
tokio = { version = "1.13.0", features = ["sync", "macros", "rt-multi-thread"] }
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ pub async fn prepare_client<T: 'static + EventHandler>(arguments: ArgMatches<'_>
|
|||
"Could not find an environment variable called DISCORD_TOKEN",
|
||||
);
|
||||
|
||||
let application_id: u64 = env::var("APPLICATION_ID").expect(
|
||||
"Could not find an application ID in the APPLICATION_ID environment variable, please provide one",
|
||||
).parse().expect("That wasn't a number");
|
||||
|
||||
let http = Http::new_with_token(&token);
|
||||
|
||||
let (owners, bot_id) = match http.get_current_application_info().await {
|
||||
|
|
@ -123,6 +127,7 @@ pub async fn prepare_client<T: 'static + EventHandler>(arguments: ArgMatches<'_>
|
|||
|
||||
let client = Client::builder(&token)
|
||||
.event_handler(event_handler)
|
||||
.application_id(application_id)
|
||||
.framework(framework)
|
||||
.await
|
||||
.expect("Error creating client!");
|
||||
|
|
|
|||
Loading…
Reference in New Issue