Commit 81dffed2 authored by tec's avatar tec

A touch of clean-up

parent d29b59eb
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate hex_literal;
#[macro_use]
extern crate log;
......
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 {
......
......@@ -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: {:?}",
......
Markdown is supported
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