Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UCC
Discord Bot
Commits
f37c96d3
Unverified
Commit
f37c96d3
authored
Apr 04, 2020
by
tec
Browse files
Cope with users without avatars + minor log message reformatting
parent
fabad29e
Pipeline
#210
failed with stages
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/user_management.rs
View file @
f37c96d3
...
...
@@ -78,7 +78,7 @@ impl Commands {
&
ctx
.http
,
format!
(
"Usage: {}register <username>"
,
CONFIG
.command_prefix
)
);
return
return
;
}
if
RESERVED_NAMES
.contains
(
&
account_name
)
||
database
::
username_exists
(
account_name
)
{
send_message!
(
...
...
@@ -88,7 +88,7 @@ impl Commands {
.choose
(
&
mut
rand
::
thread_rng
())
.expect
(
"We couldn't get any sass"
)
);
return
return
;
}
if
!
ldap_exists
(
account_name
)
{
send_message!
(
...
...
@@ -99,7 +99,7 @@ impl Commands {
account_name
)
);
return
return
;
}
send_message!
(
msg
.channel_id
,
...
...
@@ -188,12 +188,12 @@ impl Commands {
}
{
Ok
(
member
)
=>
Some
(
member
),
Err
(
why
)
=>
{
warn!
(
"Could not find member {
:?}"
,
why
);
warn!
(
"Could not find member {
}, {:?}"
,
&
name
,
why
);
if
name
.len
()
!=
3
{
None
}
else
{
info!
(
"Searching for a profile for the TLA {}"
,
"Searching for a profile for the TLA
'
{}
'
"
,
&
name
.to_uppercase
()
);
match
database
::
get_member_info_from_tla
(
&
name
.to_uppercase
())
{
...
...
@@ -209,10 +209,10 @@ impl Commands {
&
ctx
.http
,
"Sorry, I couldn't find that profile (you need to !register for a profile)"
);
return
return
;
}
let
member
=
possible_member
.unwrap
();
info!
(
"Found matching profile
.
UCC username: {}"
,
&
member
.username
);
info!
(
"Found matching profile
,
UCC username: {}"
,
&
member
.username
);
let
result
=
msg
.channel_id
.send_message
(
&
ctx
.http
,
|
m
|
{
m
.embed
(|
embed
|
{
embed
.colour
(
serenity
::
utils
::
Colour
::
LIGHTER_GREY
);
...
...
@@ -224,7 +224,7 @@ impl Commands {
f
.text
(
&
user
.name
);
f
.icon_url
(
user
.static_avatar_url
()
.
expect
(
"Expected user to have avatar"
),
.
unwrap_or
(
String
::
from
(
"https://www.ucc.asn.au/logos/ucc-logo.png"
)
),
);
f
});
...
...
@@ -282,7 +282,7 @@ impl Commands {
m
})
.expect
(
"Failed to send usage help embed"
);
return
return
;
}
let
info_content
:
Vec
<
_
>
=
info
.splitn
(
2
,
' '
)
.collect
();
let
mut
property
=
String
::
from
(
info_content
[
0
]);
...
...
@@ -326,7 +326,7 @@ impl Commands {
m
})
.expect
(
"Failed to send usage embed"
);
return
return
;
}
let
mut
value
=
info_content
[
1
]
.to_string
();
...
...
@@ -343,7 +343,7 @@ impl Commands {
&
ctx
.http
,
"That ain't a URL where I come from..."
);
return
return
;
}
}
}
...
...
Write
Preview
Markdown
is supported
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