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
Ash
Discord Bot
Commits
81dffed2
Unverified
Commit
81dffed2
authored
Feb 04, 2020
by
tec
Browse files
A touch of clean-up
parent
d29b59eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main.rs
View file @
81dffed2
#[macro_use]
extern
crate
lazy_static
;
#[macro_use]
extern
crate
hex_literal
;
#[macro_use]
extern
crate
log
;
...
...
src/token_management.rs
View file @
81dffed2
use
chrono
::{
prelude
::{
SecondsFormat
,
Utc
},
DateTime
,
};
use
chrono
::{
prelude
::
Utc
,
DateTime
};
use
rand
::
Rng
;
use
serenity
::
model
::
user
::
User
;
use
std
::
str
;
lazy_static!
{
static
ref
key
:
[
u8
;
32
]
=
rand
::
thread_rng
()
.gen
::
<
[
u8
;
32
]
>
();
static
ref
KEY
:
[
u8
;
32
]
=
rand
::
thread_rng
()
.gen
::
<
[
u8
;
32
]
>
();
}
fn
encrypt
(
plaintext
:
&
str
)
->
&
str
{
...
...
src/user_management.rs
View file @
81dffed2
...
...
@@ -50,9 +50,8 @@ impl Commands {
.map
(|
member
|
new_member
(
&
ctx
,
member
))
);
}
pub
fn
register
(
ctx
:
Context
,
msg
:
Message
,
content
:
&
str
)
{
let
name
=
content
;
if
name
.len
()
<=
0
{
pub
fn
register
(
ctx
:
Context
,
msg
:
Message
,
account_name
:
&
str
)
{
if
account_name
.len
()
<=
0
{
e!
(
"Error sending message: {:?}"
,
msg
.channel_id
...
...
@@ -64,13 +63,12 @@ impl Commands {
"Error sending message: {:?}"
,
// TODO convert to email
msg
.channel_id
.say
(
&
ctx
.http
,
generate_token
(
&
msg
.author
,
name
))
.say
(
&
ctx
.http
,
generate_token
(
&
msg
.author
,
account_
name
))
);
e!
(
"Error deleting register message: {:?}"
,
msg
.delete
(
ctx
));
}
pub
fn
verify
(
ctx
:
Context
,
msg
:
Message
,
content
:
&
str
)
{
let
token
=
content
;
match
parse_token
(
&
msg
.author
,
content
)
{
pub
fn
verify
(
ctx
:
Context
,
msg
:
Message
,
token
:
&
str
)
{
match
parse_token
(
&
msg
.author
,
token
)
{
Ok
(
name
)
=>
{
e!
(
"Unable to get member: {:?}"
,
...
...
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