feat: using teh vars from teh DB now
This commit is contained in:
parent
4998dba225
commit
0df7c8a29f
1 changed files with 19 additions and 20 deletions
39
src/main.rs
39
src/main.rs
|
@ -51,28 +51,27 @@ impl EventHandler for Handler {
|
||||||
if let Err(e) = new_member.add_roles(&ctx, &roles).await {
|
if let Err(e) = new_member.add_roles(&ctx, &roles).await {
|
||||||
println!("{:?}", e);
|
println!("{:?}", e);
|
||||||
}
|
}
|
||||||
} else if let Some(server_name) = new_member.guild_id.name(&ctx) {
|
} else {
|
||||||
let ulwolves_link = "";
|
|
||||||
let mut bot_channel = String::new();
|
|
||||||
|
|
||||||
if let Ok(channels) = new_member.guild_id.channels(&ctx).await {
|
|
||||||
if let Some(channel) = channels.values().find(|c| c.name == "bot-commands") {
|
|
||||||
bot_channel = channel.id.to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let bot_channel_message = match bot_channel.is_empty() {
|
|
||||||
true => "go to the bot channel".to_string(),
|
|
||||||
false => format!("go to https://discord.com/channels/{}/{}", new_member.guild_id, bot_channel),
|
|
||||||
};
|
|
||||||
|
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"Welcome {} to the {} server! \n\
|
r#"
|
||||||
Sign up on [UL Wolves]({}) and {} and use ``/link_wolves`` to get full access",
|
Welcome {} to the {} server!
|
||||||
new_member.display_name(),
|
Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use ``/link_wolves`` to get full access.
|
||||||
server_name,
|
"#,
|
||||||
ulwolves_link,
|
new_member.display_name(),
|
||||||
bot_channel_message
|
&config.server_name,
|
||||||
|
&config.wolves_link,
|
||||||
|
&config.server,
|
||||||
|
&config.bot_channel_id
|
||||||
);
|
);
|
||||||
|
// let msg = format!(
|
||||||
|
// "Welcome {} to the {} server! \n\
|
||||||
|
// Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use ``/link_wolves`` to get full access.",
|
||||||
|
// new_member.display_name(),
|
||||||
|
// &config.server_name,
|
||||||
|
// &config.wolves_link,
|
||||||
|
// &config.server,
|
||||||
|
// &config.bot_channel_id
|
||||||
|
// );
|
||||||
|
|
||||||
if let Err(err) = new_member.user.direct_message(&ctx, |m| m.content(&msg)).await {
|
if let Err(err) = new_member.user.direct_message(&ctx, |m| m.content(&msg)).await {
|
||||||
dbg!(err);
|
dbg!(err);
|
||||||
|
|
Loading…
Reference in a new issue