Skip to content

๐ŸŽญ 'Is Extremely Horny' meme generator bot for Telegram with more customization.

License

Notifications You must be signed in to change notification settings

MihailPreis/WhyDoYou-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿคก Why Do You Bot ๐Ÿคก

Is Extremely Horny meme generator server for TG bot with more customization.

Is Extremely Horny


๐Ÿค” Use

If bot is built with db function in groups/supergroups, you can use /help command to learn how to add your own images and audio.

Enjoy it ๐Ÿ‘‰here ๐Ÿ‘ˆ

๐Ÿ”ฎ Deploy

  1. Install Rust.

  2. Clone this repository.

  3. Create .env file with next tokens in root directory:

    TELOXIDE_TOKEN=<TG_BOT_TOKEN>
    WORDS=<COMMA_SEPARATED_TRIGGER_WORDS>
    DATABASE_URL=sqlite:<DB_FILE_NAME>.db
    LOG_FILE=<LOG_FILE_PATH>
    CONVERTER_URL=<URL_TO_CUSTOM_CONVERTER>
  4. Configure database:

    $ cargo install sqlx-cli
    $ export DATABASE_URL="sqlite:<DB_FILE_NAME>.db"
    $ sqlx db create
    $ sqlx migrate run
  5. Get dependencies with cargo:

    $ cd <path>/why_do_you_bot
    $ cargo build --features tg,db
  6. Run with cargo:

    $ cargo run --features tg,db -- --debug

    --debug - verbose logging flag

๐Ÿ™ˆ Custom converter

You can set url to custom converter in .env file. Converter needs a method that supports such a request:

curl --location --request POST 'http://<custom_url>/process' \
--form 'data=@"custom_picture.jpg"' \
--form 'audio=@"custom_music.mp3"'
  • data - required image binary.
  • audio - optional audio binary.

Method should return a binary video.

๐Ÿ™Š Add locales

Create <lang_code>.locale in assets/locale/ with next contents:

// example comment

"<key>" = "<value>";
"<key>" = "<value>";
"<key>" = "<value>
";
"<key>" = "
<value>
";
"<key>" = "
<value>";

๐Ÿ™‰ Implement new bot

You need a create new .rs file with bot realisation and use build_message from engine.rs. Example:

let message = "hi!"; // message from bot
let get_user_image = async move {
    return if <has user image> {
        // get user image in 'user_image'
        Some(user_image)
    } else {
        None
    };
};
let get_audio = async move {
    return if <get custom audio image> {
        Some(some_audio_vector)
    } else {
        None
    };
};
match build_message(message, get_user_image, get_audio).await {
    Ok(v_data) => match v_data {
        Video(video) => {
            // Send video with bot
            Ok(())
        }
        Image(image) => {
            // Send image with bot
            Ok(())
        }
    },
    Err(err) => {
        // Handling error (ex.: send message to user)
    }
}

Also need add new feature to Cargo.toml:

[features]
tg = ["teloxide"]
db = ["sqlx"]
my_new_bot_feature = []

Add new configuration statement in main.rs:

cfg_if::cfg_if! {
    if #[cfg(feature = "tg")] {
        async fn run() {
            use crate::bots::tg::run_tg_bot;
            run_tg_bot().await;
        }
    } else if #[cfg(feature = "my_new_bot_feature")] {
        async fn run() {
            // run await function
        }
    } else {
        async fn run() {
            println!("No selected feature");
        }
    }
}

  • License: ยฉ 2021 M.Price.
    See the LICENSE file for license rights and limitations (MIT).