{"id":25212879,"url":"https://github.com/bot08/local-llm-discord-bot","last_synced_at":"2026-04-21T10:03:10.890Z","repository":{"id":266547103,"uuid":"876682518","full_name":"bot08/local-llm-discord-bot","owner":"bot08","description":"A lightweight Discord bot interface for interacting with locally-hosted language models. Supports conversation history, streaming responses, and custom configurations.","archived":false,"fork":false,"pushed_at":"2025-05-05T18:59:33.000Z","size":49,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T19:56:06.748Z","etag":null,"topics":["discord-bot","discord-py","llama","llamacpp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bot08.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-22T11:41:16.000Z","updated_at":"2025-05-05T18:59:34.000Z","dependencies_parsed_at":"2024-12-04T20:36:18.950Z","dependency_job_id":"7e84efe1-9982-4af7-8d55-6062acbb267e","html_url":"https://github.com/bot08/local-llm-discord-bot","commit_stats":null,"previous_names":["bot08/local-llm-discord-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bot08/local-llm-discord-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot08%2Flocal-llm-discord-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot08%2Flocal-llm-discord-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot08%2Flocal-llm-discord-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot08%2Flocal-llm-discord-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bot08","download_url":"https://codeload.github.com/bot08/local-llm-discord-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bot08%2Flocal-llm-discord-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745597,"owners_count":24813509,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["discord-bot","discord-py","llama","llamacpp"],"created_at":"2025-02-10T15:17:58.123Z","updated_at":"2026-04-21T10:03:10.854Z","avatar_url":"https://github.com/bot08.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local LLM Discord Bot Interface\n\nA lightweight Discord bot interface for interacting with locally-hosted language models. Supports conversation history, streaming responses, and custom configurations.\n\n---\n\n## Core Features\n\n- **DM-Only Interactions**: Restrict bot usage to private messages\n- **Context-Aware Chat**: Maintains limited conversation history per user\n- **Ping \u0026 Clear Commands**: `ping` displays bot latency, `clear` resets user history\n- **Message Chunking**: Automatically splits long responses (\u003e2000 chars)\n- **Custom Username Injection**: Use [user] in SYSTEM_PROMPT to dynamically insert the current user's name\n- **GPU Acceleration**: Configure offloading layers for performance\n- **Streaming Mode**: Real-time token delivery with typing simulation\n- **Custom Prompts**: Modify system behavior via `SYSTEM_PROMPT`\n- **Thread Safety**: Prevents race conditions with user-level locks\n\n---\n\n## Setup Guide\n\n1. **Install Requirements**:\n    ```bash\n    pip install discord.py llama-cpp-python python-dotenv\n    ```\n\n2. **Create `.env`**:\n    ```env\n    DISCORD_TOKEN=TOKEN\n    MODEL_PATH=Llama-3.1-8B-Q4_K_L.gguf\n    # Required parameters above. Optional below:\n    COMMAND_PREFIX=!\n    FULL_LOG=FALSE\n    MODEL_N_CTX=1024\n    MAX_TOKENS=256\n    TOP_K=40\n    TOP_P=0.95\n    MIN_P=0.05\n    TEMPERATURE=0.7\n    REPEAT_PENALTY=1.1\n    GPU_LAYERS=7\n    ONLY_DM=TRUE\n    HISTORY_LIMIT=3\n    STREAM_MODE=FALSE\n    SYSTEM_PROMPT=You are a helpful assistant. Answer as concisely as possible.\n    ```\n\n3. **Run Bot**:\n    ```bash\n    python main.py\n    ```\n\n---\n\n## Full .env Configuration\n\n| Parameter             | Type     | Description                                      | Default               |\n|-----------------------|----------|--------------------------------------------------|-----------------------|\n| `DISCORD_TOKEN`       | String   | **Required** Discord bot token                  | -                     |\n| `COMMAND_PREFIX`      | String   | Bot command prefix                              | `!`                   |\n| `FULL_LOG`            | Boolean  | Enable verbose logging                          | `FALSE`               |\n| `MODEL_PATH`          | String   | **Required** Path to GGUF model file            | -                     |\n| `CHAT_FORMAT`         | String   | Chat formatting style for model                 | `None`                |\n| `MODEL_N_CTX`         | Integer  | Context window size                             | `1024`                |\n| `MAX_TOKENS`          | Integer  | Maximum tokens per response                     | `256`                 |\n| `TOP_K`               | Integer  | Top-k sampling                                  | `40`                  |\n| `TOP_P`               | Float    | Top-p sampling                                  | `0.95`                |\n| `MIN_P`               | Float    | Min-p sampling                                  | `0.05`                |\n| `TEMPERATURE`         | Float    | Response randomness (0.1-2.0)                   | `0.7`                 |\n| `REPEAT_PENALTY`      | Float    | Penalize repeated phrases                       | `1.1`                 |\n| `GPU_LAYERS`          | Integer  | GPU offloading layers (0=CPU-only)              | `0`                   |\n| `ONLY_DM`             | Boolean  | Bot responds only in DMs                        | `TRUE`                |\n| `HISTORY_LIMIT`       | Integer  | Max stored message pairs (user+assistant)       | `3`                   |\n| `STREAM_MODE`         | Boolean  | Enable real-time token streaming                | `FALSE`               |\n| `SYSTEM_PROMPT`       | String   | Initial assistant behavior prompt               | `You are a helpful...`|\n\n---\n\n## TODO\n\n- **Stream fix**:\n  - Fix generation interruption caused by Discord API rate limits\n  - Implement adaptive delay between token sends\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbot08%2Flocal-llm-discord-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbot08%2Flocal-llm-discord-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbot08%2Flocal-llm-discord-bot/lists"}