iocompiler
TypeScript icon, indicating that this package has built-in type declarations

4.4.2 • Public • Published

Realtime Input/Output Compilers

by @PanditSiddharth

How to Setup

Step 1: Create Your Bot on Telegram
  1. Go to @BotFather on Telegram.
  2. Send the command /newbot to create a new bot.
  3. Follow the instructions to name your bot and create a username.
    • Send Name of your bot.
    • Now it will ask you to give username for your bot.
      • Username should endswith "bot" text and unique.
      • for example: sidkacompiler12bot .

You will receive a bot token and a bot link after completing these steps.

Step 2: Get Your telegram id Go to @MissRose_bot. Send command /info. You will see your id.

Main Setup Process

For termux
  • Go to fdroid website and Download latest version of Termux.
  • In termux Run these bellow written commands.
curl -O https://api.ignoux.in/iocompiler/termux.sh

chmod +x termux.sh

bash termux.sh

cd ~/compiler

node index.js
  • Follow each instructions of said by installer.
  • That's it your bot is running on termux. !Enjoy.
  • It will show you in red color warning ignore it your bot is runnig now.
For Linux and Windows Pre-requirements
  • Node.js installed on your system.
  • Optional: Install additional languages like C/C++, Python, Java, etc.
  1. Open PowerShell, Command Prompt, or your terminal.

  2. Create and navigate to a new directory for your project:

    mkdir compiler
    cd compiler
  3. Initialize a new Node.js project and install IOCompiler:

    npm init -y
    npm install iocompiler
  4. Create an index.js file and paste the following code. Replace process.env.BOT_TOKEN with your bot token from BotFather, and process.env.TELEGRAM_ID with your Telegram ID:

    const { compiler } = require('iocompiler');
    
    // Specify allowed users; without this, all users can access your bot
    const { bot } = compiler(process.env.BOT_TOKEN, { allowed: [1791106582, process.env.TELEGRAM_ID] });
    
    // Launching telegraf bot in polling mode
    bot.launch({ dropPendingUpdates: true });

For Developers for using this lib in those work:

let { compiler } = require('iocompiler');
let { Telegraf } = require("telegraf")

let bot = new Telegraf(process.env.BOT_TOKEN)

bot.on("message", (ctx, next) => {
  ctx.reply("I Got your message processing...")

    // Change incomming message for compilation
    ctx.update.message.text = "/js console.log('lol')"

    // Give update to next handler with updated text
    next(ctx)
})

  /*
  * ttl: max time to execute code, default 60 seconds
  * allowed: array of telegram ids of users who can execute code on it
  */
// allowed users id if you not give this then all users can use your bot
compiler(bot, { ttl: 60, allowed: [1791106582]});

// launching telegraf bot in polling mode
bot.launch({ dropPendingUpdates: true });
  1. Run the project:
    node index.js

That's it! You have successfully created your Telegram bot using IOCompiler.


Useful Commands

  • See all commands: /help
  • Check if bot is running: /ping
  • See current version and features of the bot: /version

For any queries, join our support groups:


GitHub: IOCompiler Repository
NPM: IOCompiler on NPM

For any other help:

Testing Group: IO_Coding
Contribute to the project or create your own bot—it's open source!

⚠️ Please run only in a secure environment

Using your bot, users can potentially harm your system. Utilize Docker or any secure environment, or specify allowed users via Telegram ID.


Package Sidebar

Install

npm i iocompiler

Weekly Downloads

45

Version

4.4.2

License

Apache-2.0

Unpacked Size

112 kB

Total Files

51

Last publish

Collaborators

  • panditsiddharth