Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grahame
Discord Bot
Commits
7b8b417a
Commit
7b8b417a
authored
Mar 25, 2020
by
Ash
Committed by
tec
Mar 25, 2020
Browse files
Better way of doing random nickname
parent
2790347c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/user_management.rs
View file @
7b8b417a
...
...
@@ -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
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment