Code Monkey home page Code Monkey logo

grammy-on-deta-template's Introduction

Grammy Bot on Deta.sh Template

This is a template to deploy a telegram bot using grammY and deploy it on Deta using typescript

How to use

Click the Use this template button to have your copy, clone the newly generated repo locally and do your changes as you see fit.

Configuration

Step 1. Create a Deta Account and Install Deta cli locally

  • Create an account on Deta.
  • Install Deta CLI and the instructions found there.

Step 2. Get your Telegram bot token and your user ID

  • Create a telegram account if you don't have one. Then start a conversation with @BotFather and send the /newbot command. Save the token you receive somewhere safe, we'll use it later.

  • To get your user ID, talk to @GrammyOnDetaBot and send the /me command. Save your user id somewhere for later.

Step 3. Setting Up Environment Variables

Copy the .env.example file from this directory to .env (which will be ignored by Git):

cp .env.example .env

Then set each variable on .env:

  • BOT_TOKEN should be the bot token that you saved from step 2(required).

The resulting .env file should look like this:

BOT_TOKEN=...
  • ADMIN should be the the user ID that you saved from step 2(not required).

The resulting .env file should look like this:

BOT_TOKEN=...
ADMIN=...

Step 4. Run grammY in development mode

npm install
npm run dev
# or
yarn install
yarn dev

Your bot should be up and running on http://localhost:8080! If it doesn't work, post on GitHub discussions.

Create a Deta.sh micros

As of now, you have yet to link your local to a micros on Deta cloud:

npm run build
deta new -n
#or
yarn build
deta new -n

Deploy Your Local Project

To deploy your local project to Deta, simply run the deploy command:

npm run deploy
#or
yarn deploy

This will do 3 things for you:

  1. Clean your root folder of any build outputs
  2. Push your environment variables to Deta
  3. Deploy your app on Deta
  4. Clean your root folder of any build outputs again

That's all!!!

grammy-on-deta-template's People

Contributors

waptik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

grammy-on-deta-template's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.