Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
tropicbliss committed Nov 8, 2021
1 parent 2367093 commit a9fe67f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 28 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "buckshot"
version = "4.0.4"
version = "4.0.5"
authors = ["tropicbliss <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -18,6 +18,6 @@ reqwest = { version = "0.11", default_features = false, features = ["blocking",
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
structopt = "0.3"
tokio = { version = "1.12", features = ["fs", "macros", "rt-multi-thread"] }
tokio = { version = "1.13", features = ["fs", "macros", "rt-multi-thread"] }
tokio-native-tls = "0.3"
toml = "0.5"
4 changes: 4 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ pub struct Args {
/// An optional argument for specifying the name you want to snipe
#[structopt(short, long)]
pub name: Option<String>,

/// An optional argument for specifying the UNIX timestamp for name droptime
#[structopt(short, long)]
pub timestamp: Option<i64>
}

impl Args {
Expand Down
49 changes: 26 additions & 23 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod requests;
mod sockets;

use anyhow::{bail, Context, Result};
use chrono::{Duration, Local};
use chrono::{Duration, Local, TimeZone};
use console::style;
use std::{
io::{stdout, Write},
Expand Down Expand Up @@ -47,18 +47,19 @@ async fn main() -> Result<()> {
sleep(std::time::Duration::from_secs(20));
}
writeln!(stdout(), "Initialising...")?;
let droptime = match requestor
.check_name_availability_time(name)
.with_context(|| format!("Failed to get the droptime of {}", name))?
{
requests::DroptimeData::Available(droptime) => droptime,
requests::DroptimeData::Unavailable(error) => {
writeln!(
stdout(),
"{}",
style(format!("Failed to get the droptime of {}: {}", name, error)).red()
)?;
continue;
let droptime = if let Some(timestamp) = args.timestamp {
Local.timestamp(timestamp, 0)
} else {
match requestor.check_name_availability_time(name).with_context(|| format!("Failed to get the droptime of {}", name))? {
requests::DroptimeData::Available(droptime) => droptime,
requests::DroptimeData::Unavailable(error) => {
writeln!(
stdout(),
"{}",
style(format!("Failed to get the droptime of {}: {}", name, error)).red()
)?;
continue;
}
}
};
let formatted_droptime = droptime.format("%F %T");
Expand All @@ -76,16 +77,18 @@ async fn main() -> Result<()> {
.to_std()
.unwrap_or(std::time::Duration::ZERO);
sleep(sleep_duration);
if let requests::DroptimeData::Unavailable(error) = requestor
.check_name_availability_time(name)
.with_context(|| format!("Failed to get the droptime of {}", name))?
{
writeln!(
stdout(),
"{}",
style(format!("Failed to get the droptime of {}: {}", name, error)).red()
)?;
continue;
if args.timestamp.is_none() {
if let requests::DroptimeData::Unavailable(error) = requestor
.check_name_availability_time(name)
.with_context(|| format!("Failed to get the droptime of {}", name))?
{
writeln!(
stdout(),
"{}",
style(format!("Failed to get the droptime of {}: {}", name, error)).red()
)?;
continue;
}
}
}
let mut bearer_tokens = Vec::new();
Expand Down

0 comments on commit a9fe67f

Please sign in to comment.