Spaces:
Sleeping
Sleeping
Commit ·
36a7fa8
1
Parent(s): 225f39b
update
Browse files- Dockerfile +22 -3
- README.md +10 -114
- bot/config.py +4 -4
Dockerfile
CHANGED
|
@@ -1,8 +1,27 @@
|
|
| 1 |
FROM python:3.11
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
CMD ["python", "-m", "bot"]
|
|
|
|
| 1 |
FROM python:3.11
|
| 2 |
|
| 3 |
+
# Create user with UID 1000 (Hugging Face requirement)
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
|
| 6 |
+
# Set environment variables for the non-root user
|
| 7 |
+
ENV HOME=/home/user \
|
| 8 |
+
PATH=/home/user/.local/bin:$PATH
|
| 9 |
+
|
| 10 |
+
# Set working directory (creates /home/user/app automatically)
|
| 11 |
+
WORKDIR $HOME/app
|
| 12 |
+
|
| 13 |
+
# (Optional) If you want to disable pip caching entirely, you can skip creating the cache directory.
|
| 14 |
+
# Otherwise, you could fix its permissions—but here we opt to disable caching.
|
| 15 |
+
RUN mkdir -p $HOME/.cache
|
| 16 |
|
| 17 |
+
# Adjust ownership/permissions for the app directory (and /usr if needed)
|
| 18 |
+
RUN chown -R 1000:0 $HOME/app $HOME/.cache /usr && \
|
| 19 |
+
chmod -R 777 $HOME/app /usr $HOME/.cache
|
| 20 |
+
|
| 21 |
+
COPY . $HOME/app
|
| 22 |
+
|
| 23 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
+
|
| 25 |
+
EXPOSE 7860
|
| 26 |
|
| 27 |
CMD ["python", "-m", "bot"]
|
README.md
CHANGED
|
@@ -1,114 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
* [**📝 Variables**](#variables)
|
| 12 |
-
* [**🕹 Deployment**](#deployment)
|
| 13 |
-
* [Locally](#d-1)
|
| 14 |
-
* [Docker](#d-2)
|
| 15 |
-
* [**⛑️ Need help!**](#help)
|
| 16 |
-
* [**❤️ Credits & Thanks**](#credits)
|
| 17 |
-
|
| 18 |
-
<a name="installation"></a>
|
| 19 |
-
|
| 20 |
-
## ⚙️ Installation
|
| 21 |
-
|
| 22 |
-
<a name="i-1"></a>
|
| 23 |
-
|
| 24 |
-
**1.Install Python & Git:**
|
| 25 |
-
|
| 26 |
-
For Windows:
|
| 27 |
-
```
|
| 28 |
-
winget install Python.Python.3.11
|
| 29 |
-
winget install Git.Git
|
| 30 |
-
```
|
| 31 |
-
For Linux:
|
| 32 |
-
```
|
| 33 |
-
sudo apt-get update && sudo apt-get install -y python3.11 git pip
|
| 34 |
-
```
|
| 35 |
-
For MacOS:
|
| 36 |
-
```
|
| 37 |
-
brew install python@3.11 git
|
| 38 |
-
```
|
| 39 |
-
For Termux:
|
| 40 |
-
```
|
| 41 |
-
pkg install python -y
|
| 42 |
-
pkg install git -y
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
<a name="i-2"></a>
|
| 46 |
-
|
| 47 |
-
**2.Download repository:**
|
| 48 |
-
```
|
| 49 |
-
git clone https://github.com/TheCaduceus/FileStreamBot.git
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
**3.Change Directory:**
|
| 53 |
-
|
| 54 |
-
```
|
| 55 |
-
cd FileStreamBot
|
| 56 |
-
```
|
| 57 |
-
|
| 58 |
-
<a name="i-3"></a>
|
| 59 |
-
|
| 60 |
-
**4.Install requirements:**
|
| 61 |
-
|
| 62 |
-
```
|
| 63 |
-
pip install -r requirements.txt
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
<a name="variables"></a>
|
| 67 |
-
|
| 68 |
-
## 📝 Variables
|
| 69 |
-
**The variables listed below should be defined either in [config.py](https://github.com/TheCaduceus/FileStreamBot/blob/main/bot/config.py) file or as environment variables, depending on your setup.**
|
| 70 |
-
* `API_ID`|`TELEGRAM_API_ID`: API ID of your Telegram account, can be obtained from [My Telegram](https://my.telegram.org). `int`
|
| 71 |
-
* `API_HASH`|`TELEGRAM_API_HASH`: API hash of your Telegram account, can be obtained from [My Telegram](https://my.telegram.org). `str`
|
| 72 |
-
* `OWNER_ID`: ID of your Telegram account, can be obtained by sending **/info** to [@DumpJsonBot](https://t.me/DumpJsonBot). `int`
|
| 73 |
-
* `ALLOWED_USER_IDS`: A list of Telegram account IDs (separated by spaces) that are permitted to use the bot. Leave this field empty to allow anyone to use it. `str`
|
| 74 |
-
* `BOT_USERNAME`|`TELEGRAM_BOT_USERNAME`: Username of your Telegram bot, create one using [@BotFather](https://t.me/BotFather). `str`
|
| 75 |
-
* `BOT_TOKEN`|`TELEGRAM_BOT_TOKEN`: Telegram API token of your bot, can be obtained from [@BotFather](https://t.me/BotFather). `str`
|
| 76 |
-
* `CHANNEL_ID`|`TELEGRAM_CHANNEL_ID`: ID of the channel where bot will forward all files received from users, can be obtained by forwarding any message from channel to [@DumpJsonBot](https://t.me/DumpJsonBot) and then looking from `forward_from_chat` key. `int`
|
| 77 |
-
* `SECRET_CODE_LENGTH`: Number of characters that file code should contain, by default to 24 characters. `int`
|
| 78 |
-
* `BASE_URL`: Base URL that bot should use while generating file links, can be FQDN and by default to `127.0.0.1`. `str`
|
| 79 |
-
* `BIND_ADDRESS`: Bind address for web server, by default to `0.0.0.0` to run on all possible addresses. `str`
|
| 80 |
-
* `PORT`: Port for web server to run on, by default to `8080`. `int`
|
| 81 |
-
|
| 82 |
-
## 🕹 Deployment
|
| 83 |
-
> [!NOTE]
|
| 84 |
-
> This bot is designed for personal use or to share with friends and family only. It is not intended for mass public use or exposure to a large audience.
|
| 85 |
-
|
| 86 |
-
<a name="d-1"></a>
|
| 87 |
-
|
| 88 |
-
**1.Running locally:**
|
| 89 |
-
```
|
| 90 |
-
python -m bot
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
-
<a name="d-2"></a>
|
| 94 |
-
|
| 95 |
-
**2.Using Docker:** *(Recommended)*
|
| 96 |
-
* Build own Docker image:
|
| 97 |
-
```
|
| 98 |
-
docker build -t file-stream-bot .
|
| 99 |
-
```
|
| 100 |
-
* Run the Docker container:
|
| 101 |
-
```
|
| 102 |
-
docker run -p 8080:8080 file-stream-bot
|
| 103 |
-
```
|
| 104 |
-
|
| 105 |
-
<a name="help"></a>
|
| 106 |
-
|
| 107 |
-
## ⛑️ Need help!
|
| 108 |
-
- Ask questions or doubts [here](https://t.me/DrDiscussion).
|
| 109 |
-
|
| 110 |
-
<a name="credits"></a>
|
| 111 |
-
|
| 112 |
-
## ❤️ Credits & Thanks
|
| 113 |
-
|
| 114 |
-
[**Dr.Caduceus**](https://github.com/TheCaduceus): Owner & developer of File Stream Bot.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Maakichu
|
| 3 |
+
emoji: ⚡
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bot/config.py
CHANGED
|
@@ -5,15 +5,15 @@ class Telegram:
|
|
| 5 |
API_HASH = env.get("TELEGRAM_API_HASH", "xyz")
|
| 6 |
OWNER_ID = int(env.get("OWNER_ID", 5530237028))
|
| 7 |
ALLOWED_USER_IDS = env.get("ALLOWED_USER_IDS", "").split()
|
| 8 |
-
BOT_USERNAME = env.get("TELEGRAM_BOT_USERNAME", "
|
| 9 |
BOT_TOKEN = env.get("TELEGRAM_BOT_TOKEN", "1234567:xyz")
|
| 10 |
-
CHANNEL_ID = int(env.get("TELEGRAM_CHANNEL_ID", -
|
| 11 |
SECRET_CODE_LENGTH = int(env.get("SECRET_CODE_LENGTH", 24))
|
| 12 |
|
| 13 |
class Server:
|
| 14 |
-
BASE_URL = env.get("BASE_URL", "
|
| 15 |
BIND_ADDRESS = env.get("BIND_ADDRESS", "0.0.0.0")
|
| 16 |
-
PORT = int(env.get("PORT",
|
| 17 |
|
| 18 |
# LOGGING CONFIGURATION
|
| 19 |
LOGGER_CONFIG_JSON = {
|
|
|
|
| 5 |
API_HASH = env.get("TELEGRAM_API_HASH", "xyz")
|
| 6 |
OWNER_ID = int(env.get("OWNER_ID", 5530237028))
|
| 7 |
ALLOWED_USER_IDS = env.get("ALLOWED_USER_IDS", "").split()
|
| 8 |
+
BOT_USERNAME = env.get("TELEGRAM_BOT_USERNAME", "xxxx_streambot")
|
| 9 |
BOT_TOKEN = env.get("TELEGRAM_BOT_TOKEN", "1234567:xyz")
|
| 10 |
+
CHANNEL_ID = int(env.get("TELEGRAM_CHANNEL_ID", -1001684936508))
|
| 11 |
SECRET_CODE_LENGTH = int(env.get("SECRET_CODE_LENGTH", 24))
|
| 12 |
|
| 13 |
class Server:
|
| 14 |
+
BASE_URL = env.get("BASE_URL", "https://kawaiimizo-maakichu.hf.space")
|
| 15 |
BIND_ADDRESS = env.get("BIND_ADDRESS", "0.0.0.0")
|
| 16 |
+
PORT = int(env.get("PORT", 7860))
|
| 17 |
|
| 18 |
# LOGGING CONFIGURATION
|
| 19 |
LOGGER_CONFIG_JSON = {
|