Host Telegram Bots at Glitch!

Do you know Telegram Messenger ?
If yes, You maybe want to create your own Telegram bots on it ;>

Don’t worry, Creating Telegram Bots is Legal.
You can also host it at glitch. Why no man?

First, Prepare these Modules:

  • Telegraf
    Yes, Only this package that you need, son.

Second, Create your First bot.

  1. Go to @botfather bot, Tap /start at Bottom, Then send /newbot, Then setup your bots like these screenshot below:

  2. Copy your Bot Token, and SHHHHH! Keep your bot token secret, Friend

  3. In Glitch, Create a NodeJS Project, then install telegraf package.

  4. Copy these code and Paste it at your main file:

//Load modules
const telegraf = require('telegraf')
//Create a Bot
const bot = new telegraf('<BOT TOKEN HERE>')

//Do something when start command was executed
bot.start(ctx => {
//Yes, you need callback son.

//Send a message when /start command has executed
ctx.reply('Hello, Human!');
})

//Launch the bot
bot.launch().then(() => {
        console.log("Logged as "+bot.context.botInfo.first_name)
        //If it's shows your bot name, Then try execute /start Command, Enjoy!
});

Hohoho! You think Only that? No dude, You can create another command:

//Create '/hello' command Trigger
bot.command('hello', ctx => {
 //There's no need slash.

 //Reply when /hello command was executed
  ctx.reply('Huzzah!');
})

Read the full docs of telegraf here

Need help for your Discord or Telegram bot? Feel free mention me at here / some post :wink:

Find me at Telegram: https://t.me/yonle

My Telegraf.js Bot: https://t.me/raining_robot

4 Likes

Fun Fact: You can also make Telegram bots via PHP :wink:

My friend know How to do it, But of course, I don’t know PHP. So better to Google it.

Special: If you know PHP, then you can make 24/7 Telegram bots with it! (Yes, that’s legal on glitch… Maybe?).

That fact would make @RiversideRocks very happy. :wink::slightly_smiling_face::joy:

4 Likes

Weeeeeeeeeeeeee :joy:

After user seeing this: MOVE TO TELEGRAM BOT

1 Like

Oh man, Glitch community must add telegraf help lol

1 Like

As a matter of fact, there is a small unofficial Telegram group for Glitch consisting of a very small number of people.

3 Likes

This is quite neat, thanks for the tutorial! I’ve considered using Telegram over discord as discord is a bit shady with privacy.

2 Likes

Telegram gives you waaaay to much privacy :lock_with_ink_pen:. I actually use it to send high sized files because Telegram doesn’t compress files. :joy:

3 Likes

Even bots can Helps you lol
I’m downloading 1.95 GB files at Telegram lol, Slow Download speed but BETTER STORAGE

3 Likes

i need help get with me on telegram @scamrillo