Update packages, migrate to Serenity 0.11

This commit is contained in:
Elnu 2022-04-25 10:33:45 -07:00
parent a388416945
commit edfb01d154
4 changed files with 265 additions and 231 deletions

View file

@ -49,7 +49,7 @@ async fn setSubmissionChannel(ctx: &Context, msg: &Message) -> CommandResult {
&ctx.http,
format!(
"Submission channel for **{}** set to <#{}>.",
msg.guild(&ctx).await.unwrap().name,
msg.guild(&ctx).unwrap().name,
msg.channel_id
),
)

View file

@ -10,7 +10,7 @@ use serenity::{
client::bridge::gateway::ShardManager,
framework::{standard::macros::group, StandardFramework},
http::Http,
model::{event::ResumedEvent, gateway::Ready},
model::{event::ResumedEvent, gateway::{Ready, GatewayIntents}},
prelude::*,
};
use tracing::{error, info};
@ -74,7 +74,7 @@ async fn main() {
let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment");
let prefix = env::var("PREFIX").expect("Expected a prefix in the environment");
let http = Http::new_with_token(&token);
let http = Http::new(&token);
// We will fetch your bot's owners and id
let (owners, _bot_id) = match http.get_current_application_info().await {
@ -93,7 +93,11 @@ async fn main() {
.group(&GENERAL_GROUP)
.unrecognised_command(commands::meta::unrecognised_command_hook);
let mut client = Client::builder(&token)
let intents = GatewayIntents::GUILD_MESSAGES
| GatewayIntents::DIRECT_MESSAGES
| GatewayIntents::MESSAGE_CONTENT
| GatewayIntents::GUILDS; // required for getting guild name like in setSubmissionChannel
let mut client = Client::builder(&token, intents)
.framework(framework)
.event_handler(Handler)
.await