Skip to content
Snippets Groups Projects
Commit 37468824 authored by tec's avatar tec
Browse files

Merge branch 'betternickname' into 'master'

Better way of doing random nickname

See merge request !4
parents 2790347c 7b8b417a
Branches
1 merge request!4Better way of doing random nickname
Pipeline #179 failed with stages
in 2 minutes and 36 seconds
......@@ -40,6 +40,15 @@ pub fn new_member(ctx: &Context, mut new_member: Member) {
};
}
pub const RANDOM_NICKNAMES: &[&str] = &[
"The Big Cheese",
"The One and Only",
"The Exalted One",
"not to be trusted",
"The Scoundrel",
"A big fish in a small pond",
];
pub struct Commands;
impl Commands {
pub fn register(ctx: Context, msg: Message, account_name: &str) {
......@@ -74,18 +83,10 @@ impl Commands {
e!(
"Unable to edit nickname: {:?}",
member.edit(&ctx.http, |m| {
let mut rng = rand::thread_rng();
m.nickname(format!(
"{}, {}",
name,
[
"The Big Cheese",
"The One and Only",
"The Exalted One",
"not to be trusted",
"The Scoundrel",
"A big fish in a small pond",
][rng.gen_range(0, 5)]
RANDOM_NICKNAMES.choose(&mut rand::thread_rng())
));
m
})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment