Code Monkey home page Code Monkey logo

telegram-bot-gpt's Introduction

telegram-bot-gpt

Dibuat untuk memberikan sedikit sentuhan AI kepada Group Telegram UpKoding. Dengan bot ini saya (admin) bisa memerintahkan bot untuk membantu menjawab pertanyaan anggota apabila kebetulan saya tidak memiliki kompetensi di bidang yang ditanyakan.

Anggota group juga bisa berinteraksi langsung dengan bot secara privat, hampir sama seperti chatting dengan ChatGPT tetapi dengan bot telegram.

Powered by https://github.com/ekaputra07/telegram-bot a starting point to create your own Telegram bot with Elixir.

๐Ÿ‘‰ Development

A couple of helper scripts available under scripts/ to ease development on your local machine.

Working on the bot locally:

  1. Register your Bot using Telegram's @BotFather and get the token.

  2. Start ngrok on port 8080 by running ngrok http 8080 command. Ngrok will act as reverse proxy so Telegram could access your bot from the internet.

  3. Create .env file and fill with environment variables that we'll pass to the app:

    BOT_HOST=<your-ngrok-subdomain-here>.ngrok.io
    BOT_TOKEN=<your-bot-token-here>
    
  4. Start the bot with our helper script: ./script/dev. It will start an IEx shell (iex -S mix)

  5. Start developing.

You'll want to update the lib/bot.ex to suit your need (handle messages or making replies).

๐Ÿ‘‰ Deployment

It's up to you on how and where you want to deploy the bot. Here's how I deploy it to Fly.io as Docker container.

Prerequisites:

  • Make sure you have an account at Fly.io
  • Make sure you have fly CLI installed
  • Make sure you're logged-in using fly auth login

Deploy steps:

  1. Run fly launch and follow the steps (you only need to do this once and fly.toml file will be generated - see fly.toml.example)

  2. Set bot environment variable as secrets:

    fly secrets set BOT_HOST=<your-fly-io-appname>.fly.dev
    fly secrets set BOT_TOKEN=<your-bot-token>
    
  3. Run fly deploy to proceed with deployment.

Once finished, you will have the bot up and running and ready to accept messages.

๐Ÿ‘‰ Demo bot

Open this link t.me/ElixirDemoBot and send /ping message, it will reply with pong!

telegram-bot-gpt's People

Contributors

ekaputra07 avatar

Stargazers

Dede Mahendra avatar

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.