The official rust implementation of the SpamProtectionBot API

Overview

SpamProtection-rs

Table of contents

About

SpamProtection-Rust 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/Intellivoid/SpamProtection-Rust" }

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...
🚀 Fast and 100% API compatible postcss replacer, built in Rust

🚀 Fast and 100% API compatible postcss replacer, built in Rust

A rust wrapper for the spam protection API
A rust wrapper for the spam protection API

SpamProtection-rs Table of contents About Supported Rust version Features How to use Credits License About This repo has been shifted to the official

A gui api explorer written in Rust.

Zzz - GUI Api platform Pronounced "Zees"; as in "catching some Z's". A pun on RESTful APIs. example URL: https://jsonplaceholder.typicode.com/todos/ T

Rust bindings for the Mattermost API

mattermost_api Rust bindings for the Mattermost API Installing Add the latest version to your Cargo.toml. Using Docs link. Developing Building Require

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

A powerful minecraft bedrock software written in Rust with a powerful Typescript plugin API.
A powerful minecraft bedrock software written in Rust with a powerful Typescript plugin API.

Netrex A powerful minecraft bedrock software written in RustLang. Why Netrex? It's written in Rust. Unique and straight to the point. Typescript Plugi

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

A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use.
A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use.

rs-cord A high-level Rust crate around the Discord API, aimed to be easy and straight-forward to use. Documentation • Crates.io • Discord Navigation M

Serenity is a Rust library for the Discord API
Serenity is a Rust library for the Discord API

serenity Serenity is a Rust library for the Discord API. View the examples on how to make and structure a bot. Serenity supports bot login via the use

Owner
Intellivoid
Software and services developed by student developer(s) for consumers and businesses.
Intellivoid
The official programming language of the Hasso Plattner Institute.

Die HPI Programmiersprache Die offizielle Programmiersprache des HPI. Anmerkung: Dieses Projekt soll niemanden beleidigen oder bloßstellen, alles bitt

null 7 Oct 22, 2023
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.

null 21 Jan 1, 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 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

Unofficial Discord Documentation 1 Sep 16, 2022
Notion Offical API client library for rust

Notion API client library for rust.

Jake Swenson 65 Dec 26, 2022
Rust lib for Scaleway API

Notes This Scaleway API Crate is created and maintained by Qovery and used in production in the Qovery Engine. This project relies on OpenAPI Generato

Qovery 5 Nov 10, 2022
An asynchronous Rust client library for the Hashicorp Vault API

vaultrs An asynchronous Rust client library for the Hashicorp Vault API The following features are currently supported: Auth AppRole JWT/OIDC Token Us

Joshua Gilman 59 Dec 29, 2022
Rust bindings for the KING OF TIME API

Rust bindings for the KING OF TIME API Example Prints if you are at work or not at work. $ cargo run --example tc -- status Record the time you start

Idein Inc. 2 Oct 11, 2021
A Rust API for D-Bus communication.

zbus A Rust API for D-Bus communication. The goal is to provide a safe and simple high- and low-level API akin to GDBus, that doesn't depend on C libr

Michael Murphy 2 Nov 6, 2021
A Discord bot for sending GeoGuessr challenge links that uses the GeoGuessr API written in rust.

GeoGuessr-bot-rs This is a simple implementation of a discord bot that send GeoGuessr-challenge links on demand. Features: Slash-commands Lightning-fa

Luukas Pörtfors 6 Nov 18, 2022