Skip to content

Commit

Permalink
remove token and channel options
Browse files Browse the repository at this point in the history
  • Loading branch information
Gogs committed Jun 20, 2020
1 parent 7c9d310 commit cd4aec7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 35 deletions.
39 changes: 14 additions & 25 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,28 @@ impl Config {

let mut use_discord = false;

let discord_channel_id = match matches.value_of("channel") {
Some(channel) => {
let discord_channel_id = match env::var("DISCORD_CHANNEL_ID") {
Ok(channel) => {
use_discord = true;
channel.to_string()
},
None => match env::var("DISCORD_CHANNEL_ID") {
Ok(channel) => {
use_discord = true;
channel.to_string()
},
Err(_) => {
use_discord = false;
String::from("")
}
Err(_) => {
use_discord = false;
String::from("")
}
};

let discord_token = match matches.value_of("token") {
Some(value) => {
let discord_token = match env::var("DISCORD_TOKEN") {
Ok(value) => {
use_discord = true;
value.to_string()
},
None => match env::var("DISCORD_TOKEN") {
Ok(value) => {
use_discord = true;
value.to_string()
},
Err(_) => {
use_discord = false;
String::from("")
}
}
};
Err(_) => {
use_discord = false;
String::from("")
}
};


// Instantiate Offender HitCounter with Threshold of 10 packets.
let threshold: u32 = matches.value_of("threshold").unwrap_or("5").parse()
Expand Down
10 changes: 0 additions & 10 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ pub fn parse_args() -> clap::ArgMatches<'static> {
.long("discord")
.takes_value(false)
.help("Use discord bot to notify of scanning activity"))
.arg(clap::Arg::with_name("token")
.short("k")
.long("token")
.takes_value(true)
.help("Discord Bot Auth token (or set DISCORD_TOKEN env var"))
.arg(clap::Arg::with_name("channel")
.short("c")
.long("channel")
.takes_value(true)
.help("Discord Bot channel ID (or set DISCORD_CHANNEL_ID env var)" ))
.arg(clap::Arg::with_name("wait")
.short("w")
.long("wait")
Expand Down

0 comments on commit cd4aec7

Please sign in to comment.