Giter Club home page Giter Club logo

awesomechatgptbot's Introduction

Free ChatGPT Telegram Bot with Multiple Providers support!

No APi-Key | Pre-Defiened Roles | Inline mode | Dan Mode v10



▋Change Log

[Last Status: Jun 17, 2024]: Fixed (FileNotFountError) in providers.json for old users!
See more logs here


▋Upcoming Features

  1. Smart reply: Reply to user's message to process them with GPT.
  2. Code generator: Use code generator to generate functions in many languages.
  3. Image generator: Use AI to generate images from prompt.
  4. similar question: Generate similar questions beside Re-Generate button
  5. Multi voice TTS: Add multiple TTS voices in multiple langugaes
  6. Voice response: Use Brian voice as your respone (DONE)
  7. Multiple models: Use multiple providers (DONE)
  8. Multiple language: Bot supports multiple languages for better communication. (Idea by chelaxian | Issue)

Multiple Providers

From now bot includes multiple providers (Thanks for gpt4free).
For responding, bot tries all providers one by one to respond and breaks the loop in first valid response. So you don't have to select provider. If non of providers worked, bot will tell you to generate your prompt again.
List of available providers:

  • FakeOpen Ai (uses model ChatGPT 3.5 Turbo)
  • Fstha Chat (uses model ChatGPT 3.5 Turbo)
  • DeepInfra AI (uses model Llama 2 70b Chat hf)
  • Online GPT (uses model ChatGPT 3.5 Turbo)
  • Free GPT 4 (uses ChatGPT 4)
  • GPT 4 Free (uses ChatGPT 4) gpt4free
  • Uncensored AI: (uses Llama 3 70b) You can send /settings command to bot to change these providers (Enable/Disable)

▋Bot is Down? Not working?

Since bot is supporting multiple providers now, you can use /ping to check which one is working.

Contributions

I welcome contributions. If you've found a reliable solution to this issue or have other useful suggestions, please consider contributing to this project.


▋Features

This bot responds to every message with ChatGPT AI and other models like llama, excluding commands.

  • Inline mode for obtaining predefined roles. How to use
  • The ability to remember chat history.
  • Multiple providers.
  • Voice response.
  • Provider settings (use /settings)

▋Clone Repository

To get started, first you need to clone this repository from github into your machine:

git clone https://github.com/Kourva/AwesomeChatGPTBot

if you dont have git or python you can install it from your package manager!


▋Install Requirements

Then you have to install requirements before running bot

  1. Navigate to bot directory
  2. Install requirements using pip
cd AwesomeChatGPTBot
pip install -r requirements.txt

This will install pyTelegamBotAPI and Requests for you, You can also install them manually if you got any error:

pip install pyTelegamBotAPI Requests

▋Configure your token

Now you have to create bot from BotFather (If you don't have) and get your Token to start working with your bot.
After getting Token from BotFather replace the Token in token.txt

0000000000:AAE7fbH29UPOKzlHlp0YDr9o06o_NdD4DBk

You can use editors like 'nano' or 'vim' in Termux or using echo command to write token to file:

echo "0000000000:AAE7fbH29UPOKzlHlp0YDr9o06o_NdD4DBk" > token.txt

This is just an example Token.


▋Configure the bot commands (Optional)

you can set your bot's commands manually or using 'init.py' script

python init.py

This will set up these commands in bot's menu

  • /start
  • /help
  • /ping
  • /chat
  • /features
  • /history
  • /reset
  • /danmode
  • /tts
  • /settings

▋Launch the bot

Now you are ready to launch your bot in polling mode inside your terminal using python

python main.py

You can also use proxychains to run your bot via Tor proxy

proxycahins python main.py

Or in quiet mode

proxychains -q python main.py

To install proxychains install proxychains-ng and then edit the config file in /etc/proxychains.conf.
It depends on you to use strict_chain or dynamic_chain. Config it by yourself.

▋TOR new IP address

If you got any denied requests that blocked your Ip address, you can renew your IP

sudo killall -HUP tor

And if you want to check your TOR status, use this command:

proxychains curl https://check.torproject.org/api/ip

▋Bot Inline Mode

Don't forget to enable Inline Mode in your bot.
See documentation here: https://core.telegram.org/bots/api#inline-mode


▋Thanks a bunch for starring the project! ⭐

If you have any suggestions or feedback, feel free to share. I appreciate your interest and contribution to the project!

Star History Chart

▋Full Change Log

[Jun 17, 2024] Fixed (FileNotFountError) in providers.json for old users!
[Jun 05, 2024] Added Uncensored AI!
[Apr 21, 2024] Added gpt4free client which have no issues operating with Cyrillic/Chinese symbols [Mar 14, 2024] Added /settings & /tts commands [Mar 14, 2024] Added voice response

/tts hi

[Mar 14, 2024] Added new chatGPT 4 provider
[Dec 22, 2023] Added Multiple Providers.
[Dec 22, 2023] Added /ping command to ping providers.
[Dec 22, 2023] Removed /setting command and setting files for users.
[Dec 22, 2023] Added more exception handlers for both Connection and Telegram API.
[Dec 01, 2023] Smarter Re-generate: Uses smarter way to re-generate replied question.
[Dec 01, 2023] Settings command: Added setting command to change bot response setting.
[Dec 01, 2023] Added titles.py: To make main code more clear.
[Dec 01, 2023] Error handling: Added more handlers and depp link handlers.
[Nov 13, 2023] PEP8 fixes: Fixed some PEP8 issues.
[Nov 13, 2023] Extra commands: Added help, features and chat commands.
[Nov 13, 2023] MarkdownV2: Added converter to convert regular markdown to Markdown V2.
[Nov 13, 2023] History management: Added utilities to check history and fix it when it got broken.
[Nov 13, 2023] Re-Generate: Users can re-generate their prompts, new answer will be raplaced with old one
[Nov 13, 2023] Improved chat handler: Users now requied to use /chat in groups to chat with bot.

/chat hi

This will avoid mess in replies and even reactions to bot's responses.

[Nov 01, 2023] History command: Added history section added (use /history to get history file)
[Nov 01, 2023] History reset: Added /reset command to reset the chat history.
[Nov 01, 2023] Dan mode v10: Added /danmode** command to enable/disable DAN mode v10.0 in bot.

Note: History will reset when using /danmode command!!

awesomechatgptbot's People

Contributors

dependabot[bot] avatar kourva avatar nikolay-kovalenko91 avatar

Stargazers

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

Watchers

 avatar  avatar

awesomechatgptbot's Issues

plans to add multi language support ?

in your previous mistakenly uploaded file titles.py i saw multiply languages variants.
do you plan to add some of them to settings for opportunity to change language of the bot?)

change Markdown in titles.py from ''' to '

Maybe you should use this code in title.py

"`\n@{} roles`\n"

insted of

"```\n@{} roles```\n"
# Help prompt for (/help) command:
help_message = (
    "*List of global commands*:\n"
    "1. /start: Start bot\n"
    "2. /help: Show this message\n"
    "3. /ping: Ping the Providers\n\n"
    "*List of chat related commands*:\n"
    "1. /reset: Reset chat history\n"
    "2. /history: Get chat history\n"
    "3. /chat: Chat in groups\n"
    "4. /danmode: Use DAN mode in GPT\n\n"
    "*Other commands*:\n"
    "1. /features: See feature changes\n\n"
    "*Inline usage*:"
    "`\n@{} roles`\n"
    "this will show all available roles.\n\n"
    "*Chat command usage*:\n"
    "```\n/chat hello world!```"
)

How can I use the bot in the group?

Hello, thank you to the creator of this source for providing the most unique source, I don't know how I can use the bot in the group, for example, ask a question in the group and the bot will answer it. Please help.

Not working

When sending any promt to bot bot reply :
That's and error! Try again.

/reset command not work

when type /reset i get:

Dear XXX
You need to start the bot before using it! We need to create an account for you first:
t.me/XXX_bot?start=create

is it ok?

Voice Input / Output

In new update i see you implement TTS - Voice Reply/Response (Output), but maybe would be better also implement reversed voice feature?
I mean, don't you think about adding Voice Recording/Recognition feature (Input) to allow users asking TG-bot with Voice Messeges?
Thanks. Yeah I know that most phones has Dictation feature that translates speach to text. But i think about reposting voices from another chat to TG-bot so i have option not to rewrite entire text and just repost voice. It may be helpfull too if you can repost not only text but also voice to trigger TG-bot to answer that.

references to feature -
https://github.com/n3d1117/chatgpt-telegram-bot
https://github.com/father-bot/chatgpt_telegram_bot

autoupdater

i created auto-updater for your project

crontab -e

0 4 * * * ~/updater_tg_gpt.sh

nano ~/updater_tg_gpt.sh

#!/bin/bash

# Find the AwesomeChatGPTBot directory
AWESOME_CHAT_GPT_BOT_PATH=$(find / -type d -name "AwesomeChatGPTBot" 2>/dev/null | awk '!seen[$0]++')

# Check if the directory was found
if [ -z "$AWESOME_CHAT_GPT_BOT_PATH" ]; then
    echo "Directory AwesomeChatGPTBot not found."
    exit 1
fi

# Define the backup config directory path
BACKUP_CONFIG_DIR=$(dirname "$AWESOME_CHAT_GPT_BOT_PATH")/BACKUP-CONFIG

# Create the backup config directory if it doesn't exist
mkdir -p "$BACKUP_CONFIG_DIR"

# Copy the token.txt file from the found directory to BACKUP-CONFIG
cp "$AWESOME_CHAT_GPT_BOT_PATH"/token.txt "$BACKUP_CONFIG_DIR"/

# Backup the Accounts directory and its contents
cp -R "$AWESOME_CHAT_GPT_BOT_PATH"/Accounts "$BACKUP_CONFIG_DIR"/

# Remove the old AwesomeChatGPTBot directory if it exists
if [ -d "$AWESOME_CHAT_GPT_BOT_PATH"-old ]; then
    rm -rf "$AWESOME_CHAT_GPT_BOT_PATH"-old
fi

# Backup current version of AwesomeChatGPTBot before updating
mv "$AWESOME_CHAT_GPT_BOT_PATH" "$AWESOME_CHAT_GPT_BOT_PATH"-old

# Clone the new version of AwesomeChatGPTBot from the repository
git clone https://github.com/Kourva/AwesomeChatGPTBot "$AWESOME_CHAT_GPT_BOT_PATH"

# Copy back the token.txt file
cp "$BACKUP_CONFIG_DIR"/token.txt "$AWESOME_CHAT_GPT_BOT_PATH"/

# Restore the Accounts directory from backup
cp -R "$BACKUP_CONFIG_DIR"/Accounts "$AWESOME_CHAT_GPT_BOT_PATH"/

# Change to the directory with the new version of AwesomeChatGPTBot
cd "$AWESOME_CHAT_GPT_BOT_PATH" || exit

# Provide permissions to the Accounts directory
chmod -R 777 Accounts/

# Run the initialization script
python3 init.py

# Restart the telegram_bot service
systemctl restart telegram_bot.service

chmod 777 ~/updater_tg_gpt.sh

Providers.json not found

Unknown Issue!

Log:
[Errno 2] No such file or directory: 'Accounts/621520367/providers.json'

This error come when I message to the bot.

Use webscout package

use webcsout package for more AI features and searching features in ur project

How can I create an image?

I had another question, how can I use the ability to generate photos? In the section about the robot's capabilities, it is mentioned that it can create a photos, but the method of creating them is not mentioned, I wanted to get help

Screenshot_20240121_203242_Telegraph

AttributeError: module 'titles' has no attribute 'welcome_2'

Hello! After last update I have error while run python code:

root@TG-GPT-bot:~/github/GPT/AwesomeChatGPTBot# python3 main.py 
The Bot is online (id: 6191756482) [Normal MODE]...
2023-12-03 17:19:21,313 (__init__.py:960 MainThread) ERROR - TeleBot: "Infinity polling exception: module 'titles' has no attribute 'welcome_2'"
2023-12-03 17:19:21,313 (__init__.py:962 MainThread) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 955, in infinity_polling
    self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout,
  File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1043, in polling
    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
  File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1118, in __threaded_polling
    raise e
  File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 1074, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 147, in raise_exceptions
    raise self.exception_info
  File "/usr/local/lib/python3.10/dist-packages/telebot/util.py", line 90, in run
    task(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/telebot/__init__.py", line 6801, in _run_middlewares_and_handler
    result = handler['function'](message)
  File "/root/github/GPT/AwesomeChatGPTBot/main.py", line 71, in start_command_handler
    text=titles.welcome_2.format(user.get_name)
AttributeError: module 'titles' has no attribute 'welcome_2'

I look into titles.py and there is NO text 'welcome_2'. i suppose you need to fix titles.py and add to it all missing attributes.

Gptbot (69?)

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

RU / Cyrillic lang NOT work

Thanks for the update!

New provider GPT-4 works with EN lang but when you use RU / Cyrillic lang - it answers with unreadable symbols like that:

>hi, who are you? can you draw a picture or analyze images?

Hello! I'm an AI language model developed by OpenAI, designed to assist with a wide range of questions and tasks by processing and generating text. I'm not able to draw pictures or directly analyze images, as my capabilities are focused on understanding and generating text-based content. However, I can certainly help describe techniques for drawing or analyzing images, provide insights based on descriptions of images, or assist with any other text-related inquiries you might have. If you have any questions or need assistance with something, feel free to ask!

>переведи на русский язык

ÐдÑавÑÑвÑйÑе! Я ÑвлÑÑÑÑ ÑзÑковой моделÑÑ Ð¸ÑкÑÑÑÑвенного инÑеллекÑа, ÑазÑабоÑанной OpenAI, пÑедназнаÑенной Ð´Ð»Ñ Ð¿Ð¾Ð¼Ð¾Ñи в ÑиÑоком ÑпекÑÑе вопÑоÑов и Ð·Ð°Ð´Ð°Ñ Ð¿ÑÑем обÑабоÑки и генеÑаÑии ÑекÑÑа. Я не Ð¼Ð¾Ð³Ñ ÑиÑоваÑÑ ÐºÐ°ÑÑинки или напÑÑмÑÑ Ð°Ð½Ð°Ð»Ð¸Ð·Ð¸ÑоваÑÑ Ð¸Ð·Ð¾Ð±ÑажениÑ, Ñак как мои возможноÑÑи ÑоÑÑедоÑоÑÐµÐ½Ñ Ð½Ð° понимании и Ñоздании ÑекÑÑового конÑенÑа. Тем не менее, Ñ Ð¾Ð¿Ñеделенно Ð¼Ð¾Ð³Ñ Ð¿Ð¾Ð¼Ð¾ÑÑ Ð¾Ð¿Ð¸ÑаÑÑ ÑеÑники ÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¸Ð»Ð¸ анализа изобÑажений, пÑедоÑÑавиÑÑ Ð¸Ð½ÑоÑмаÑÐ¸Ñ Ð½Ð° оÑнове опиÑаний изобÑажений или помоÑÑ Ñ Ð»ÑбÑми дÑÑгими вопÑоÑами, ÑвÑзаннÑми Ñ ÑекÑÑом. ÐÑли Ñ Ð²Ð°Ñ ÐµÑÑÑ Ð²Ð¾Ð¿ÑоÑÑ Ð¸Ð»Ð¸ вам нÑжна помоÑÑ Ñ Ñем-Ñо, не ÑÑеÑнÑйÑеÑÑ ÑпÑаÑиваÑÑ!

how to use Inline mode?

hello Mike!

thank you for such a good free project!
All works like a charm, but can you please instruct me how to use Inline mode with predefined roles?
I activated it in BotFather and when i start messege with tagging bot by its nickname like this @Kourva - telegram just adds text string with suggestion "Ask me", and when I type something - nothing happens.

can you please write a little guide in github README.md how to use Inline Roles with some examples.

Thank you!

Please add new free providers

Please add new free providers
(may be not totaly publicly free, but providers that require free api_key from discord like this provider - https://github.com/PawanOsman/ChatGPT - this is acceptable i think and is not too difficult to get one and add it in config file of this bot). thanks!

Now only 1 works and it is not as good as others were

Status for available providers:

**Deepinfra AI (LLAMA 70b):
status -> Online**

Fstha GPT (GPT 3.5 Turbo):
status -> Offline

Online GPT (GPT 3.5 Turbo):
status -> Offline

Fakeopen AI (GPT 3.5 Turbo):
status -> Offline

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.