late-submissions
Elnu 3 years ago
parent 9063017a48
commit 830ac6cb61

@ -343,11 +343,14 @@ async fn suggest(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
); );
// User::accent_colour is only available via the REST API // User::accent_colour is only available via the REST API
// If we just do msg.author.accent_colour here, we will get None // If we just do msg.author.accent_colour here, we will get None
let accent_color = ctx.http let accent_color = ctx
.http
.get_user(*msg.author.id.as_u64()) .get_user(*msg.author.id.as_u64())
.await.unwrap() .await
.unwrap()
.accent_colour; .accent_colour;
channel.send_message(&ctx.http, |m| { channel
.send_message(&ctx.http, |m| {
m.allowed_mentions(|am| { m.allowed_mentions(|am| {
am.empty_parse(); am.empty_parse();
am am
@ -355,10 +358,19 @@ async fn suggest(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
m.embed(|e| { m.embed(|e| {
let username = format!("{}#{}", msg.author.name, msg.author.discriminator); let username = format!("{}#{}", msg.author.name, msg.author.discriminator);
e.title("New suggestion"); e.title("New suggestion");
e.description(format!("{}\n\n[See original message]({}) ({})", args.rest(), msg.link(), msg.guild(&ctx).unwrap().name)); e.description(format!(
"{}\n\n[See original message]({}) ({})",
args.rest(),
msg.link(),
msg.guild(&ctx).unwrap().name
));
let mut author = serenity::builder::CreateEmbedAuthor::default(); let mut author = serenity::builder::CreateEmbedAuthor::default();
author author
.icon_url(format!("https://cdn.discordapp.com/avatars/{}/{}.webp", msg.author.id, msg.author.avatar.as_ref().unwrap())) .icon_url(format!(
"https://cdn.discordapp.com/avatars/{}/{}.webp",
msg.author.id,
msg.author.avatar.as_ref().unwrap()
))
.name(username) .name(username)
.url(format!("https://discord.com/users/{}", msg.author.id)); .url(format!("https://discord.com/users/{}", msg.author.id));
e.set_author(author); e.set_author(author);

@ -67,11 +67,9 @@ async fn setSuggestionChannel(ctx: &Context, msg: &Message) -> CommandResult {
set_guild_data(guild_data); set_guild_data(guild_data);
msg.reply( msg.reply(
&ctx.http, &ctx.http,
format!( format!("Submission channel set to <#{}>.", msg.channel_id),
"Submission channel set to <#{}>.", )
msg.channel_id .await?;
),
).await?;
Ok(()) Ok(())
} }

@ -10,7 +10,10 @@ use serenity::{
client::bridge::gateway::ShardManager, client::bridge::gateway::ShardManager,
framework::{standard::macros::group, StandardFramework}, framework::{standard::macros::group, StandardFramework},
http::Http, http::Http,
model::{event::ResumedEvent, gateway::{Ready, GatewayIntents}}, model::{
event::ResumedEvent,
gateway::{GatewayIntents, Ready},
},
prelude::*, prelude::*,
}; };
use tracing::{error, info}; use tracing::{error, info};

Loading…
Cancel
Save