A rust wrapper for the spam protection API

Overview

SpamProtection-rs

Table of contents

About

This repo has been shifted to the official org of Intellivoid.

SpamProtection-rs is a Rust wrapper for Intellivoid SpamProtection API which uses the Reqwest library to make the request and serde to parse the json output.

This wrapper was made in focus of speed, reliability and memory safety.

Supported Rust version

At the time of development we used rustc version 1.53.0. Anything newer than this should work fine with the library unless if there were any syntax breaking changes included in future rust updates in which we will update our code to the latest standards.

Features

  • Easy to use
  • Looking up userID, PTID or username
  • Check if user is blacklisted due to specific flag
  • Check if user is a operator
  • Check if user is verified
  • Check if user is official
  • Check if user is a agent
  • Spam and ham prediction
  • Language prediction with probability

How to use

To use this library in your project you would need to add the below code to your Cargo.toml

[dependencies]
spamprotection = "0.1.0-2"

You can also use the git version of our library for newer improvements

[dependencies]
spamprotection = { git = "https://github.com/cyberknight777/spamprotection-rs" }

Here’s an example of how you can use the spamprotection library in your code

= env::args().collect(); let arg: String = args[1].parse().expect("invalid account"); /* Here's where we will start by declaring the info variable and assign it to the info module in spamprotection library which calls the full() method with given the arg variable as the value. info has several fields and subfields, in the below example we would be using .results and its subtype .results.attributes. */ let info = info::full(arg); // You can check if the user is blacklisted or not via this! if info.get_bl() { println!("This {} is blacklisted due to {} with the {} flag.\n", info.get_type(), info.get_bl_reason(), info.get_flag()); } else { println!("This {} is not blacklisted!\n", info.get_type()); } // You can also check if the user is a potential scammer or not! if info.get_potential() { println!("Beware! This {} is a potential spammer!!", info.get_type()); } ">
use spamprotection::info;
use std::env;

/* We would need to first to declare the spamprotection library with use declaration.
   We would also need to declare the env trait from std library as args variable will be collecting the arguments passed to the program.
*/

fn main()
{
    /* Here we will need to assign a Vector type to args variable to collect the arguments passed to program.
	 Then we will need to assign String type to arg variable to parse the arguments passed.
	 Alternatively you can use the commented code below too if you don't want an argument-based program.
	 You don't need to add quotes for userID, but you'll need to add quotes if you want to check with username.

	 let info = info::full(123456789);

    */

   /*
   You can also use a private_telegram_id (PTID) to get info
   Example:
   info::full("TEL-9b7ef46a550112edea3ba46220283b1bfd8feddd09b26888524ef7245947e97f-b105a169");
   */


    let args: Vec<String> = env::args().collect();
    let arg: String = args[1].parse().expect("invalid account");

    /* Here's where we will start by declaring the info variable and assign it to the info module in spamprotection library
	 which calls the full() method with given the arg variable as the value.

	 info has several fields and subfields, in the below example we would be using .results and its subtype .results.attributes.
    */
    let info = info::full(arg);

    // You can check if the user is blacklisted or not via this!

    if info.get_bl() {
	  println!("This {} is blacklisted due to {} with the {} flag.\n", info.get_type(), info.get_bl_reason(), info.get_flag());
    } else {
	  println!("This {} is not blacklisted!\n", info.get_type());
    }

    // You can also check if the user is a potential scammer or not!

    if info.get_potential() {
	  println!("Beware! This {} is a potential spammer!!", info.get_type());
    }

Check our examples directory for more info onto how you can use our library.

Credits

This project was inspired by SpamProtection-Go.

Thanks to everyone who helped us with this project.

License

This project is under the GPL-3.0 license.

You might also like...
A minimal discord api wrapper.

descord Descord is a discord api wrapper. Example use descord::prelude::*; #[tokio::main] async fn main() { let mut client = Client::new(

Modrinth API is a simple library for using, you guessed it, the Modrinth API in Rust projects

Modrinth API is a simple library for using, you guessed it, the Modrinth API in Rust projects. It uses reqwest as its HTTP(S) client and deserialises responses to typed structs using serde.

A repository full of manually generated hand curated JSON files, which contain the API Types that the Discord API returns.

Discord API Types A repository full of manually generated hand curated JSON files, which contain the API Types that the Discord API returns. Also did

dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle!

dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle (such as rewriting/refactroing your DM code).

FFI wrapper around cfitsio in Rust

rust-fitsio FFI wrapper around cfitsio in Rust Installation fitsio supports versions of cfitsio = 3.08. cfitsio must be compiled with reentrant suppo

Thin wrapper around starship.rs to format kakoune status line

kakship is just a thin wrapper around starship to format the status line of kakoune and is meant to be used with the included kakoune script kakship.kak.

A lightweight Discord wrapper made in Tauri

Discord-Tauri is a work in progress lightweight wrapper for Discord.

cargo-check This is a wrapper around cargo rustc

cargo-check This is a wrapper around cargo rustc -- -Zno-trans. It can be helpful for running a faster compile if you only need correctness checks. In

Provides a wrapper to deserialize clap app using serde.

clap-serde Provides a wrapper to deserialize clap app using serde. API Reference toml const CLAP_TOML: &'static str = r#" name = "app_clap_serde" vers

Owner
cyberknight777
Amateur android kernel developer & linux enthusiast
cyberknight777
Blazingly fast spam classification API built using Rocket Web Framework.

Telegram Antispam API Blazingly fast spam classification API built using Rocket Web Framework. Notes The classifier works in aggressive mode, it can s

Akshay Rajput 13 May 5, 2023
Executable memory allocator with support for dual mapping and W^X protection

jit-allocator A simple memory allocator for executable code. Use JitAllocator type to allocate/release memory and virtual_memory module functions to e

playX 5 Jul 5, 2023
Reverse engineering Vercel's bot protection

vercel-anti-bot Reverse engineering and analysis of Vercel's bot protection used on https://sdk.vercel.ai (and potentially more of their platforms). U

Levi 16 Aug 22, 2023
API wrapper for the tankerkönig api

tankerkoenig-rs API wrapper for the tankerkoenig-api written in rust. Gives you ready deserialized structs and a easy to use and strictly typed api. I

Jonathan 2 Feb 27, 2022
A Rust wrapper for the SponsorBlock API.

sponsor-block A Rust wrapper for the SponsorBlock API, which you can find complete documentation for here. Uses SponsorBlock data licensed under CC BY

Zacchary Dempsey-Plante 8 Nov 19, 2022
Wrapper library for utilizing DigitalOcean API v2 in Rust

doapi-rs Wrapper library for utilizing DigitalOcean API v2 in Rust Disclaimer This library is in alpha - it may do anything up to, and including, eati

Kevin K. 30 Nov 5, 2022
Autogenerated wrapper for the Telegram Bot API written in Rust.

An Elegant Rust Client for Telegram Bot API crates.io • docs.rs Table of contents Introduction Key Features Installation Getting Started Documentation

FerrisGram 22 Oct 29, 2022
A simple, fast and fully-typed JSPaste API wrapper for Rust

rspaste A simple, fast and fully-typed JSPaste API wrapper for Rust. aidak.tk » Installation Put the desired version of the crate into the dependencie

Aidak 2 May 17, 2022
A simple, yet feature-filled wrapper around the coqui-stt C API

A simple, yet feature-filled wrapper around the coqui-stt C API

0/0 56 Jan 3, 2023
A safe wrapper around Gamercade's raw Api.

gamercade-rs A safe wrapper around Gamercade's Raw Api. As the Raw Api requires using a lot of unsafe and hiding of values through different types (fo

null 1 Aug 23, 2022