{"id":19856349,"url":"https://github.com/joesiu/discord-chatbot","last_synced_at":"2025-05-02T01:31:30.663Z","repository":{"id":178017803,"uuid":"624117434","full_name":"JoeSiu/discord-chatbot","owner":"JoeSiu","description":"Another Discord chatbot that supports poe.com's ChatGPT bots and Hugging Face models","archived":false,"fork":false,"pushed_at":"2024-05-31T15:57:50.000Z","size":94,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T20:47:51.665Z","etag":null,"topics":["chatbot","chatgpt","discord","discord-bot","discord-py","gpt","hugging-face","huggingface"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoeSiu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-05T19:29:10.000Z","updated_at":"2024-07-18T18:43:45.000Z","dependencies_parsed_at":"2023-07-03T03:16:12.362Z","dependency_job_id":null,"html_url":"https://github.com/JoeSiu/discord-chatbot","commit_stats":null,"previous_names":["joesiu/discord-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeSiu%2Fdiscord-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeSiu%2Fdiscord-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeSiu%2Fdiscord-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoeSiu%2Fdiscord-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoeSiu","download_url":"https://codeload.github.com/JoeSiu/discord-chatbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251969424,"owners_count":21673201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatgpt","discord","discord-bot","discord-py","gpt","hugging-face","huggingface"],"created_at":"2024-11-12T14:15:18.544Z","updated_at":"2025-05-02T01:31:30.301Z","avatar_url":"https://github.com/JoeSiu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord ChatBot\n\n### Update: As the [Unoffical Poe API](https://github.com/ading2210/poe-api) had been archived and is not working, the Poe bot will not work now.\n\n## Description\n\nThe Discord ChatBot is a Python-based chatbot that supports following:\n\n- [Poe](https://poe.com/) bots (via [Unoffical API](https://github.com/ading2210/poe-api)), including `Sage`, `GPT-4`, `Claude+`, `Claude-instant`, `ChatGPT`, etc, as well as custom bots\n\n- All [Hugging Face conversational models](https://huggingface.co/models?pipeline_tag=conversational)\n\n## Demo\n\n![discord-chatbot](https://user-images.githubusercontent.com/38518793/230790942-98d55cb7-3fb3-4442-92b2-9b697ad086d0.gif)\n\n## Installation Instructions\n\nTo run the Discord ChatBot, follow these steps:\n\n### Setup\n\n1. Clone this repository using Git.\n2. Duplicate the `.env.example` file and rename it to `.env`. Replace each key with the corresponding values.\n3. Go to [Discord Developer Portal](https://discord.com/developers/applications) and create a new application.\n4. Create a bot and copy its token.\n5. Paste the token into the `DISCORD_TOKEN` field in the `.env` file.\n\n#### Environment Variables\n\n| Env variables      | Description                                                                                                                                                                                                                |\n| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| DISCORD_TOKEN      | Discord token, obtained from [https://discord.com/developers/applications](https://discord.com/developers/applications).                                                                                                   |\n| POE_TOKEN          | Poe token, should be the browser cookie for [https://poe.com](https://poe.com/), refer to [poe-api](https://github.com/ading2210/poe-api) repository for more details. Leave empty if you don't intend to use the Poe bot. |\n| POE_MODEL          | Default Poe bot (name), e.g., `Sage`, `GPT-4`, `Claude+`, `Claude-instant`, `ChatGPT`, etc. Leave empty if you don't intend to use the Poe bot.                                                                            |\n| POE_PROXY          | The default proxy. Leave empty if you don't intend to use the Poe bot or want to skip using a proxy.                                                                                                                       |\n| HUGGING_FACE_TOKEN | Hugging Face token, obtained from [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens). Leave empty if you don't intend to use the Hugging Face bot.                                           |\n| HUGGING_FACE_MODEL | Default Hugging Face model, refer to [Hugging Face conversational models](https://huggingface.co/models?pipeline_tag=conversational). Leave empty if you don't intend to use the Hugging Face bot.                         |\n| DEBUG              | Whether to use debug view. (Only used for Hugging Face chatbot)                                                                                                                                                            |\n| LOGGING_LEVEL      | Console logging level, default to INFO (20) if not provided                                                                                                                                                                |\n\n#### Poe\n\nTo use the Poe bot, follow the steps below:\n\n1. Refer to [poe-api guide](https://github.com/ading2210/poe-api#finding-your-token) to obtain your token.\n2. Update the `POE_TOKEN` field in the `.env` file.\n3. Set the `POE_MODEL` field to the desired model (e.g., `ChatGPT`).\n4. Optionally, set the `POE_PROXY` field for proxy settings.\n\n#### Hugging Face\n\nTo use the Hugging Face bot, follow the steps below:\n\n1. Obtain your Hugging Face API token from [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens).\n2. Set the `HUGGING_FACE_MODEL` field to the desired model. (Find the model from [https://huggingface.co/models?pipeline_tag=conversational](https://huggingface.co/models?pipeline_tag=conversational), then copy the model name, e.g., `facebook/blenderbot-3B`).\n\n### Run the program\n\n#### CLI\n\n1. Make sure you have [Python 3.10](https://www.python.org/downloads/release/python-3106/) installed.\n2. Run `pip install -r requirements.txt` to install the required dependencies, using python virtual environment is recommended.\n3. Run `python main.py` to start the bot.\n\n##### Available command arguments\n\nYou can also use the following command arguments:\n\n| Arugments                      | Description                                              | Options               |\n| ------------------------------ | -------------------------------------------------------- | --------------------- |\n| `--bot [str]`                  | Select the chatbot to use.                               | `poe`, `hugging-face` |\n| `--model [str]`                | Select the chatbot model to use.                         | Depends on bot        |\n| `--channel-monitor-mode [str]` | Select the channel monitor mode.                         | `all`, `none`         |\n| `--enable-name-prefix [bool]`  | Enable or disable prefixing user names to chat messages. | `True`, `False`       |\n\n#### Docker (Work in Progress)\n\nMake sure you have python and docker installed\n\n1. Make sure you have Docker installed.\n2. run `docker-compose build` to build the docker image.\n3. run `docker-compose up -d` to start the container.\n\n## Usage\n\n### Discord commands\n\n| Command                              | Description                                                                                                                                                                                                                               | Options               |\n| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |\n| `/send [str]`                        | Send a message to the chatbot. This command can bypass Discord's message limit for non-nitro users and allows messages up to 6000 characters in length.                                                                                   |                       |\n| `/send_to_channel [str]`             | Send a message to the chatbot on another channel, useful when multiple chatbots are monitoring the same channel. This command can bypass Discord's message limit for non-nitro users and allows messages up to 6000 characters in length. |                       |\n| `/clear-context`                     | Clear the current context of the chatbot.                                                                                                                                                                                                 |                       |\n| `/get-bot`                           | Returns the current bot being used.                                                                                                                                                                                                       |                       |\n| `/get-available-bot`                 | Returns the available bots.                                                                                                                                                                                                               |                       |\n| `/change-bot [str]`                  | Changes the current bot being used. If an invalid bot is specified, the available bot names will be shown.                                                                                                                                | `poe`, `hugging-face` |\n| `/reset-bot`                         | Resets the current bot to the default bot specified in .env.                                                                                                                                                                              |                       |\n| `/get-model`                         | Returns the current chatbot model being used.                                                                                                                                                                                             |                       |\n| `/get-available-model`               | Returns the current chatbot's available models.                                                                                                                                                                                           |                       |\n| `/change-model [str]`                | Changes the current chatbot model being used. If an invalid model is specified, the available model names will be shown.                                                                                                                  | Depends on the bot    |\n| `/reset-model`                       | Resets the current chatbot model to the default model specified in .env.                                                                                                                                                                  |                       |\n| `/change-token [str]`                | Changes the API token for the chatbot.                                                                                                                                                                                                    |                       |\n| `/reset-token`                       | Resets the API token for the chatbot to the default token specified in .env.                                                                                                                                                              |                       |\n| `/enable-channel-monitoring`         | Enables monitoring of the current channel, will add the current channel to whitelist if `channel-monitor-mode` is set to `none`.                                                                                                          |                       |\n| `/disable-channel-monitoring`        | Disable monitoring of the current channel.                                                                                                                                                                                                |                       |\n| `/get-channel-whitelist`             | Returns the channel whitelist.                                                                                                                                                                                                            |                       |\n| `/get-channel-blacklist`             | Returns the channel blacklist.                                                                                                                                                                                                            |                       |\n| `/get-channel-monitor-mode`          | Returns the current monitoring mode.                                                                                                                                                                                                      |                       |\n| `/change-channel-monitor-mode [str]` | Changes the current monitoring mode. If an invalid mode is specified, the available modes will be shown.                                                                                                                                  | `all`, `none`         |\n| `/enable-name-prefix`                | Enables prefixing the chat messages with the username or nickname.                                                                                                                                                                        |                       |\n| `/disable-name-prefix`               | Disables prefixing the chat messages with the username or nickname.                                                                                                                                                                       |                       |\n| `/register-nickname [str]`           | Registers or updates a nickname.                                                                                                                                                                                                          |                       |\n| `/unregister-nickname`               | Unregisters a nickname if it is registered.                                                                                                                                                                                               |                       |\n| `/get-nickname`                      | Returns the registered nickname if there is one.                                                                                                                                                                                          |                       |\n\n- You can also use `$ignore` at the beginning of a message to instruct the bot to ignore that message.\n- In channel monitor mode, setting it to `all` will cause the bot to reply to messages in all channels, except for those in the blacklist. Setting it to `none` will prevent the bot from replying to messages in any channel, except for those in the whitelist.\n- When name prefix is enabled, the bot will automatically add the Discord username or nickname (if registered via the `/register-nickname` command) of the message author to the front of the message. For example, the message `hello` will become `Joe: hello` when sent to the bot. This feature is useful for multi-person conversations, especially when giving the bot a prompt.\n- Nicknames, channel whitelist and blacklists are stored inside `config.json` file.\n\n## Limitation\n\n- Currently, the bot has only been tested on a single server and in direct messages.\n- The bot is a single instance only, which means that any messages or commands sent in direct messages or different channels will be treated as if they came from the same source.\n\n## Note\n\n- This is just a simple holiday project, might not update in the future. 🙃\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoesiu%2Fdiscord-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoesiu%2Fdiscord-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoesiu%2Fdiscord-chatbot/lists"}