File size: 5,025 Bytes
2362a2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# πŸ€– QueenNoxi β€” Complete Setup Guide

> Get every API key and config value needed to run the bot.

---

## 1. Telegram API Credentials (`API_ID` & `API_HASH`)

1. Go to **[my.telegram.org](https://my.telegram.org)**
2. Log in with your phone number
3. Click **"API development tools"**
4. Create an app (any name/platform is fine)
5. Copy **App api_id** β†’ `API_ID`
6. Copy **App api_hash** β†’ `API_HASH`

---

## 2. Bot Token (`TOKEN`)

1. Open Telegram β†’ message **[@BotFather](https://t.me/BotFather)**
2. Send `/newbot`
3. Choose a **name** (display name, e.g. `Queen Noxi`)
4. Choose a **username** (must end in `bot`, e.g. `QueenNoxiGroupBot`)
5. BotFather replies with your token:
   ```
   123456789:AABBccDDeeFFggHHiiJJ...
   ```
   β†’ `TOKEN`
6. Also set `BOT_NAME` = the display name you chose
7. Also set `BOT_USERNAME` = the username **without @**

> **Tip:** Also send `/setprivacy` β†’ `Disable` to let the bot read all group messages.

---

## 3. Your Owner ID (`OWNER_IDS`)

Message **[@userinfobot](https://t.me/userinfobot)** on Telegram.
It replies with your numeric user ID, e.g. `123456789`.

To add **multiple owners**, separate with spaces:
```
OWNER_IDS=123456789 987654321
```

---

## 4. MongoDB (`MONGO_DB_URI`)

> You already have MongoDB Atlas β€” reuse the same cluster or create a new database in it.

**To add a new database in your existing Atlas cluster:**
1. Go to **[cloud.mongodb.com](https://cloud.mongodb.com)**
2. Open your cluster β†’ **Browse Collections** β†’ **Add My Own Data**
3. Create a database named `QueenNoxi`
4. Your existing connection URI works β€” just change the DB name at the end:
   ```
   mongodb+srv://user:pass@cluster.xxxxx.mongodb.net/QueenNoxi?retryWrites=true&w=majority
   ```
   β†’ `MONGO_DB_URI`

---

## 5. PostgreSQL Database (`DATABASE_URL`)

### πŸ†“ Recommended: [Neon.tech](https://neon.tech)
*(Free forever β€” serverless, no credit card, never sleeps)*

1. Sign up at **[neon.tech](https://neon.tech)** (GitHub login works)
2. Click **"New Project"** β†’ choose a region closest to you
3. Wait ~10 seconds for provisioning
4. Go to **Dashboard β†’ Connection Details**
5. Select **"Pooled connection"** and copy the string:
   ```
   postgresql://user:pass@ep-xxx.us-east-2.aws.neon.tech/neondb?sslmode=require
   ```
   β†’ `DATABASE_URL`

| Alternative | Free Tier | Notes |
|---|---|---|
| [Supabase](https://supabase.com) | 500 MB | Pauses after 1 week inactive |
| [Railway](https://railway.app) | $5 credit/mo | Easiest UI |
| [Aiven](https://aiven.io) | 1 free service | Good uptime |

---

## 6. Support Chat (`SUPPORT_CHAT`)

You can provide either a public username or a full invite link.

- **Public Group:** Set `SUPPORT_CHAT=yourgroupusername` (without `@`)
- **Private Group:** Set `SUPPORT_CHAT=https://t.me/+xyz123...` (full invite link)

The bot will automatically handle either format for the support buttons in the menu.

---

## 7. Start Image (`START_IMG`)

Any **direct image URL** (must end in `.jpg`, `.png`, `.webp`).

Quick options:
- Upload to [imgbb.com](https://imgbb.com) β†’ get direct link
- Use any public Telegram CDN URL
- Use a raw GitHub image URL

---

## 8. Log Channel (`EVENT_LOGS`)

1. Create a private Telegram channel
2. Add your bot as **admin**
3. Forward any message from the channel to **[@getidsbot](https://t.me/getidsbot)**
4. Copy the **channel ID** (looks like `-100xxxxxxxxxx`)
   β†’ `EVENT_LOGS`

---

## 9. Optional API Keys

| Variable | Service | Cost | Link |
|---|---|---|---|
| `CASH_API_KEY` | Currency conversion | Free | [api.freecurrencyapi.com](https://freecurrencyapi.com) |
| `TIME_API_KEY` | Timezone lookup | Free | [timezonedb.com](https://timezonedb.com/api) |

---

## 10. Deploying on HuggingFace Spaces

1. Push this repo to **[Hugging Face](https://huggingface.co/new-space)**
   - Space SDK: **Docker**
   - Visibility: Public or Private
2. After creating, go to **Settings β†’ Variables and secrets**
3. Add each key below as a **Secret** (sensitive) or Variable:

| Type | Variables |
|---|---|
| πŸ” Secret | `API_ID`, `API_HASH`, `TOKEN`, `MONGO_DB_URI`, `DATABASE_URL`, `OWNER_IDS` |
| πŸ“ Variable | `BOT_NAME`, `BOT_USERNAME`, `SUPPORT_CHAT`, `START_IMG`, `EVENT_LOGS`, `WORKERS` |

4. The Space auto-builds and starts β€” watch **Logs** for any errors.
5. Your bot should come online within 2–3 minutes.

> **Health check:** HuggingFace pings `https://your-space.hf.space/health`
> The bot responds with `βœ… QueenNoxi is running!`

---

## 11. Minimum Required `.env` for Local Testing

```env
API_ID=12345678
API_HASH=your_api_hash_here
TOKEN=bot:token_here
OWNER_IDS=123456789
MONGO_DB_URI=mongodb+srv://user:pass@cluster.mongodb.net/QueenNoxi
BOT_NAME=QueenNoxi
BOT_USERNAME=yourbotusername
```

Run locally with:
```powershell
# Load .env vars and start the bot
Get-Content .env | ForEach-Object { if ($_ -match '^([^#=]+)=(.*)$') { [System.Environment]::SetEnvironmentVariable($Matches[1].Trim(), $Matches[2].Trim()) } }
python app.py
```